[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2a1-15-g9eacce0

Service Account noreply at mpich.org
Fri Sep 19 10:37:03 CDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  9eacce005f347eeaba824f143a00974aafc0d27d (commit)
       via  96ca97960ab8adb63ded829670f28dd845c17e13 (commit)
       via  90096d60602d64efcdf440729aa0e104872ae18f (commit)
      from  232c39024cf3af13568362b4ac6baba50b8d6068 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/9eacce005f347eeaba824f143a00974aafc0d27d

commit 9eacce005f347eeaba824f143a00974aafc0d27d
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Tue Sep 16 11:00:43 2014 -0500

    Enable SHM in PSCW tests.
    
    Enable using MPI_Win_allocate, which by default turns
    on SHM window, in PSCW tests, so that we can test PSCW
    on SHM window.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am
index ac88fdc..5975aea 100644
--- a/test/mpi/rma/Makefile.am
+++ b/test/mpi/rma/Makefile.am
@@ -17,7 +17,9 @@ noinst_PROGRAMS =          \
     ircpi                  \
     test1                  \
     test2                  \
+    test2_shm              \
     test3                  \
+    test3_shm              \
     test4                  \
     test5                  \
     lockcontention         \
@@ -30,9 +32,11 @@ noinst_PROGRAMS =          \
     put_bottom             \
     locknull               \
     wintest                \
+    wintest_shm            \
     transpose1             \
     transpose2             \
     transpose3             \
+    transpose3_shm         \
     transpose4             \
     transpose5             \
     transpose6             \
@@ -53,7 +57,9 @@ noinst_PROGRAMS =          \
     contig_displ           \
     test1_am               \
     test2_am               \
+    test2_am_shm           \
     test3_am               \
+    test3_am_shm           \
     test4_am               \
     test5_am               \
     fetchandadd_am         \
@@ -65,10 +71,12 @@ noinst_PROGRAMS =          \
     fkeyvalwin             \
     baseattrwin            \
     nullpscw               \
+    nullpscw_shm	   \
     rmanull                \
     rmazero                \
     mixedsync              \
     manyrma2		   \
+    manyrma2_shm           \
     manyrma3		   \
     selfrma                \
     strided_acc_onelock    \
@@ -118,6 +126,7 @@ noinst_PROGRAMS =          \
     req_example_shm        \
     win_info               \
     pscw_ordering          \
+    pscw_ordering_shm	   \
     mutex_bench            \
     mutex_bench_shared     \
     mutex_bench_shm        \
@@ -173,6 +182,26 @@ get_accumulate_int_derived_SOURCES      = get_accumulate.c
 req_example_shm_CPPFLAGS         = -DUSE_WIN_ALLOC_SHM $(AM_CPPFLAGS)
 req_example_shm_SOURCES          = req_example.c
 
+manyrma2_shm_CPPFLAGS            = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+wintest_shm_CPPFLAGS             = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+transpose3_shm_CPPFLAGS          = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+nullpscw_shm_CPPFLAGS            = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+pscw_ordering_shm_CPPFLAGS       = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test2_shm_CPPFLAGS               = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test2_am_shm_CPPFLAGS            = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test3_shm_CPPFLAGS               = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test3_am_shm_CPPFLAGS            = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+
+manyrma2_shm_SOURCES             = manyrma2.c
+wintest_shm_SOURCES              = wintest.c
+transpose3_shm_SOURCES           = transpose3.c
+nullpscw_shm_SOURCES             = nullpscw.c
+pscw_ordering_shm_SOURCES        = pscw_ordering.c
+test2_shm_SOURCES                = test2.c
+test2_am_shm_SOURCES             = test2_am.c
+test3_shm_SOURCES                = test3.c
+test3_am_shm_SOURCES             = test3_am.c
+
 mutex_bench_SOURCES              = mutex_bench.c mcs-mutex.c mcs-mutex.h
 mutex_bench_shared_CPPFLAGS      = -DUSE_WIN_SHARED $(AM_CPPFLAGS)
 mutex_bench_shared_SOURCES       = mutex_bench.c mcs-mutex.c mcs-mutex.h
diff --git a/test/mpi/rma/manyrma2.c b/test/mpi/rma/manyrma2.c
index 571d29e..eb7f860 100644
--- a/test/mpi/rma/manyrma2.c
+++ b/test/mpi/rma/manyrma2.c
@@ -112,6 +112,14 @@ int main(int argc, char *argv[])
     MPI_Group_free(&wgroup);
 
     arraysize = maxSz * MAX_COUNT;
+#ifdef USE_WIN_ALLOCATE
+    MPI_Win_allocate(arraysize * sizeof(int), (int) sizeof(int), MPI_INFO_NULL,
+                     MPI_COMM_WORLD, &arraybuffer, &win);
+    if (!arraybuffer) {
+        fprintf(stderr, "Unable to allocate %d words\n", arraysize);
+        MPI_Abort(MPI_COMM_WORLD, 1);
+    }
+#else
     arraybuffer = (int *) malloc(arraysize * sizeof(int));
     if (!arraybuffer) {
         fprintf(stderr, "Unable to allocate %d words\n", arraysize);
@@ -120,6 +128,7 @@ int main(int argc, char *argv[])
 
     MPI_Win_create(arraybuffer, arraysize * sizeof(int), (int) sizeof(int),
                    MPI_INFO_NULL, MPI_COMM_WORLD, &win);
+#endif
 
     if (maxCount > MAX_COUNT) {
         fprintf(stderr, "MaxCount must not exceed %d\n", MAX_COUNT);
@@ -212,6 +221,10 @@ int main(int argc, char *argv[])
 
     MPI_Win_free(&win);
 
+#ifndef USE_WIN_ALLOCATE
+    free(arraybuffer);
+#endif
+
     MPI_Group_free(&accessGroup);
     MPI_Group_free(&exposureGroup);
 
diff --git a/test/mpi/rma/nullpscw.c b/test/mpi/rma/nullpscw.c
index c5b1342..38d9472 100644
--- a/test/mpi/rma/nullpscw.c
+++ b/test/mpi/rma/nullpscw.c
@@ -15,7 +15,12 @@ int main(int argc, char* argv[])
 
   MTest_Init(&argc,&argv); 
 
+#ifdef USE_WIN_ALLOCATE
+  char *baseptr;
+  MPI_Win_allocate(0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &baseptr, &win);
+#else
   MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);
+#endif
   MPI_Win_get_group(win, &group);
   
   MPI_Win_post(group, 0, win);
diff --git a/test/mpi/rma/pscw_ordering.c b/test/mpi/rma/pscw_ordering.c
index 9cb1cee..caa15e6 100644
--- a/test/mpi/rma/pscw_ordering.c
+++ b/test/mpi/rma/pscw_ordering.c
@@ -59,13 +59,18 @@ int main(int argc, char **argv) {
 
     /* Create the window */
 
+#ifdef USE_WIN_ALLOCATE
+    MPI_Win_allocate(nproc*sizeof(int), sizeof(int), MPI_INFO_NULL,
+                     MPI_COMM_WORLD, &win_buf, &win);
+#else
     MPI_Alloc_mem(nproc*sizeof(int), MPI_INFO_NULL, &win_buf);
-
-    for (i = 0; i < nproc; i++)
-        win_buf[i] = -1;
-
     MPI_Win_create(win_buf, nproc*sizeof(int), sizeof(int), MPI_INFO_NULL,
                    MPI_COMM_WORLD, &win);
+#endif
+    MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+    for (i = 0; i < nproc; i++)
+        win_buf[i] = -1;
+    MPI_Win_unlock(rank, win);
 
     /* Perform PSCW communication: Odd/even matchup */
 
@@ -124,7 +129,9 @@ int main(int argc, char **argv) {
     }
 
     MPI_Win_free(&win);
+#ifndef USE_WIN_ALLOCATE
     MPI_Free_mem(win_buf);
+#endif
 
     MPI_Group_free(&world_group);
     MPI_Group_free(&odd_group);
diff --git a/test/mpi/rma/test2.c b/test/mpi/rma/test2.c
index f4399ea..527c2d6 100644
--- a/test/mpi/rma/test2.c
+++ b/test/mpi/rma/test2.c
@@ -15,7 +15,7 @@
 
 int main(int argc, char *argv[]) 
 { 
-    int rank, destrank, nprocs, A[SIZE2], B[SIZE2], i;
+    int rank, destrank, nprocs, A[SIZE2], i;
     MPI_Comm CommDeuce;
     MPI_Group comm_group, group;
     MPI_Win win;
@@ -37,8 +37,14 @@ int main(int argc, char *argv[])
         MPI_Comm_group(CommDeuce, &comm_group);
 
         if (rank == 0) {
+            int B[SIZE2];
             for (i=0; i<SIZE2; i++) A[i] = B[i] = i;
+#ifdef USE_WIN_ALLOCATE
+            char *base_ptr;
+            MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
             MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
             destrank = 1;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_start(group, 0, win);
@@ -56,8 +62,17 @@ int main(int argc, char *argv[])
                 }
         }
         else if (rank == 1) {
-            for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+            int *B;
+            MPI_Win_allocate(SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+            int B[SIZE2];
             MPI_Win_create(B, SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+            MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+            for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+            MPI_Win_unlock(rank, win);
+
             destrank = 0;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_post(group, 0, win);
diff --git a/test/mpi/rma/test2_am.c b/test/mpi/rma/test2_am.c
index 53780d5..1d9c7d0 100644
--- a/test/mpi/rma/test2_am.c
+++ b/test/mpi/rma/test2_am.c
@@ -42,17 +42,23 @@ int main(int argc, char *argv[])
             printf("Can't allocate memory in test program\n");
             MPI_Abort(MPI_COMM_WORLD, 1);
         }
-        i = MPI_Alloc_mem(SIZE2 * sizeof(int), MPI_INFO_NULL, &B);
-        if (i) {
-            printf("Can't allocate memory in test program\n");
-            MPI_Abort(MPI_COMM_WORLD, 1);
-        }
 
         MPI_Comm_group(CommDeuce, &comm_group);
 
         if (rank == 0) {
+            i = MPI_Alloc_mem(SIZE2 * sizeof(int), MPI_INFO_NULL, &B);
+            if (i) {
+                printf("Can't allocate memory in test program\n");
+                MPI_Abort(MPI_COMM_WORLD, 1);
+            }
+
             for (i=0; i<SIZE2; i++) A[i] = B[i] = i;
+#ifdef USE_WIN_ALLOCATE
+            char *base_ptr;
+            MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
             MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
             destrank = 1;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_start(group, 0, win);
@@ -68,10 +74,24 @@ int main(int argc, char *argv[])
                     SQUELCH( printf("Get Error: B[i] is %d, should be %d\n", B[i], (-4)*(i+SIZE1)); );
                     errs++;
                 }
+
+            MPI_Free_mem(B);
         }
         else if (rank == 1) {
-            for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+            MPI_Win_allocate(SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+            i = MPI_Alloc_mem(SIZE2 * sizeof(int), MPI_INFO_NULL, &B);
+            if (i) {
+                printf("Can't allocate memory in test program\n");
+                MPI_Abort(MPI_COMM_WORLD, 1);
+            }
             MPI_Win_create(B, SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+            MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+            for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+            MPI_Win_unlock(rank, win);
+
             destrank = 0;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_post(group, 0, win);
@@ -83,13 +103,15 @@ int main(int argc, char *argv[])
                     errs++;
                 }
             }
+#ifndef USE_WIN_ALLOCATE
+            MPI_Free_mem(B);
+#endif
         }
 
         MPI_Group_free(&group);
         MPI_Group_free(&comm_group);
         MPI_Win_free(&win);
         MPI_Free_mem(A);
-        MPI_Free_mem(B);
     }
 
     MPI_Comm_free(&CommDeuce);
diff --git a/test/mpi/rma/test3.c b/test/mpi/rma/test3.c
index 06dd53b..2a86c00 100644
--- a/test/mpi/rma/test3.c
+++ b/test/mpi/rma/test3.c
@@ -44,31 +44,51 @@ int main(int argc, char *argv[])
             printf("Can't allocate memory in test program\n");
             MPI_Abort(MPI_COMM_WORLD, 1);
         }
-        B = (int *) malloc(SIZE * sizeof(int));
-        if (!B) {
-            printf("Can't allocate memory in test program\n");
-            MPI_Abort(MPI_COMM_WORLD, 1);
-        }
 
         MPI_Comm_group(CommDeuce, &comm_group);
 
         if (rank == 0) {
+            B = (int *) malloc(SIZE * sizeof(int));
+            if (!B) {
+                printf("Can't allocate memory in test program\n");
+                MPI_Abort(MPI_COMM_WORLD, 1);
+            }
+
             for (i=0; i<SIZE; i++) {
                 A[i] = i;
                 B[i] = SIZE + i;
             }
+#ifdef USE_WIN_ALLOCATE
+            char *base_ptr;
+            MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
             MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
             destrank = 1;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_start(group, 0, win);
             MPI_Put(A, SIZE, MPI_INT, 1, 0, SIZE, MPI_INT, win);
             MPI_Win_complete(win);
             MPI_Send(B, SIZE, MPI_INT, 1, 100, MPI_COMM_WORLD);
+
+            free(B);
         }
 
         else if (rank == 1) {
-            for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+            MPI_Win_allocate(SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+            B = (int *) malloc(SIZE * sizeof(int));
+            if (!B) {
+                printf("Can't allocate memory in test program\n");
+                MPI_Abort(MPI_COMM_WORLD, 1);
+            }
             MPI_Win_create(B, SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+            MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+            for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+            MPI_Win_unlock(rank, win);
+
             destrank = 0;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_post(group, 0, win);
@@ -85,13 +105,15 @@ int main(int argc, char *argv[])
                     errs++;
                 }
             }
+#ifndef USE_WIN_ALLOCATE
+            free(B);
+#endif
         }
 
         MPI_Group_free(&group);
         MPI_Group_free(&comm_group);
         MPI_Win_free(&win);
         free(A);
-        free(B);
     }
     MPI_Comm_free(&CommDeuce);
     MTest_Finalize(errs);
diff --git a/test/mpi/rma/test3_am.c b/test/mpi/rma/test3_am.c
index dc10c31..029dfc6 100644
--- a/test/mpi/rma/test3_am.c
+++ b/test/mpi/rma/test3_am.c
@@ -45,30 +45,50 @@ int main(int argc, char *argv[])
             printf("Can't allocate memory in test program\n");
             MPI_Abort(MPI_COMM_WORLD, 1);
         }
