Fix bug accumulating nrank_pp_intranode on PME ranks
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 31 Mar 2014 14:28:36 +0000 (16:28 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 2 Apr 2014 08:02:30 +0000 (10:02 +0200)
The old code led to cr->nrank_pp_intranode=zero on PME ranks, which
meant that a command line of mpirun -np 4 mdrun -npme 2 on a two-GPU
node would fail, because gmx_select_gpu_ids() runs on all ranks, and
it calls limit_num_gpus_used() which thinks 0 PP ranks and 2 GPUs is
silly. Adding -gpu_id 01 works, of course, but that takes a different
code path in gmx_select_gpu_ids().

Change-Id: Iecd43ef9b71e2cc0339e93724b6b1071f0a159f6

src/gromacs/gmxlib/network.c

index 06780b90c72b71dcae40a6bb2663ff17bdbe7a06..afd3ba652902f0f1bf6cc2f483b391ff9fa56a9c 100644 (file)
@@ -426,10 +426,10 @@ void gmx_init_intranode_counters(t_commrec *cr)
                 rank_intranode++;
             }
         }
-        if ((cr->duty & DUTY_PP) && num_pp[i] == mynum)
+        if (num_pp[i] == mynum)
         {
             nrank_pp_intranode++;
-            if (i < rank_world)
+            if ((cr->duty & DUTY_PP) && i < rank_world)
             {
                 rank_pp_intranode++;
             }