Don't use PME ranks with GPUs and -npme=-1
authorBerk Hess <hess@kth.se>
Tue, 19 May 2015 09:10:06 +0000 (11:10 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 5 Jun 2015 17:46:39 +0000 (19:46 +0200)
The code disabling the automated PME rank choice with GPUs was
accidentally moved after init_domain_decomposition. This caused
PME ranks to be set up, but later a fatal_error occured for
inconsistent PP rank and GPU counts.
Refs #1374.

Change-Id: I5f6bcc90fecac7f63b332b8f1acca7368b5f71bc

src/programs/mdrun/runner.c

index b1e52db1d7c80d78e89869392126cfaefe6b0125..744e9f501e301cede3bcaac6434dccf8d4eb2e13 100644 (file)
@@ -1328,7 +1328,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);
@@ -1379,6 +1385,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))
     {
@@ -1547,22 +1562,8 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
                           (cr->duty & DUTY_PP) == 0,
                           inputrec->cutoff_scheme == ecutsVERLET);
 
-    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);