static void update_topol(const char *topinout, int p_num, int n_num,
const char *p_name, const char *n_name, char *grpname)
{
-#define TEMP_FILENM "temp.top"
FILE *fpin, *fpout;
char buf[STRLEN], buf2[STRLEN], *temp, **mol_line = NULL;
int line, i, nsol, nmol_line, sol_line, nsol_last;
gmx_bool bMolecules;
+ char temporary_filename[STRLEN];
printf("\nProcessing topology\n");
fpin = gmx_ffopen(topinout, "r");
- fpout = gmx_ffopen(TEMP_FILENM, "w");
+ strncpy(temporary_filename, "temp.topXXXXXX", STRLEN);
+ gmx_tmpnam(temporary_filename);
+ fpout = gmx_ffopen(temporary_filename, "w");
line = 0;
bMolecules = FALSE;
/* use gmx_ffopen to generate backup of topinout */
fpout = gmx_ffopen(topinout, "w");
gmx_ffclose(fpout);
- rename(TEMP_FILENM, topinout);
-#undef TEMP_FILENM
+ rename(temporary_filename, topinout);
}
int gmx_genion(int argc, char *argv[])
/* Copy pointer */
rbuf = b->rbuf+b->nreal;
-#if (__ICC == 1500 || __ICL == 1500) && defined __MIC__
+#if (__ICC >= 1500 || __ICL >= 1500) && defined __MIC__
#pragma novector /* Work-around for incorrect vectorization */
#endif
for (i = 0; (i < nr); i++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
gmx_atomprop_t aps)
{
-#define TEMP_FILENM "temp.top"
FILE *fpin, *fpout;
char buf[STRLEN], buf2[STRLEN], *temp;
const char *topinout;
topinout = ftp2fn(efTOP, NFILE, fnm);
if (ftp2bSet(efTOP, NFILE, fnm) )
{
+ char temporary_filename[STRLEN];
+ strncpy(temporary_filename, "temp.topXXXXXX", STRLEN);
+
fprintf(stderr, "Processing topology\n");
fpin = gmx_ffopen(topinout, "r");
- fpout = gmx_ffopen(TEMP_FILENM, "w");
+ gmx_tmpnam(temporary_filename);
+ fpout = gmx_ffopen(temporary_filename, "w");
line = 0;
bSystem = bMolecules = FALSE;
while (fgets(buf, STRLEN, fpin))
/* use gmx_ffopen to generate backup of topinout */
fpout = gmx_ffopen(topinout, "w");
gmx_ffclose(fpout);
- rename(TEMP_FILENM, topinout);
+ rename(temporary_filename, topinout);
}
-#undef TEMP_FILENM
}
int gmx_solvate(int argc, char *argv[])
/* Write a topology where the number of molecules is correct for the system after embedding */
static void top_update(const char *topfile, rm_t *rm_p, gmx_mtop_t *mtop)
{
-#define TEMP_FILENM "temp.top"
- int bMolecules = 0;
+ int bMolecules = 0;
FILE *fpin, *fpout;
char buf[STRLEN], buf2[STRLEN], *temp;
int i, *nmol_rm, nmol, line;
+ char temporary_filename[STRLEN];
fpin = gmx_ffopen(topfile, "r");
- fpout = gmx_ffopen(TEMP_FILENM, "w");
+ strncpy(temporary_filename, "temp.topXXXXXX", STRLEN);
+ gmx_tmpnam(temporary_filename);
+ fpout = gmx_ffopen(temporary_filename, "w");
snew(nmol_rm, mtop->nmoltype);
for (i = 0; i < rm_p->nr; i++)
/* use gmx_ffopen to generate backup of topinout */
fpout = gmx_ffopen(topfile, "w");
gmx_ffclose(fpout);
- rename(TEMP_FILENM, topfile);
-#undef TEMP_FILENM
+ rename(temporary_filename, topfile);
}
void rescale_membed(int step_rel, gmx_membed_t membed, rvec *x)
{
/* now broadcast everything to the non-master nodes/threads: */
init_parallel(cr, inputrec, mtop);
+
+ /* The master rank decided on the use of GPUs,
+ * broadcast this information to all ranks.
+ */
+ gmx_bcast_sim(sizeof(bUseGPU), &bUseGPU, cr);
}
+
if (fplog != NULL)
{
pr_inputrec(fplog, 0, "Input Parameters", inputrec, FALSE);
cr->npmenodes = 0;
}
+ if (bUseGPU && cr->npmenodes < 0)
+ {
+ /* With GPUs we don't automatically use PME-only ranks. PME ranks can
+ * improve performance with many threads per GPU, since our OpenMP
+ * scaling is bad, but it's difficult to automate the setup.
+ */
+ cr->npmenodes = 0;
+ }
+
#ifdef GMX_FAHCORE
if (MASTER(cr))
{
gmx_feenableexcept();
}
#endif
- if (PAR(cr))
- {
- /* The master rank decided on the use of GPUs,
- * broadcast this information to all ranks.
- */
- gmx_bcast_sim(sizeof(bUseGPU), &bUseGPU, cr);
- }
if (bUseGPU)
{
- if (cr->npmenodes == -1)
- {
- /* Don't automatically use PME-only nodes with GPUs */
- cr->npmenodes = 0;
- }
-
/* Select GPU id's to use */
gmx_select_gpu_ids(fplog, cr, &hwinfo->gpu_info, bForceUseGPU,
&hw_opt->gpu_opt);