[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1-297-g18de1db

Service Account noreply at mpich.org
Tue Jun 3 13:35:10 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  18de1dbea921fefcb5d99fffb555e7c8f0a727c4 (commit)
      from  99c231bbacd9305e8060c72c0f7116e94fa2e081 (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/18de1dbea921fefcb5d99fffb555e7c8f0a727c4

commit 18de1dbea921fefcb5d99fffb555e7c8f0a727c4
Author: Huiwei Lu <huiweilu at mcs.anl.gov>
Date:   Tue Jun 3 11:28:29 2014 -0500

    Fixes building MPI_Comm_idup for single-thread case
    
    The patch 05eeccb5 causes failure in building with
    '--enable-threads=single'.  It fixes the MPI_Comm_idup multi-threaded
    case but messes up with the single-threaded case.  This commit reverts
    back to the old code before 05eeccb5 for the single-threaded case and
    keeps the fix for multi-threaded case.
    
    Note that the old code is still not correct for multiple communicators.
    See #1935.
    
    Signed-off-by: Antonio J. Pena <apenya at mcs.anl.gov>

diff --git a/src/mpi/comm/commutil.c b/src/mpi/comm/commutil.c
index 7d29e03..8f814f3 100644
--- a/src/mpi/comm/commutil.c
+++ b/src/mpi/comm/commutil.c
@@ -917,6 +917,191 @@ fn_fail:
     goto fn_exit;
 }
 
+struct gcn_state {
+    MPIR_Context_id_t *ctx0;
+    MPIR_Context_id_t *ctx1;
+    uint32_t local_mask[MPIR_MAX_CONTEXT_MASK];
+};
+
+#undef FUNCNAME
+#define FUNCNAME gcn_helper
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+static int gcn_helper(MPID_Comm *comm, int tag, void *state)
+{
+    int mpi_errno = MPI_SUCCESS;
+    struct gcn_state *st = state;
+    MPIR_Context_id_t newctxid;
+
+    newctxid = MPIR_Find_and_allocate_context_id(st->local_mask);
+    if (!newctxid) {
+        int nfree = -1;
+        int ntotal = -1;
+        MPIR_ContextMaskStats(&nfree, &ntotal);
+        MPIU_ERR_SETANDJUMP3(mpi_errno, MPI_ERR_OTHER,
+                             "**toomanycomm", "**toomanycomm %d %d %d",
+                             nfree, ntotal, /*ignore_id=*/0);
+    }
+
+    if (st->ctx0)
+        *st->ctx0 = newctxid;
+    if (st->ctx1)
+        *st->ctx1 = newctxid;
+
+fn_fail:
+    return mpi_errno;
+}
+
+
+/* Does the meat of the algorithm, adds the relevant entries to the schedule.
+ * Assigns the resulting value to *ctx0 and *ctx1, as long as those respective
+ * pointers are non-NULL. */
+/* FIXME: this version is the single-threaded code. It fails the case when
+ * multiple communicators are created using comm_idup (see ticket-1935).
+ * The multi-threaded version has already fixed the bug, but we also need to
+ * fix the single-threaded case.
+ */
+#undef FUNCNAME
+#define FUNCNAME gcn_sch
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+static int gcn_sch(MPID_Comm *comm_ptr, MPIR_Context_id_t *ctx0, MPIR_Context_id_t *ctx1, MPID_Sched_t s)
+{
+    int mpi_errno = MPI_SUCCESS;
+    struct gcn_state *st = NULL;
+    MPIU_CHKPMEM_DECL(1);
+
+    MPIU_Assert(comm_ptr->comm_kind == MPID_INTRACOMM);
+
+    /* first do as much local setup as we can */
+    if (initialize_context_mask) {
+        MPIR_Init_contextid();
+    }
+
+    MPIU_CHKPMEM_MALLOC(st, struct gcn_state *, sizeof(struct gcn_state), mpi_errno, "gcn_state");
+    st->ctx0 = ctx0;
+    st->ctx1 = ctx1;
+    MPIU_Memcpy(st->local_mask, context_mask, MPIR_MAX_CONTEXT_MASK * sizeof(uint32_t));
+
+    mpi_errno = comm_ptr->coll_fns->Iallreduce_sched(MPI_IN_PLACE, st->local_mask, MPIR_MAX_CONTEXT_MASK,
+                                               MPI_UINT32_T, MPI_BAND, comm_ptr, s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    MPID_SCHED_BARRIER(s);
+
+    mpi_errno = MPID_Sched_cb(&gcn_helper, st, s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    MPID_SCHED_BARRIER(s);
+
+    mpi_errno = MPID_Sched_cb(&MPIR_Sched_cb_free_buf, st, s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    MPIU_CHKPMEM_COMMIT();
+fn_exit:
+    return mpi_errno;
+    /* --BEGIN ERROR HANDLING-- */
+fn_fail:
+    MPIU_CHKPMEM_REAP();
+    goto fn_exit;
+    /* --END ERROR HANDLING-- */
+}
+
+
+#undef FUNCNAME
+#define FUNCNAME MPIR_Get_contextid_nonblock
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+int MPIR_Get_contextid_nonblock(MPID_Comm *comm_ptr, MPID_Comm *newcommp, MPID_Request **req)
+{
+    int mpi_errno = MPI_SUCCESS;
+    int tag;
+    MPID_Sched_t s;
+
+    MPID_MPI_STATE_DECL(MPID_STATE_MPIR_GET_CONTEXTID_NONBLOCK);
+
+    MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_GET_CONTEXTID_NONBLOCK);
+
+    /* now create a schedule */
+    mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    mpi_errno = MPID_Sched_create(&s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    /* add some entries to it */
+    mpi_errno = gcn_sch(comm_ptr, &newcommp->context_id, &newcommp->recvcontext_id, s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    /* finally, kick off the schedule and give the caller a request */
+    mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, req);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+fn_exit:
+    MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_GET_CONTEXTID_NONBLOCK);
+    return mpi_errno;
+    /* --BEGIN ERROR HANDLING-- */
+fn_fail:
+    goto fn_exit;
+    /* --END ERROR HANDLING-- */
+}
+
+#undef FUNCNAME
+#define FUNCNAME MPIR_Get_intercomm_contextid_nonblock
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+int MPIR_Get_intercomm_contextid_nonblock(MPID_Comm *comm_ptr, MPID_Comm *newcommp, MPID_Request **req)
+{
+    int mpi_errno = MPI_SUCCESS;
+    int tag;
+    MPID_Sched_t s;
+    MPID_Comm *lcomm = NULL;
+    MPID_MPI_STATE_DECL(MPID_STATE_MPIR_GET_INTERCOMM_CONTEXTID_NONBLOCK);
+
+    MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_GET_INTERCOMM_CONTEXTID_NONBLOCK);
+
+    /* do as much local setup as possible */
+    if (!comm_ptr->local_comm) {
+        mpi_errno = MPIR_Setup_intercomm_localcomm(comm_ptr);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    }
+    lcomm = comm_ptr->local_comm;
+
+    /* now create a schedule */
+    mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    mpi_errno = MPID_Sched_create(&s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    /* add some entries to it */
+
+    /* first get a context ID over the local comm */
+    mpi_errno = gcn_sch(lcomm, &newcommp->recvcontext_id, NULL, s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    MPID_SCHED_BARRIER(s);
+
+    if (comm_ptr->rank == 0) {
+        newcommp->recvcontext_id = -1;
+        mpi_errno = MPID_Sched_recv(&newcommp->context_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, comm_ptr, s);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        mpi_errno = MPID_Sched_send(&newcommp->recvcontext_id, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, comm_ptr, s);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        MPID_SCHED_BARRIER(s);
+    }
+
+    mpi_errno = lcomm->coll_fns->Ibcast_sched(&newcommp->context_id, 1,
+                                        MPIR_CONTEXT_ID_T_DATATYPE, 0, lcomm, s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    /* finally, kick off the schedule and give the caller a request */
+    mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, req);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+fn_fail:
+    MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_GET_INTERCOMM_CONTEXTID_NONBLOCK);
+    return mpi_errno;
+}
+
 #else /* MPICH_IS_THREADED is set and true */
 
 /* EAGER CONTEXT ID ALLOCATION: Attempt to allocate the context ID during the
@@ -1217,8 +1402,6 @@ fn_fail:
     /* --END ERROR HANDLING-- */
 }
 
-#endif
-
 struct gcn_state {
     MPIR_Context_id_t *ctx0;
     MPIR_Context_id_t *ctx1;
@@ -1415,7 +1598,6 @@ fn_fail:
     /* --END ERROR HANDLING-- */
 }
 
-
 #undef FUNCNAME
 #define FUNCNAME MPIR_Get_contextid_nonblock
 #undef FCNAME
@@ -1493,6 +1675,8 @@ fn_fail:
     return mpi_errno;
 }
 
+#endif
+
 
 /* Get a context for a new intercomm.  There are two approaches 
    here (for MPI-1 codes only)
diff --git a/test/mpi/comm/testlist b/test/mpi/comm/testlist
index b3987af..c5ed8d8 100644
--- a/test/mpi/comm/testlist
+++ b/test/mpi/comm/testlist
@@ -27,8 +27,8 @@ comm_group_rand 8 mpiversion=3.0
 comm_idup 2 mpiversion=3.0
 comm_idup 4 mpiversion=3.0
 comm_idup 9 mpiversion=3.0
-comm_idup_mul 2 mpiversion=3.0
-comm_idup_overlap 2 mpiversion=3.0
+comm_idup_mul 2 mpiversion=3.0 xfail=ticket1935
+comm_idup_overlap 2 mpiversion=3.0 xfail=ticket1935
 dup_with_info 2 mpiversion=3.0
 dup_with_info 4 mpiversion=3.0
 dup_with_info 9 mpiversion=3.0

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

Summary of changes:
 src/mpi/comm/commutil.c |  190 ++++++++++++++++++++++++++++++++++++++++++++++-
 test/mpi/comm/testlist  |    4 +-
 2 files changed, 189 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list