[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.2-74-g43bbd02

Service Account noreply at mpich.org
Thu Aug 7 11:17: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  43bbd02bab428e1f6dab359ba77d49f5be9efd15 (commit)
      from  bfc09241bd576e70546de494a8df6ae67c4d21be (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/43bbd02bab428e1f6dab359ba77d49f5be9efd15

commit 43bbd02bab428e1f6dab359ba77d49f5be9efd15
Author: Min Si <msi at il.is.s.u-tokyo.ac.jp>
Date:   Tue Aug 5 05:53:43 2014 -0500

    Add a zero byte MPI_Win_allocate_shared test
    
    The first and the last rank allocate 16 bytes shared window, and the
    others allocate 0 byte window. Then write 1 to base_ptr of rank 0,
    check the value from base_ptr of the last rank. This test is used for
    checking overlapped segments of different processes in a shared window.
    
    Signed-off-by: Xin Zhao <xinzhao3 at illinois.edu>
    Signed-off-by: Antonio J. Pena <apenya at mcs.anl.gov>

diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am
index ecdd63f..40f3717 100644
--- a/test/mpi/rma/Makefile.am
+++ b/test/mpi/rma/Makefile.am
@@ -84,6 +84,7 @@ noinst_PROGRAMS =          \
     win_shared             \
     win_shared_noncontig   \
     win_shared_noncontig_put \
+    win_shared_zerobyte    \
     win_zero               \
     win_large_shm          \
     win_dynamic_acc        \
diff --git a/test/mpi/rma/testlist.in b/test/mpi/rma/testlist.in
index 04ddc4e..72606d2 100644
--- a/test/mpi/rma/testlist.in
+++ b/test/mpi/rma/testlist.in
@@ -108,6 +108,7 @@ rma-contig 2 mpiversion=3.0 timeLimit=600
 badrma 2 mpiversion=3.0
 acc-loc 4
 fence_shm 2 mpiversion=3.0
+win_shared_zerobyte 4 mpiversion=3.0
 
 ## This test is not strictly correct.  This was meant to test out the
 ## case when MPI_Test is not nonblocking.  However, we ended up
diff --git a/test/mpi/rma/win_shared_zerobyte.c b/test/mpi/rma/win_shared_zerobyte.c
new file mode 100644
index 0000000..1f602a7
--- /dev/null
+++ b/test/mpi/rma/win_shared_zerobyte.c
@@ -0,0 +1,106 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2014 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <mpi.h>
+#include "mpitest.h"
+
+const int verbose = 0;
+
+int main(int argc, char **argv)
+{
+    int i, j, rank, nproc;
+    int shm_rank, shm_nproc;
+    MPI_Aint size;
+    int errors = 0, all_errors = 0;
+    int **bases = NULL, *abs_base, *my_base;
+    int disp_unit;
+    MPI_Win shm_win;
+    MPI_Comm shm_comm;
+    int ELEM_PER_PROC = 0;
+
+    MPI_Init(&argc, &argv);
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &nproc);
+
+    MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, rank, MPI_INFO_NULL, &shm_comm);
+
+    MPI_Comm_rank(shm_comm, &shm_rank);
+    MPI_Comm_size(shm_comm, &shm_nproc);
+
+    bases = calloc(shm_nproc, sizeof(int *));
+
+    if (shm_rank == 0 || shm_rank == shm_nproc - 1) {
+        ELEM_PER_PROC = 16;
+    }
+
+    /* Allocate ELEM_PER_PROC integers for each process */
+    MPI_Win_allocate_shared(sizeof(int) * ELEM_PER_PROC, sizeof(int), MPI_INFO_NULL,
+                            shm_comm, &my_base, &shm_win);
+
+    /* Locate absolute base */
+    MPI_Win_shared_query(shm_win, MPI_PROC_NULL, &size, &disp_unit, &abs_base);
+
+    if (verbose)
+        printf("%d -- allocate shared: my_base = %p, absolute base\n", shm_rank, my_base, abs_base);
+
+    for (i = 0; i < shm_nproc; i++) {
+        MPI_Win_shared_query(shm_win, i, &size, &disp_unit, &bases[i]);
+        if (verbose)
+            printf("%d --    shared query: base[%d]=%p, size %ld, unit %d\n",
+                   shm_rank, i, bases[i], size, disp_unit);
+    }
+
+    MPI_Win_lock_all(MPI_MODE_NOCHECK, shm_win);
+
+    /* Reset data */
+    for (i = 0; i < ELEM_PER_PROC; i++) {
+        my_base[i] = 0;
+    }
+
+    MPI_Win_sync(shm_win);
+    MPI_Barrier(shm_comm);
+    MPI_Win_sync(shm_win);
+
+    /* Read and verify everyone's data */
+    if (shm_rank == 0) {
+        bases[0][0] = 1;
+    }
+
+    MPI_Win_sync(shm_win);
+    MPI_Barrier(shm_comm);
+    MPI_Win_sync(shm_win);
+
+    if (bases[0][0] != 1) {
+        errors++;
+        printf("%d -- Got %d at rank %d index %d, expected %d\n", shm_rank, bases[0][0], 0, 0, 1);
+    }
+
+    if (bases[shm_nproc - 1][0] != 0) {
+        errors++;
+        printf("%d -- Got %d at rank %d index %d, expected %d\n", shm_rank,
+               bases[shm_nproc - 1][0], shm_nproc - 1, 0, 0);
+    }
+
+    MPI_Win_unlock_all(shm_win);
+    MPI_Win_free(&shm_win);
+    MPI_Comm_free(&shm_comm);
+
+    MPI_Reduce(&errors, &all_errors, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
+
+    if (rank == 0 && all_errors == 0)
+        printf(" No Errors\n");
+
+    MPI_Finalize();
+
+    free(bases);
+
+    return 0;
+}

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

Summary of changes:
 test/mpi/rma/Makefile.am           |    1 +
 test/mpi/rma/testlist.in           |    1 +
 test/mpi/rma/win_shared_zerobyte.c |  106 ++++++++++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+), 0 deletions(-)
 create mode 100644 test/mpi/rma/win_shared_zerobyte.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list