[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.0.2-62-g0b9da88

mysql vizuser noreply at mpich.org
Fri Mar 1 09:15:06 CST 2013


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  0b9da88e2e80be4a25bc9142b14bbdcf25ad7804 (commit)
       via  ab38c94853c55283bc6334a5c5bd6652f83a7e96 (commit)
       via  4611dedbefb197248718c4dd33669e77ec3cdceb (commit)
       via  9931e2a433f22ffb15b0fed721ae371f39537f90 (commit)
       via  a77f0eac2460e292b1417c087b86c1620a73c4bb (commit)
      from  f5be9cdbf563dd55fa935967903241038ed60fae (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/0b9da88e2e80be4a25bc9142b14bbdcf25ad7804

commit 0b9da88e2e80be4a25bc9142b14bbdcf25ad7804
Author: James Dinan <dinan at mcs.anl.gov>
Date:   Thu Feb 28 15:32:56 2013 -0600

    Test handling of 0-byte RMA xfers
    
    Added a new test to check that 0-byte transfers are handled correctly.
    
    Reviewer: goodell

diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am
index eb5b8d6..d919c83 100644
--- a/test/mpi/rma/Makefile.am
+++ b/test/mpi/rma/Makefile.am
@@ -66,6 +66,7 @@ noinst_PROGRAMS =          \
     baseattrwin            \
     nullpscw               \
     rmanull                \
+    rmazero                \
     mixedsync              \
     manyrma2		   \
     selfrma                \
diff --git a/test/mpi/rma/rmazero.c b/test/mpi/rma/rmazero.c
new file mode 100644
index 0000000..4792656
--- /dev/null
+++ b/test/mpi/rma/rmazero.c
@@ -0,0 +1,222 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2013 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "mpitest.h"
+
+#define TARGET 0
+
+/* Test the given operation within a Fence epoch */
+#define TEST_FENCE_OP(op_name_, fcn_call_)                              \
+    do {                                                                \
+        err = fcn_call_                                                 \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Zero-byte op " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Win_fence( 0, win );                                  \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Fence after " op_name_, err );     \
+            }                                                           \
+        }                                                               \
+    } while (0)
+
+
+/* Test the given operation within a passive target epoch */
+#define TEST_PT_OP(op_name_, fcn_call_)                                 \
+    do {                                                                \
+        err = MPI_Win_lock(MPI_LOCK_EXCLUSIVE, TARGET, 0, win);         \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Lock before" op_name_, err );      \
+            }                                                           \
+        }                                                               \
+        err = fcn_call_                                                 \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Zero-byte op " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Win_unlock( TARGET, win );                            \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Unlock after " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+    } while (0)
+
+
+/* Test the given request-based operation within a passive target epoch */
+#define TEST_REQ_OP(op_name_, req_, fcn_call_)                          \
+    do {                                                                \
+        err = MPI_Win_lock(MPI_LOCK_EXCLUSIVE, TARGET, 0, win);         \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Lock before" op_name_, err );      \
+            }                                                           \
+        }                                                               \
+        err = fcn_call_                                                 \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Zero-byte op " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Win_unlock( TARGET, win );                            \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Unlock after " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Wait( &req_, MPI_STATUS_IGNORE );                     \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Wait after " op_name_, err );      \
+            }                                                           \
+        }                                                               \
+    } while (0)
+
+/*
+static char MTEST_Descrip[] = "Test handling of zero-byte transfers";
+*/
+
+int main( int argc, char *argv[] )
+{
+    int           errs = 0, err;
+    int           rank, size;
+    int           *buf, bufsize;
+    int           *result;
+    int           *rmabuf, rsize, rcount;
+    MPI_Comm      comm;
+    MPI_Win       win;
+    MPI_Request   req;
+
+    MTest_Init( &argc, &argv );
+
+    bufsize = 256 * sizeof(int);
+    buf     = (int *)malloc( bufsize );
+    if (!buf) {
+        fprintf( stderr, "Unable to allocated %d bytes\n", bufsize );
+        MPI_Abort( MPI_COMM_WORLD, 1 );
+    }
+    result  = (int *)malloc( bufsize );
+    if (!result) {
+        fprintf( stderr, "Unable to allocated %d bytes\n", bufsize );
+        MPI_Abort( MPI_COMM_WORLD, 1 );
+    }
+    rcount   = 16;
+    rsize    = rcount * sizeof(int);
+    rmabuf   = (int *)malloc( rsize );
+    if (!rmabuf) {
+        fprintf( stderr, "Unable to allocated %d bytes\n", rsize );
+        MPI_Abort( MPI_COMM_WORLD, 1 );
+    }
+
+    /* The following illustrates the use of the routines to 
+       run through a selection of communicators and datatypes.
+       Use subsets of these for tests that do not involve combinations 
+       of communicators, datatypes, and counts of datatypes */
+    while (MTestGetIntracommGeneral( &comm, 1, 1 )) {
+        int count = 0;
+
+        if (comm == MPI_COMM_NULL) continue;
+        /* Determine the sender and receiver */
+        MPI_Comm_rank( comm, &rank );
+        MPI_Comm_size( comm, &size );
+
+        MPI_Win_create( buf, bufsize, sizeof(int), MPI_INFO_NULL, comm, &win );
+        /* To improve reporting of problems about operations, we
+           change the error handler to errors return */
+        MPI_Win_set_errhandler( win, MPI_ERRORS_RETURN );
+
+        /** TEST OPERATIONS USING ACTIVE TARGET (FENCE) SYNCHRONIZATION **/
+        MPI_Win_fence( 0, win );
+
+        TEST_FENCE_OP("Put",
+                      MPI_Put( rmabuf, count, MPI_INT, TARGET, 0,
+                               count, MPI_INT, win );
+                     );
+
+        TEST_FENCE_OP("Get",
+                      MPI_Get( rmabuf, count, MPI_INT, TARGET, 0,
+                               count, MPI_INT, win );
+                     );
+        TEST_FENCE_OP("Accumulate",
+                      MPI_Accumulate( rmabuf, count, MPI_INT, TARGET,
+                                      0, count, MPI_INT, MPI_SUM, win );
+                     );
+        TEST_FENCE_OP("Get accumulate",
+                      MPI_Get_accumulate( rmabuf, count, MPI_INT, result,
+                                          count, MPI_INT, TARGET, 0,
+                                          count, MPI_INT, MPI_SUM, win );
+                     );
+        /* Note: It's not possible to generate a zero-byte FOP or CAS */
+
+        /** TEST OPERATIONS USING PASSIVE TARGET SYNCHRONIZATION **/
+
+        TEST_PT_OP("Put",
+                   MPI_Put( rmabuf, count, MPI_INT, TARGET, 0, count,
+                            MPI_INT, win );
+                   );
+        TEST_PT_OP("Get",
+                   MPI_Get( rmabuf, count, MPI_INT, TARGET, 0, count,
+                            MPI_INT, win );
+                   );
+        TEST_PT_OP("Accumulate",
+                   MPI_Accumulate( rmabuf, count, MPI_INT, TARGET, 0,
+                                   count, MPI_INT, MPI_SUM, win );
+                   );
+        TEST_PT_OP("Get accumulate",
+                   MPI_Get_accumulate( rmabuf, count, MPI_INT, result, count,
+                                       MPI_INT, TARGET, 0, count,
+                                       MPI_INT, MPI_SUM, win );
+                   );
+
+        /* Note: It's not possible to generate a zero-byte FOP or CAS */
+
+        /** TEST REQUEST-BASED OPERATIONS (PASSIVE TARGET ONLY) **/
+
+        TEST_REQ_OP("Rput", req,
+                    MPI_Rput( rmabuf, count, MPI_INT, TARGET, 0, count,
+                              MPI_INT, win, &req );
+                   );
+        TEST_REQ_OP("Rget", req,
+                    MPI_Rget( rmabuf, count, MPI_INT, TARGET, 0, count,
+                              MPI_INT, win, &req );
+                   );
+        TEST_REQ_OP("Raccumulate", req,
+                    MPI_Raccumulate( rmabuf, count, MPI_INT, TARGET, 0,
+                                     count, MPI_INT, MPI_SUM, win, &req );
+                   );
+        TEST_REQ_OP("Rget_accumulate", req,
+                    MPI_Rget_accumulate( rmabuf, count, MPI_INT, result,
+                                         count, MPI_INT, TARGET, 0,
+                                         count, MPI_INT, MPI_SUM, win, &req );
+                   );
+
+        MPI_Win_free( &win );
+        MTestFreeComm(&comm);
+    }
+
+    free( result );
+    free( buf );
+    free( rmabuf );
+    MTest_Finalize( errs );
+    MPI_Finalize();
+    return 0;
+}
diff --git a/test/mpi/rma/testlist b/test/mpi/rma/testlist
index 772be24..4a479b2 100644
--- a/test/mpi/rma/testlist
+++ b/test/mpi/rma/testlist
@@ -49,6 +49,7 @@ mixedsync 4
 epochtest 4
 locknull 2
 rmanull 2
