Merge release-5-0 into master
authorRoland Schulz <roland@utk.edu>
Fri, 5 Jun 2015 18:15:33 +0000 (14:15 -0400)
committerRoland Schulz <roland@utk.edu>
Fri, 5 Jun 2015 18:15:42 +0000 (14:15 -0400)
Conflicts:
src/gromacs/gmxlib/rbin.c
(added also ICC16)
src/gromacs/mdlib/tpi.cpp
(gmx_simd_check_and_reset_overflow was removed already
in master branch, so no changes needed here)
        src/programs/mdrun/runner.cpp
(adjacent additions)

Change-Id: I85d92bce71ebeb6e38ac63bb61c3931d5bb54c16

src/gromacs/gmxana/gmx_genion.c
src/gromacs/gmxlib/rbin.c
src/gromacs/gmxpreprocess/solvate.cpp
src/programs/mdrun/membed.c
src/programs/mdrun/runner.cpp

index 4db8d1ceabe5c6781d894b62437e2a3b0cfebd0a..2790a4213f8243f70129ec48b79f60cd0d63b73d 100644 (file)
@@ -234,15 +234,17 @@ void sort_ions(int nsa, int nw, int repl[], atom_id index[],
 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;
@@ -338,8 +340,7 @@ static void update_topol(const char *topinout, int p_num, int n_num,
     /* 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[])
index 4b0596482c819ae73435dad5656ea08911eb5f0e..3bd1e820beb1a58253349dd9ada86f0db97c3769 100644 (file)
@@ -86,7 +86,7 @@ int add_binr(t_bin *b, int nr, real r[])
     /* 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++)
index 137dd3e720d6cf98ed53684eaaa4763a5944282d..76eace9657d4d77101d4940cde264aa58e1fcdbe 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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.
@@ -702,7 +702,6 @@ static void add_solv(const char *fn, t_atoms *atoms, rvec **x, rvec **v,
 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;
@@ -742,9 +741,13 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
     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))
@@ -824,9 +827,8 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
         /* 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[])
index 6e68fdcf71dad90773f1c19a5421818b4a166e6e..fae5d4ddc3b9f919dc8df0b17c9821d91d387766 100644 (file)
@@ -886,14 +886,16 @@ int rm_bonded(t_block *ins_at, gmx_mtop_t *mtop)
 /* 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++)
@@ -962,8 +964,7 @@ static void top_update(const char *topfile, rm_t *rm_p, gmx_mtop_t *mtop)
     /* 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)
index ffa7a8df29037f2f94685d88b20eefad9d78b77b..8956d4442bedc77b0a0e49e6181e0be132a26fef 100644 (file)
@@ -1171,7 +1171,13 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
     {
         /* 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);
@@ -1222,6 +1228,15 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
         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))
     {
@@ -1390,22 +1405,9 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
         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);