[mpich-commits] r10684 - mpich2/trunk/test/mpi/rma

dinan at mcs.anl.gov dinan at mcs.anl.gov
Tue Nov 27 17:40:13 CST 2012


Author: dinan
Date: 2012-11-27 17:40:13 -0600 (Tue, 27 Nov 2012)
New Revision: 10684

Modified:
   mpich2/trunk/test/mpi/rma/reqops.c
Log:
RMA Req-ops: Test to check handling of PROC_NULL

Updated existing request-generating RMA ops test to verify that communication
with PROC_NULL is handled correctly.

Reviewer: goodell

Modified: mpich2/trunk/test/mpi/rma/reqops.c
===================================================================
--- mpich2/trunk/test/mpi/rma/reqops.c	2012-11-27 23:40:11 UTC (rev 10683)
+++ mpich2/trunk/test/mpi/rma/reqops.c	2012-11-27 23:40:13 UTC (rev 10684)
@@ -6,6 +6,7 @@
  */
 #include <mpi.h>
 #include <stdio.h>
+#include <assert.h>
 #include "mpitest.h"
 
 #define ITER 100
@@ -29,13 +30,37 @@
     /** Create using MPI_Win_create() **/
 
     if (rank == 0) {
-      MPI_Alloc_mem(sizeof(int), MPI_INFO_NULL, &buf);
+      MPI_Alloc_mem(4*sizeof(int), MPI_INFO_NULL, &buf);
       *buf = nproc-1;
     } else
       buf = NULL;
 
-    MPI_Win_create(buf, sizeof(int)*(rank == 0), 1, MPI_INFO_NULL, MPI_COMM_WORLD, &window);
+    MPI_Win_create(buf, 4*sizeof(int)*(rank == 0), 1, MPI_INFO_NULL, MPI_COMM_WORLD, &window);
 
+    /* PROC_NULL Communication */
+    {
+        MPI_Request pn_req[4];
+        int val[4], res;
+
+        MPI_Win_lock_all(0, window);
+
+        MPI_Rget_accumulate(&val[0], 1, MPI_INT, &res, 1, MPI_INT, MPI_PROC_NULL, 0, 1, MPI_INT, MPI_REPLACE, window, &pn_req[0]);
+        MPI_Rget(&val[1], 1, MPI_INT, MPI_PROC_NULL, 1, 1, MPI_INT, window, &pn_req[1]);
+        MPI_Rput(&val[2], 1, MPI_INT, MPI_PROC_NULL, 2, 1, MPI_INT, window, &pn_req[2]);
+        MPI_Raccumulate(&val[3], 1, MPI_INT, MPI_PROC_NULL, 3, 1, MPI_INT, MPI_REPLACE, window, &pn_req[3]);
+
+        assert(pn_req[0] != MPI_REQUEST_NULL);
+        assert(pn_req[1] != MPI_REQUEST_NULL);
+        assert(pn_req[2] != MPI_REQUEST_NULL);
+        assert(pn_req[3] != MPI_REQUEST_NULL);
+
+        MPI_Win_unlock_all(window);
+
+        MPI_Waitall(4, pn_req, MPI_STATUSES_IGNORE);
+    }
+
+    MPI_Barrier(MPI_COMM_WORLD);
+
     MPI_Win_lock(MPI_LOCK_SHARED, 0, 0, window);
 
     /* GET-ACC: Test third-party communication, through rank 0. */
@@ -51,6 +76,7 @@
         }
 
         MPI_Rget_accumulate(&rank, 1, MPI_INT, &val, 1, MPI_INT, 0, 0, 1, MPI_INT, MPI_REPLACE, window, &gacc_req);
+        assert(gacc_req != MPI_REQUEST_NULL);
         MPI_Wait(&gacc_req, MPI_STATUS_IGNORE);
 
         exp = (rank + nproc-1) % nproc;
@@ -85,9 +111,11 @@
         }
 
         MPI_Rget(&val, 1, MPI_INT, 0, 0, 1, MPI_INT, window, &req);
+        assert(req != MPI_REQUEST_NULL);
         MPI_Wait(&req, MPI_STATUS_IGNORE);
 
         MPI_Rput(&rank, 1, MPI_INT, 0, 0, 1, MPI_INT, window, &req);
+        assert(req != MPI_REQUEST_NULL);
         MPI_Wait(&req, MPI_STATUS_IGNORE);
 
         exp = (rank + nproc-1) % nproc;
@@ -122,9 +150,11 @@
         }
 
         MPI_Rget(&val, 1, MPI_INT, 0, 0, 1, MPI_INT, window, &req);
+        assert(req != MPI_REQUEST_NULL);
         MPI_Wait(&req, MPI_STATUS_IGNORE);
 
         MPI_Raccumulate(&rank, 1, MPI_INT, 0, 0, 1, MPI_INT, MPI_REPLACE, window, &req);
+        assert(req != MPI_REQUEST_NULL);
         MPI_Wait(&req, MPI_STATUS_IGNORE);
 
         exp = (rank + nproc-1) % nproc;



More information about the commits mailing list