+rmazero 2
 strided_acc_indexed 2
 strided_acc_onelock 2
 strided_acc_subarray 2

http://git.mpich.org/mpich.git/commitdiff/ab38c94853c55283bc6334a5c5bd6652f83a7e96

commit ab38c94853c55283bc6334a5c5bd6652f83a7e96
Author: James Dinan <dinan at mcs.anl.gov>
Date:   Thu Feb 28 16:00:35 2013 -0600

    Fix handling of 0-byte xfers in req-gen ops
    
    Added a check for 0-byte transfers in request-generating operations.
    When a 0-byte transfer is encountered, the user is returned a completed
    handle and no communication is performed.
    
    Reviewer: goodell

diff --git a/src/mpid/ch3/src/ch3u_rma_reqops.c b/src/mpid/ch3/src/ch3u_rma_reqops.c
index b40f71e..09cf9d9 100644
--- a/src/mpid/ch3/src/ch3u_rma_reqops.c
+++ b/src/mpid/ch3/src/ch3u_rma_reqops.c
@@ -137,6 +137,10 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
                MPID_Request **request)
 {
     int mpi_errno = MPI_SUCCESS;
+    int dt_contig ATTRIBUTE((unused));
+    MPID_Datatype *dtp;
+    MPI_Aint dt_true_lb ATTRIBUTE((unused));
+    MPIDI_msg_sz_t data_sz;
     MPIDI_CH3I_Rma_req_state_t *req_state;
     MPIU_CHKPMEM_DECL(1);
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_RPUT);
@@ -155,8 +159,11 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
     req_state->win_ptr = win_ptr;
     req_state->target_rank = target_rank;
 