-        i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &B);
-        if (i) {
-            printf("Can't allocate memory in test program\n");
-            MPI_Abort(MPI_COMM_WORLD, 1);
-        }
 
         MPI_Comm_group(CommDeuce, &comm_group);
 
         if (rank == 0) {
+            i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &B);
+            if (i) {
+                printf("Can't allocate memory in test program\n");
+                MPI_Abort(MPI_COMM_WORLD, 1);
+            }
+
             for (i=0; i<SIZE; i++) {
                 A[i] = i;
                 B[i] = SIZE + i;
             }
+#ifdef USE_WIN_ALLOCATE
+            char *base_ptr;
+            MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
             MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
             destrank = 1;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_start(group, 0, win);
             MPI_Put(A, SIZE, MPI_INT, 1, 0, SIZE, MPI_INT, win);
             MPI_Win_complete(win);
             MPI_Send(B, SIZE, MPI_INT, 1, 100, MPI_COMM_WORLD);
+
+            MPI_Free_mem(B);
         }
         else {  /* rank=1 */
-            for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+            MPI_Win_allocate(SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+            i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &B);
+            if (i) {
+                printf("Can't allocate memory in test program\n");
+                MPI_Abort(MPI_COMM_WORLD, 1);
+            }
             MPI_Win_create(B, SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+            MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+            for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+            MPI_Win_unlock(rank, win);
+
             destrank = 0;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_post(group, 0, win);
@@ -85,13 +105,16 @@ int main(int argc, char *argv[])
                     errs++;
                 }
             }
