changed PME MPI_Comm comparisions to MPI_COMM_NULL, fixes #931
authorBerk Hess <hess@kth.se>
Fri, 27 Apr 2012 08:59:12 +0000 (10:59 +0200)
committerBerk Hess <hess@kth.se>
Fri, 27 Apr 2012 11:24:09 +0000 (13:24 +0200)
Change-Id: I6087339c5609de0444ac578c217825b9918cb993

src/mdlib/fft5d.c
src/mdlib/pme.c

index afc8d093f311f759771e1751f4f1b68ce3d034d3..86091776d80050aedb1e9dcb8d740ddb7d6664c0 100644 (file)
@@ -191,7 +191,7 @@ fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_
 
     /* comm, prank and P are in the order of the decomposition (plan->cart is in the order of transposes) */
 #ifdef GMX_MPI
-    if (GMX_PARALLEL_ENV_INITIALIZED && comm[0] != 0)
+    if (GMX_PARALLEL_ENV_INITIALIZED && comm[0] != MPI_COMM_NULL)
     {
         MPI_Comm_size(comm[0],&P[0]);
         MPI_Comm_rank(comm[0],&prank[0]);
@@ -203,7 +203,7 @@ fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_
         prank[0] = 0;
     }
 #ifdef GMX_MPI
-    if (GMX_PARALLEL_ENV_INITIALIZED && comm[1] != 0)
+    if (GMX_PARALLEL_ENV_INITIALIZED && comm[1] != MPI_COMM_NULL)
     {
         MPI_Comm_size(comm[1],&P[1]);
         MPI_Comm_rank(comm[1],&prank[1]);
@@ -868,7 +868,7 @@ void fft5d_execute(fft5d_plan plan,fft5d_time times) {
         if (plan->flags&FFT5D_DEBUG) print_localdata(lout, "%d %d: FFT %d\n", s, plan);
         
 #ifdef GMX_MPI
-        if (GMX_PARALLEL_ENV_INITIALIZED && cart[s] !=0 && P[s]>1 )
+        if (GMX_PARALLEL_ENV_INITIALIZED && cart[s]!=MPI_COMM_NULL && P[s]>1)
         {
             if (times!=0)
                 time=MPI_Wtime(); 
index 622d15f5444458c08a2d7d3747b8165b89d5d9b9..735c0e878ae5f68e226540f6712e8a854155f178 100644 (file)
@@ -2059,7 +2059,7 @@ int gmx_pme_init(gmx_pme_t *         pmedata,
 #ifdef GMX_MPI
     if (nnodes_major*nnodes_minor > 1 && PAR(cr)) 
     {
-        pme->mpi_comm        = cr->mpi_comm_mygroup;
+        pme->mpi_comm = cr->mpi_comm_mygroup;
         
         MPI_Comm_rank(pme->mpi_comm,&pme->nodeid);
         MPI_Comm_size(pme->mpi_comm,&pme->nnodes);
@@ -2068,6 +2068,10 @@ int gmx_pme_init(gmx_pme_t *         pmedata,
             gmx_incons("PME node count mismatch");
         }
     }
+    else
+    {
+        pme->mpi_comm = MPI_COMM_NULL;
+    }
 #endif
 
     if (pme->nnodes == 1)
@@ -2082,7 +2086,7 @@ int gmx_pme_init(gmx_pme_t *         pmedata,
         {
 #ifdef GMX_MPI
             pme->mpi_comm_d[0] = pme->mpi_comm;
-            pme->mpi_comm_d[1] = NULL;
+            pme->mpi_comm_d[1] = MPI_COMM_NULL;
 #endif
             pme->ndecompdim = 1;
             pme->nodeid_major = pme->nodeid;
@@ -2092,7 +2096,7 @@ int gmx_pme_init(gmx_pme_t *         pmedata,
         else if (nnodes_major == 1)
         {
 #ifdef GMX_MPI
-            pme->mpi_comm_d[0] = NULL;
+            pme->mpi_comm_d[0] = MPI_COMM_NULL;
             pme->mpi_comm_d[1] = pme->mpi_comm;
 #endif
             pme->ndecompdim = 1;