+    MPIDI_Datatype_get_info(origin_count, origin_datatype,
+                            dt_contig, data_sz, dtp, dt_true_lb);
+
     /* Enqueue or perform the RMA operation */
-    if (target_rank != MPI_PROC_NULL) {
+    if (target_rank != MPI_PROC_NULL && data_sz != 0) {
         mpi_errno = win_ptr->RMAFns.Put(origin_addr, origin_count,
                                         origin_datatype, target_rank,
                                         target_disp, target_count,
@@ -169,7 +176,7 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
      * Otherwise, generate a grequest. */
     /* FIXME: We still may need to flush or sync for shared memory windows */
     if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
-        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED)
+        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED || data_sz == 0)
     {
         mpi_errno = MPIR_Grequest_start_impl(MPIDI_CH3I_Rma_req_query,
                                              MPIDI_CH3I_Rma_req_free,
@@ -211,6 +218,10 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
                MPID_Request **request)
 {
     int mpi_errno = MPI_SUCCESS;
+    int dt_contig ATTRIBUTE((unused));
+    MPID_Datatype *dtp;
+    MPI_Aint dt_true_lb ATTRIBUTE((unused));
+    MPIDI_msg_sz_t data_sz;
     MPIDI_CH3I_Rma_req_state_t *req_state;
     MPIU_CHKPMEM_DECL(1);
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_RGET);
@@ -229,8 +240,11 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
     req_state->win_ptr = win_ptr;
     req_state->target_rank = target_rank;
 
+    MPIDI_Datatype_get_info(origin_count, origin_datatype,
+                            dt_contig, data_sz, dtp, dt_true_lb);
+
     /* Enqueue or perform the RMA operation */
-    if (target_rank != MPI_PROC_NULL) {
+    if (target_rank != MPI_PROC_NULL && data_sz != 0) {
         mpi_errno = win_ptr->RMAFns.Get(origin_addr, origin_count,
                                         origin_datatype, target_rank,
                                         target_disp, target_count,
@@ -243,7 +257,7 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
      * Otherwise, generate a grequest. */
     /* FIXME: We still may need to flush or sync for shared memory windows */
     if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
-        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED)
+        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED || data_sz == 0)
     {
         mpi_errno = MPIR_Grequest_start_impl(MPIDI_CH3I_Rma_req_query,
                                              MPIDI_CH3I_Rma_req_free,
@@ -285,6 +299,10 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
                       MPID_Request **request)
 {
     int mpi_errno = MPI_SUCCESS;
+    int dt_contig ATTRIBUTE((unused));
+    MPID_Datatype *dtp;
+    MPI_Aint dt_true_lb ATTRIBUTE((unused));
+    MPIDI_msg_sz_t data_sz;
     MPIDI_CH3I_Rma_req_state_t *req_state;
     MPIU_CHKPMEM_DECL(1);
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_RACCUMULATE);
@@ -303,8 +321,11 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
     req_state->win_ptr = win_ptr;
     req_state->target_rank = target_rank;
 
+    MPIDI_Datatype_get_info(origin_count, origin_datatype,
+                            dt_contig, data_sz, dtp, dt_true_lb);
+
     /* Enqueue or perform the RMA operation */
-    if (target_rank != MPI_PROC_NULL) {
+    if (target_rank != MPI_PROC_NULL && data_sz != 0) {
         mpi_errno = win_ptr->RMAFns.Accumulate(origin_addr, origin_count,
                                                origin_datatype, target_rank,
                                                target_disp, target_count,
@@ -316,7 +337,7 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
      * Otherwise, generate a grequest. */
     /* FIXME: We still may need to flush or sync for shared memory windows */
     if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
-        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED)
+        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED || data_sz == 0)
     {
         mpi_errno = MPIR_Grequest_start_impl(MPIDI_CH3I_Rma_req_query,
                                              MPIDI_CH3I_Rma_req_free,
@@ -359,6 +380,10 @@ int MPIDI_Rget_accumulate(const void *origin_addr, int origin_count,
                           MPID_Request **request)
 {
     int mpi_errno = MPI_SUCCESS;
+    int dt_contig ATTRIBUTE((unused));
+    MPID_Datatype *dtp;
+    MPI_Aint dt_true_lb ATTRIBUTE((unused));
+    MPIDI_msg_sz_t data_sz, trg_data_sz;
     MPIDI_CH3I_Rma_req_state_t *req_state;
     MPIU_CHKPMEM_DECL(1);
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_RGET_ACCUMULATE);
@@ -377,8 +402,14 @@ int MPIDI_Rget_accumulate(const void *origin_addr, int origin_count,
     req_state->win_ptr = win_ptr;
     req_state->target_rank = target_rank;
 
+    /* Note that GACC is only a no-op if no data goes in both directions */
+    MPIDI_Datatype_get_info(origin_count, origin_datatype,
+                            dt_contig, data_sz, dtp, dt_true_lb);
+    MPIDI_Datatype_get_info(origin_count, origin_datatype,
+                            dt_contig, trg_data_sz, dtp, dt_true_lb);
+
     /* Enqueue or perform the RMA operation */
-    if (target_rank != MPI_PROC_NULL) {
+    if (target_rank != MPI_PROC_NULL && (data_sz != 0 || trg_data_sz != 0)) {
         mpi_errno = win_ptr->RMAFns.Get_accumulate(origin_addr, origin_count,
                                                    origin_datatype, result_addr,
                                                    result_count, result_datatype,
@@ -392,7 +423,8 @@ int MPIDI_Rget_accumulate(const void *origin_addr, int origin_count,
      * Otherwise, generate a grequest. */
     /* FIXME: We still may need to flush or sync for shared memory windows */
     if (target_rank == MPI_PROC_NULL || target_rank == win_ptr->myrank ||
-        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED)
+        win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED ||
+        (data_sz == 0 && trg_data_sz == 0))
     {
         mpi_errno = MPIR_Grequest_start_impl(MPIDI_CH3I_Rma_req_query,
                                              MPIDI_CH3I_Rma_req_free,

http://git.mpich.org/mpich.git/commitdiff/4611dedbefb197248718c4dd33669e77ec3cdceb

commit 4611dedbefb197248718c4dd33669e77ec3cdceb
Author: James Dinan <dinan at mcs.anl.gov>
Date:   Thu Feb 28 11:28:29 2013 -0600

    Added new operations to RMA PROC_NULL test
    
    Extended the RMA PROC_NULL test to cover new operations and also to test
    passive target synchronization.
    
    Reviewer: goodell

diff --git a/test/mpi/rma/rmanull.c b/test/mpi/rma/rmanull.c
index ef8195a..cb228f3 100644
--- a/test/mpi/rma/rmanull.c
+++ b/test/mpi/rma/rmanull.c
@@ -9,6 +9,86 @@
 #include <stdlib.h>
 #include "mpitest.h"
 
+/* Test the given operation within a Fence epoch */
+#define TEST_FENCE_OP(op_name_, fcn_call_)                              \
+    do {                                                                \
+        err = fcn_call_                                                 \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "PROC_NULL to " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Win_fence( 0, win );                                  \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Fence after " op_name_, err );     \
+            }                                                           \
+        }                                                               \
+    } while (0)
+
+
+/* Test the given operation within a passive target epoch */
+#define TEST_PT_OP(op_name_, fcn_call_)                                 \
+    do {                                                                \
+        err = MPI_Win_lock(MPI_LOCK_EXCLUSIVE, MPI_PROC_NULL, 0, win);  \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Lock before" op_name_, err );      \
+            }                                                           \
+        }                                                               \
+        err = fcn_call_                                                 \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "PROC_NULL to " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Win_unlock( MPI_PROC_NULL, win );                     \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Unlock after " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+    } while (0)
+
+
+/* Test the given request-based operation within a passive target epoch */
+#define TEST_REQ_OP(op_name_, req_, fcn_call_)                          \
+    do {                                                                \
+        err = MPI_Win_lock(MPI_LOCK_EXCLUSIVE, MPI_PROC_NULL, 0, win);  \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Lock before" op_name_, err );      \
+            }                                                           \
+        }                                                               \
+        err = fcn_call_                                                 \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "PROC_NULL to " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Win_unlock( MPI_PROC_NULL, win );                     \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Unlock after " op_name_, err );    \
+            }                                                           \
+        }                                                               \
+        err = MPI_Wait( &req_, MPI_STATUS_IGNORE );                     \
+        if (err) {                                                      \
+            errs++;                                                     \
+            if (errs < 10) {                                            \
+                MTestPrintErrorMsg( "Wait after " op_name_, err );      \
+            }                                                           \
+        }                                                               \
+    } while (0)
+
 /*
 static char MTEST_Descrip[] = "Test the MPI_PROC_NULL is a valid target";
 */
@@ -18,9 +98,11 @@ int main( int argc, char *argv[] )
     int           errs = 0, err;
     int           rank, size;
     int           *buf, bufsize;
+    int           *result;
     int           *rmabuf, rsize, rcount;
     MPI_Comm      comm;
     MPI_Win       win;
+    MPI_Request   req;
 
     MTest_Init( &argc, &argv );
 
@@ -30,6 +112,11 @@ int main( int argc, char *argv[] )
 	fprintf( stderr, "Unable to allocated %d bytes\n", bufsize );
 	MPI_Abort( MPI_COMM_WORLD, 1 );
     }
+    result  = (int *)malloc( bufsize );
+    if (!result) {
+        fprintf( stderr, "Unable to allocated %d bytes\n", bufsize );
+        MPI_Abort( MPI_COMM_WORLD, 1 );
+    }
     rcount   = 16;
     rsize    = rcount * sizeof(int);
     rmabuf   = (int *)malloc( rsize );
@@ -49,63 +136,93 @@ int main( int argc, char *argv[] )
 	MPI_Comm_size( comm, &size );
 	
 	MPI_Win_create( buf, bufsize, sizeof(int), MPI_INFO_NULL, comm, &win );
-	MPI_Win_fence( 0, win );
 	/* To improve reporting of problems about operations, we
 	   change the error handler to errors return */
 	MPI_Win_set_errhandler( win, MPI_ERRORS_RETURN );
 
-	err = MPI_Put( rmabuf, rcount, MPI_INT, 
-		       MPI_PROC_NULL, 0, rcount, MPI_INT, win );
-	if (err) {
-	    errs++;
-	    if (errs < 10) {
-		MTestPrintErrorMsg( "PROC_NULL to Put", err );
-	    }
-	}
-	err = MPI_Win_fence( 0, win );
-	if (err) {
-	    errs++;
-	    if (errs < 10) {
-		MTestPrintErrorMsg( "Fence after Put", err );
-	    }
-	}
-
-	err = MPI_Get( rmabuf, rcount, MPI_INT, 
-		       MPI_PROC_NULL, 0, rcount, MPI_INT, win );
-	if (err) {
-	    errs++;
-	    if (errs < 10) {
-		MTestPrintErrorMsg( "PROC_NULL to Get", err );
-	    }
-	}
-	err = MPI_Win_fence( 0, win );
-	if (err) {
-	    errs++;
-	    if (errs < 10) {
-		MTestPrintErrorMsg( "Fence after Get", err );
-	    }
-	}
-
-	err = MPI_Accumulate( rmabuf, rcount, MPI_INT, 
-			      MPI_PROC_NULL, 0, rcount, MPI_INT, MPI_SUM, win );
-	if (err) {
-	    errs++;
-	    if (errs < 10) {
-		MTestPrintErrorMsg( "PROC_NULL to Accumulate", err );
-	    }
-	}
-	err = MPI_Win_fence( 0, win );
-	if (err) {
-	    errs++;
-	    if (errs < 10) {
-		MTestPrintErrorMsg( "Fence after Accumulate", err );
-	    }
-	}
+        /** TEST OPERATIONS USING ACTIVE TARGET (FENCE) SYNCHRONIZATION **/
+        MPI_Win_fence( 0, win );
+
+        TEST_FENCE_OP("Put",
+                      MPI_Put( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0,
+                               rcount, MPI_INT, win );
+                     );
+
+        TEST_FENCE_OP("Get",
+                      MPI_Get( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0,
+                               rcount, MPI_INT, win );
+                     );
+        TEST_FENCE_OP("Accumulate",
+                      MPI_Accumulate( rmabuf, rcount, MPI_INT, MPI_PROC_NULL,
+                                      0, rcount, MPI_INT, MPI_SUM, win );
+                     );
+        TEST_FENCE_OP("Get accumulate",
+                      MPI_Get_accumulate( rmabuf, rcount, MPI_INT, result,
+                                          rcount, MPI_INT, MPI_PROC_NULL, 0,
+                                          rcount, MPI_INT, MPI_SUM, win );
+                     );
+        TEST_FENCE_OP("Fetch and op",
+                      MPI_Fetch_and_op( rmabuf, result, MPI_INT, MPI_PROC_NULL,
+                                        0, MPI_SUM, win );
+                     );
+        TEST_FENCE_OP("Compare and swap",
+                      MPI_Compare_and_swap( rmabuf, &rank, result, MPI_INT,
+                                            MPI_PROC_NULL, 0, win );
+                     );
+
+        /** TEST OPERATIONS USING PASSIVE TARGET SYNCHRONIZATION **/
+
+        TEST_PT_OP("Put",
+                   MPI_Put( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0, rcount,
+                            MPI_INT, win );
+                   );
+        TEST_PT_OP("Get",
+                   MPI_Get( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0, rcount,
+                            MPI_INT, win );
+                   );
+        TEST_PT_OP("Accumulate",
+                   MPI_Accumulate( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0,
+                                   rcount, MPI_INT, MPI_SUM, win );
+                   );
+        TEST_PT_OP("Get accumulate",
+                   MPI_Get_accumulate( rmabuf, rcount, MPI_INT, result, rcount,
+                                       MPI_INT, MPI_PROC_NULL, 0, rcount,
+                                       MPI_INT, MPI_SUM, win );
+                   );
+        TEST_PT_OP("Fetch and op",
+                   MPI_Fetch_and_op( rmabuf, result, MPI_INT, MPI_PROC_NULL, 0,
+                                     MPI_SUM, win );
+                   );
+        TEST_PT_OP("Compare and swap",
+                   MPI_Compare_and_swap( rmabuf, &rank, result, MPI_INT,
+                                         MPI_PROC_NULL, 0, win );
+                   );
+
+        /** TEST REQUEST-BASED OPERATIONS (PASSIVE TARGET ONLY) **/
+
+        TEST_REQ_OP("Rput", req,
+                    MPI_Rput( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0, rcount,
+                              MPI_INT, win, &req );
+                   );
+        TEST_REQ_OP("Rget", req,
+                    MPI_Rget( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0, rcount,
+                              MPI_INT, win, &req );
+                   );
+        TEST_REQ_OP("Raccumulate", req,
+                    MPI_Raccumulate( rmabuf, rcount, MPI_INT, MPI_PROC_NULL, 0,
+                                     rcount, MPI_INT, MPI_SUM, win, &req );
+                   );
+        TEST_REQ_OP("Rget_accumulate", req,
+                    MPI_Rget_accumulate( rmabuf, rcount, MPI_INT, result,
+                                         rcount, MPI_INT, MPI_PROC_NULL, 0,
+                                         rcount, MPI_INT, MPI_SUM, win, &req );
+                   );
 
 	MPI_Win_free( &win );
         MTestFreeComm(&comm);
     }
 
+    free( result );
     free( buf );
     free( rmabuf );
     MTest_Finalize( errs );

http://git.mpich.org/mpich.git/commitdiff/9931e2a433f22ffb15b0fed721ae371f39537f90

commit 9931e2a433f22ffb15b0fed721ae371f39537f90
Author: James Dinan <dinan at mcs.anl.gov>
Date:   Thu Feb 28 13:10:58 2013 -0600

    Cleaned up handling of PROC_NULL in RMA ops
    
    Moved handling of MPI_PROC_NULL down to the device and cleaned up
    handling of PROC_NULL in the CH3 device.
    
    Reviewer: goodell

diff --git a/src/mpi/rma/accumulate.c b/src/mpi/rma/accumulate.c
index 573a751..8610e92 100644
--- a/src/mpi/rma/accumulate.c
+++ b/src/mpi/rma/accumulate.c
@@ -139,8 +139,6 @@ int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
 
     /* ... body of routine ...  */
     
-    if (target_rank == MPI_PROC_NULL) goto fn_exit;
-
     mpi_errno = MPIU_RMA_CALL(win_ptr,Accumulate(origin_addr, origin_count, 
 					 origin_datatype,
 					 target_rank, target_disp, target_count,
diff --git a/src/mpi/rma/compare_and_swap.c b/src/mpi/rma/compare_and_swap.c
index cf0ad51..04bf12e 100644
--- a/src/mpi/rma/compare_and_swap.c
+++ b/src/mpi/rma/compare_and_swap.c
@@ -128,8 +128,6 @@ int MPI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
 
     /* ... body of routine ...  */
     
-    if (target_rank == MPI_PROC_NULL) goto fn_exit;
-
     mpi_errno = MPIU_RMA_CALL(win_ptr,Compare_and_swap(origin_addr, 
                                          compare_addr, result_addr, 
                                          datatype, target_rank,
diff --git a/src/mpi/rma/fetch_and_op.c b/src/mpi/rma/fetch_and_op.c
index 9736133..634b327 100644
--- a/src/mpi/rma/fetch_and_op.c
+++ b/src/mpi/rma/fetch_and_op.c
@@ -142,8 +142,6 @@ int MPI_Fetch_and_op(const void *origin_addr, void *result_addr,
 
     /* ... body of routine ...  */
     
-    if (target_rank == MPI_PROC_NULL) goto fn_exit;
-
     mpi_errno = MPIU_RMA_CALL(win_ptr,Fetch_and_op(origin_addr, 
                                          result_addr, datatype,
                                          target_rank, target_disp,
diff --git a/src/mpi/rma/get.c b/src/mpi/rma/get.c
index afd49b5..0e0ca28 100644
--- a/src/mpi/rma/get.c
+++ b/src/mpi/rma/get.c
@@ -134,8 +134,6 @@ int MPI_Get(void *origin_addr, int origin_count, MPI_Datatype
 
     /* ... body of routine ...  */
     
-    if (target_rank == MPI_PROC_NULL) goto fn_exit;
-
     mpi_errno = MPIU_RMA_CALL(win_ptr,
 			      Get(origin_addr, origin_count, origin_datatype,
 				  target_rank, target_disp, target_count,
diff --git a/src/mpi/rma/get_accumulate.c b/src/mpi/rma/get_accumulate.c
index 7df2377..db8fb3f 100644
--- a/src/mpi/rma/get_accumulate.c
+++ b/src/mpi/rma/get_accumulate.c
@@ -187,8 +187,6 @@ int MPI_Get_accumulate(const void *origin_addr, int origin_count,
 
     /* ... body of routine ...  */
     
-    if (target_rank == MPI_PROC_NULL) goto fn_exit;
-
     mpi_errno = MPIU_RMA_CALL(win_ptr,Get_accumulate(origin_addr, origin_count, 
                                          origin_datatype,
                                          result_addr, result_count,
diff --git a/src/mpi/rma/put.c b/src/mpi/rma/put.c
index 8199b04..8bb1bd9 100644
--- a/src/mpi/rma/put.c
+++ b/src/mpi/rma/put.c
@@ -134,8 +134,6 @@ int MPI_Put(const void *origin_addr, int origin_count, MPI_Datatype
 
     /* ... body of routine ...  */
     
-    if (target_rank == MPI_PROC_NULL) goto fn_exit;
-
     mpi_errno = MPIU_RMA_CALL(win_ptr,
 			      Put(origin_addr, origin_count, origin_datatype,
 				  target_rank, target_disp, target_count,
diff --git a/src/mpid/ch3/src/ch3u_rma_ops.c b/src/mpid/ch3/src/ch3u_rma_ops.c
index d940a50..f2fc7ca 100644
--- a/src/mpid/ch3/src/ch3u_rma_ops.c
+++ b/src/mpid/ch3/src/ch3u_rma_ops.c
@@ -189,6 +189,10 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
         
     MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_PUT);
 
+    if (target_rank == MPI_PROC_NULL) {
+        goto fn_exit;
+    }
+
     if (win_ptr->epoch_state == MPIDI_EPOCH_NONE && win_ptr->fence_issued) {
         win_ptr->epoch_state = MPIDI_EPOCH_FENCE;
     }
@@ -199,8 +203,7 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
     MPIDI_Datatype_get_info(origin_count, origin_datatype,
 			    dt_contig, data_sz, dtp,dt_true_lb); 
     
-    if ((data_sz == 0) || (target_rank == MPI_PROC_NULL))
-    {
+    if (data_sz == 0) {
 	goto fn_exit;
     }
 
@@ -297,6 +300,10 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
         
     MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_GET);
 
+    if (target_rank == MPI_PROC_NULL) {
+        goto fn_exit;
+    }
+
     if (win_ptr->epoch_state == MPIDI_EPOCH_NONE && win_ptr->fence_issued) {
         win_ptr->epoch_state = MPIDI_EPOCH_FENCE;
     }
@@ -307,8 +314,7 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
     MPIDI_Datatype_get_info(origin_count, origin_datatype,
 			    dt_contig, data_sz, dtp, dt_true_lb); 
 
-    if ((data_sz == 0) || (target_rank == MPI_PROC_NULL))
-    {
+    if (data_sz == 0) {
 	goto fn_exit;
     }
 
@@ -404,6 +410,10 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
     
     MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_ACCUMULATE);
 
+    if (target_rank == MPI_PROC_NULL) {
+        goto fn_exit;
+    }
+
     if (win_ptr->epoch_state == MPIDI_EPOCH_NONE && win_ptr->fence_issued) {
         win_ptr->epoch_state = MPIDI_EPOCH_FENCE;
     }
@@ -414,8 +424,7 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
     MPIDI_Datatype_get_info(origin_count, origin_datatype,
 			    dt_contig, data_sz, dtp, dt_true_lb);  
     
-    if ((data_sz == 0) || (target_rank == MPI_PROC_NULL))
-    {
+    if (data_sz == 0) {
 	goto fn_exit;
     }
 

http://git.mpich.org/mpich.git/commitdiff/a77f0eac2460e292b1417c087b86c1620a73c4bb

commit a77f0eac2460e292b1417c087b86c1620a73c4bb
Author: James Dinan <dinan at mcs.anl.gov>
Date:   Thu Feb 28 12:54:38 2013 -0600

    Updated req-based ops to handle PROC_NULL
    
    Updated request-generating RMA operations to correctly handle
    communication with MPI_PROC_NULL.
    
    Reviewer: goodell

diff --git a/src/mpid/ch3/src/ch3u_rma_reqops.c b/src/mpid/ch3/src/ch3u_rma_reqops.c
index 822da94..b40f71e 100644
--- a/src/mpid/ch3/src/ch3u_rma_reqops.c
+++ b/src/mpid/ch3/src/ch3u_rma_reqops.c
@@ -144,7 +144,8 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_RPUT);
 
     MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
-                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL,
+                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
+                        target_rank != MPI_PROC_NULL,
                         mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
 
     MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,
@@ -217,7 +218,8 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_RGET);
 
     MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
-                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL,
+                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
+                        target_rank != MPI_PROC_NULL,
                         mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
 
     MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,
@@ -290,7 +292,8 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_RACCUMULATE);
 
     MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
-                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL,
+                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
+                        target_rank != MPI_PROC_NULL,
                         mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
 
     MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,
@@ -363,7 +366,8 @@ int MPIDI_Rget_accumulate(const void *origin_addr, int origin_count,
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_RGET_ACCUMULATE);
 
     MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
-                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL,
+                        win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
+                        target_rank != MPI_PROC_NULL,
                         mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
 
     MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,

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

Summary of changes:
 src/mpi/rma/accumulate.c           |    2 -
 src/mpi/rma/compare_and_swap.c     |    2 -
 src/mpi/rma/fetch_and_op.c         |    2 -
 src/mpi/rma/get.c                  |    2 -
 src/mpi/rma/get_accumulate.c       |    2 -
 src/mpi/rma/put.c                  |    2 -
 src/mpid/ch3/src/ch3u_rma_ops.c    |   21 +++-
 src/mpid/ch3/src/ch3u_rma_reqops.c |   60 ++++++++--
 test/mpi/rma/Makefile.am           |    1 +
 test/mpi/rma/rmanull.c             |  213 ++++++++++++++++++++++++++--------
 test/mpi/rma/rmazero.c             |  222 ++++++++++++++++++++++++++++++++++++
 test/mpi/rma/testlist              |    1 +
 12 files changed, 452 insertions(+), 78 deletions(-)
 create mode 100644 test/mpi/rma/rmazero.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list