+
+#ifndef USE_WIN_ALLOCATE
+            MPI_Free_mem(B);
+#endif
         }
 
         MPI_Group_free(&group);
         MPI_Group_free(&comm_group);
         MPI_Win_free(&win);
         MPI_Free_mem(A);
-        MPI_Free_mem(B);
     }
     MPI_Comm_free(&CommDeuce);
     MTest_Finalize(errs);
diff --git a/test/mpi/rma/testlist.in b/test/mpi/rma/testlist.in
index 267e041..cd867c5 100644
--- a/test/mpi/rma/testlist.in
+++ b/test/mpi/rma/testlist.in
@@ -12,12 +12,15 @@ getgroup 4
 transpose1 2
 transpose2 2
 transpose3 2
+transpose3_shm 2
 transpose5 2
 transpose6 1
 transpose7 2
 test1 2
 test2 2
+test2_shm 2
 test3 2
+test3_shm 2
 test4 2
 test5 2
 lockcontention 3
@@ -29,10 +32,13 @@ transpose4 2
 fetchandadd 7
 fetchandadd_tree 7
 wintest 2
+wintest_shm 2
 contig_displ 1
 test1_am 2
 test2_am 2
+test2_am_shm 2
 test3_am 2
+test3_am_shm 2
 test4_am 2
 test5_am 2
 fetchandadd_am 7
@@ -40,6 +46,7 @@ fetchandadd_tree_am 7
 accfence2_am 4
 test1_dt 2 timeLimit=30
 nullpscw 7
+nullpscw_shm 7
 attrorderwin 1
 wincall 2
 baseattrwin 1
@@ -65,6 +72,7 @@ put_base 2
 put_bottom 2
 win_flavors 4 mpiversion=3.0
 manyrma2 2 timeLimit=500
+manyrma2_shm 2 timeLimit=500
 manyrma3 2
 win_shared 4 mpiversion=3.0
 win_shared_noncontig 4 mpiversion=3.0
@@ -97,6 +105,7 @@ req_example_shm 4 mpiversion=3.0
 win_info 4 mpiversion=3.0
 linked_list_lockall 4 mpiversion=3.0
 pscw_ordering 4 mpiversion=3.0
+pscw_ordering_shm 4 mpiversion=3.0
 linked_list_bench_lock_all 4 mpiversion=3.0
 linked_list_bench_lock_excl 4 mpiversion=3.0
 linked_list_bench_lock_shr 4 mpiversion=3.0
diff --git a/test/mpi/rma/transpose3.c b/test/mpi/rma/transpose3.c
index 86ef3d5..e08ee80 100644
--- a/test/mpi/rma/transpose3.c
+++ b/test/mpi/rma/transpose3.c
@@ -17,7 +17,7 @@
 
 int main(int argc, char *argv[]) 
 { 
-    int rank, nprocs, A[NROWS][NCOLS], i, j, destrank;
+    int rank, nprocs, i, j, destrank;
     MPI_Comm CommDeuce;
     MPI_Win win;
     MPI_Datatype column, xpose;
@@ -41,6 +41,8 @@ int main(int argc, char *argv[])
 
         if (rank == 0)
         {
+            int A[NROWS][NCOLS];
+
             for (i=0; i<NROWS; i++)
                 for (j=0; j<NCOLS; j++)
                     A[i][j] = i*NCOLS + j;
@@ -51,7 +53,12 @@ int main(int argc, char *argv[])
             MPI_Type_hvector(NCOLS, 1, sizeof(int), column, &xpose);
             MPI_Type_commit(&xpose);
 
+#ifdef USE_WIN_ALLOCATE
+            int *base_ptr = NULL;
+            MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
             MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
 
             destrank = 1;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
@@ -66,10 +73,19 @@ int main(int argc, char *argv[])
         }
         else
         { /* rank=1 */
+            int *A;
+#ifdef USE_WIN_ALLOCATE
+            MPI_Win_allocate(NROWS*NCOLS*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &A, &win);
+#else
+            MPI_Alloc_mem(NROWS*NCOLS*sizeof(int), MPI_INFO_NULL, &A);
+            MPI_Win_create(A, NROWS*NCOLS*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+            MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
             for (i=0; i<NROWS; i++)
                 for (j=0; j<NCOLS; j++)
-                    A[i][j] = -1;
-            MPI_Win_create(A, NROWS*NCOLS*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+                    A[i*NCOLS+j] = -1;
+            MPI_Win_unlock(rank, win);
+
             destrank = 0;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_post(group, 0, win);
@@ -79,12 +95,12 @@ int main(int argc, char *argv[])
             {
                 for (i=0; i<NROWS; i++)
                 {
-                    if (A[j][i] != i*NCOLS + j)
+                    if (A[j*NROWS+i] != i*NCOLS + j)
                     {
                         if (errs < 50)
                         {
                             SQUELCH( printf("Error: A[%d][%d]=%d should be %d\n", j, i,
-                                            A[j][i], i*NCOLS + j); );
+                                            A[j*NROWS+i], i*NCOLS + j); );
                         }
                         errs++;
                     }
@@ -94,6 +110,9 @@ int main(int argc, char *argv[])
             {
                 printf("Total number of errors: %d\n", errs);
             }
+#ifndef USE_WIN_ALLOCATE
+            MPI_Free_mem(A);
+#endif
         }
 
         MPI_Group_free(&group);
diff --git a/test/mpi/rma/wintest.c b/test/mpi/rma/wintest.c
index a8a784c..7ac1401 100644
--- a/test/mpi/rma/wintest.c
+++ b/test/mpi/rma/wintest.c
@@ -15,7 +15,7 @@
 
 int main(int argc, char *argv[]) 
 { 
-    int rank, destrank, nprocs, A[SIZE2], B[SIZE2], i;
+    int rank, destrank, nprocs, A[SIZE2], i;
     MPI_Comm CommDeuce;
     MPI_Group comm_group, group;
     MPI_Win win;
@@ -36,8 +36,14 @@ int main(int argc, char *argv[])
         MPI_Comm_group(CommDeuce, &comm_group);
 
         if (rank == 0) {
+            int B[SIZE2];
             for (i=0; i<SIZE2; i++) A[i] = B[i] = i;
+#ifdef USE_WIN_ALLOCATE
+            int *base_ptr = NULL;
+            MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
             MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
             destrank = 1;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_start(group, 0, win);
@@ -55,8 +61,17 @@ int main(int argc, char *argv[])
                 }
         }
         else {  /* rank=1 */
-            for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+            int *B;
+            MPI_Win_allocate(SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+            int B[SIZE2];
             MPI_Win_create(B, SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+            MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+            for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+            MPI_Win_unlock(rank, win);
+
             destrank = 0;
             MPI_Group_incl(comm_group, 1, &destrank, &group);
             MPI_Win_post(group, 0, win);

http://git.mpich.org/mpich.git/commitdiff/96ca97960ab8adb63ded829670f28dd845c17e13

commit 96ca97960ab8adb63ded829670f28dd845c17e13
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Wed Sep 17 14:42:03 2014 -0500

    Bug-fix: skip synchronization in Win_start for MODE_NOCHECK.
    
    If MPI_MODE_NOCHECK is passed to MPI_Win_start, we should not
    wait for synchronization from targets.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c
index 4a5c69f..6b48ac3 100644
--- a/src/mpid/ch3/src/ch3u_rma_sync.c
+++ b/src/mpid/ch3/src/ch3u_rma_sync.c
@@ -2567,8 +2567,14 @@ int MPIDI_Win_start(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr)
     mpi_errno = fill_ranks_in_win_grp(win_ptr, ranks_in_win_grp);
     if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
-    mpi_errno = recv_post_msgs(win_ptr, ranks_in_win_grp, 1);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    /* If MPI_MODE_NOCHECK was not specified, we need to check if
+       Win_post was called on the target processes on SHM window.
+       Wait for a 0-byte sync message from each target process. */
+    if ((win_ptr->start_assert & MPI_MODE_NOCHECK) == 0)
+    {
+        mpi_errno = recv_post_msgs(win_ptr, ranks_in_win_grp, 1);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    }
 
     /* Ensure ordering of load/store operations */
     if (win_ptr->shm_allocated == TRUE) {

http://git.mpich.org/mpich.git/commitdiff/90096d60602d64efcdf440729aa0e104872ae18f

commit 90096d60602d64efcdf440729aa0e104872ae18f
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Tue Sep 9 21:54:01 2014 -0500

    Bug-fix: avoid wrong synchronization in MPI_Win_complete.
    
    recv_post_msgs function on origin process is used to wait
    for synchronization from target processes, and it can be
    called from MPI_Win_start (for targets on SHM) and
    MPI_Win_complete (for targets not on SHM). Here we fix the
    bug so that origin will not wait for SHM targets again in
    MPI_Win_complete.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c
index 97ab0c8..4a5c69f 100644
--- a/src/mpid/ch3/src/ch3u_rma_sync.c
+++ b/src/mpid/ch3/src/ch3u_rma_sync.c
@@ -2391,6 +2391,7 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
     MPI_Request *req;
     MPI_Status *status;
     MPID_Comm *comm_ptr = win_ptr->comm_ptr;
+    MPIDI_VC_t *orig_vc = NULL, *target_vc = NULL;
     MPIU_CHKLMEM_DECL(2);
     MPIDI_STATE_DECL(MPID_STATE_RECV_POST_MSGS);
 
@@ -2415,7 +2416,6 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
 
         if (local && win_ptr->shm_allocated == TRUE) {
             MPID_Request *req_ptr;
-            MPIDI_VC_t *orig_vc = NULL, *target_vc = NULL;
 
             MPIDI_Comm_get_vc(win_ptr->comm_ptr, rank, &orig_vc);
             MPIDI_Comm_get_vc(win_ptr->comm_ptr, src, &target_vc);
@@ -2430,10 +2430,16 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
         else if (!local) {
             MPID_Request *req_ptr;
 
-            mpi_errno = MPID_Irecv(NULL, 0, MPI_INT, src, SYNC_POST_TAG,
-                                   comm_ptr, MPID_CONTEXT_INTRA_PT2PT, &req_ptr);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-            req[j++] = req_ptr->handle;
+            MPIDI_Comm_get_vc(win_ptr->comm_ptr, rank, &orig_vc);
+            MPIDI_Comm_get_vc(win_ptr->comm_ptr, src, &target_vc);
+
+            if (win_ptr->shm_allocated != TRUE ||
+                orig_vc->node_id != target_vc->node_id) {
+                mpi_errno = MPID_Irecv(NULL, 0, MPI_INT, src, SYNC_POST_TAG,
+                                       comm_ptr, MPID_CONTEXT_INTRA_PT2PT, &req_ptr);
+                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                req[j++] = req_ptr->handle;
+            }
         }
     }
 
@@ -2442,7 +2448,7 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
         if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIU_ERR_POP(mpi_errno);
         /* --BEGIN ERROR HANDLING-- */
         if (mpi_errno == MPI_ERR_IN_STATUS) {
-            for (i = 0; i < start_grp_size; i++) {
+            for (i = 0; i < j; i++) {
                 if (status[i].MPI_ERROR != MPI_SUCCESS) {
                     mpi_errno = status[i].MPI_ERROR;
                     MPIU_ERR_POP(mpi_errno);

-----------------------------------------------------------------------

Summary of changes:
 src/mpid/ch3/src/ch3u_rma_sync.c |   28 ++++++++++++++++++++--------
 test/mpi/rma/Makefile.am         |   29 +++++++++++++++++++++++++++++
 test/mpi/rma/manyrma2.c          |   13 +++++++++++++
 test/mpi/rma/nullpscw.c          |    5 +++++
 test/mpi/rma/pscw_ordering.c     |   15 +++++++++++----
 test/mpi/rma/test2.c             |   19 +++++++++++++++++--
 test/mpi/rma/test2_am.c          |   36 +++++++++++++++++++++++++++++-------
 test/mpi/rma/test3.c             |   36 +++++++++++++++++++++++++++++-------
 test/mpi/rma/test3_am.c          |   37 ++++++++++++++++++++++++++++++-------
 test/mpi/rma/testlist.in         |    9 +++++++++
 test/mpi/rma/transpose3.c        |   29 ++++++++++++++++++++++++-----
 test/mpi/rma/wintest.c           |   19 +++++++++++++++++--
 12 files changed, 233 insertions(+), 42 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list