[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1-288-g7e44a0f

Service Account noreply at mpich.org
Sat May 31 06:50:29 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  7e44a0f14764b56823811ff8235ce802f5bdfae6 (commit)
       via  05eeccb59d7a0db0278e533b7b82cc059c514906 (commit)
      from  6063f89812b3b1b718abffa1b0c895cd5a19754c (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/7e44a0f14764b56823811ff8235ce802f5bdfae6

commit 7e44a0f14764b56823811ff8235ce802f5bdfae6
Author: Huiwei Lu <huiweilu at mcs.anl.gov>
Date:   Wed Apr 30 23:10:57 2014 -0500

    Adds two tests to MPI_Comm_idup
    
    Two multi-threaded tests are added for MPI_Comm_idup in
    test/mpi/threads/comm: ctxidup.c and comm_idup.c. The former has passed
    the test but the latter still not (marked in testlist as xfail).
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/test/mpi/.gitignore b/test/mpi/.gitignore
index f3a1916..5966d8f 100644
--- a/test/mpi/.gitignore
+++ b/test/mpi/.gitignore
@@ -1031,7 +1031,9 @@
 /threads/comm/comm_create_group_threads
 /threads/comm/comm_create_threads
 /threads/comm/comm_dup_deadlock
+/threads/comm/comm_idup
 /threads/comm/ctxdup
+/threads/comm/ctxidup
 /threads/comm/dup_leak_test
 /threads/init/initth
 /threads/pt2pt/threads
diff --git a/test/mpi/threads/comm/Makefile.am b/test/mpi/threads/comm/Makefile.am
index 09e3fe8..0fb58ad 100644
--- a/test/mpi/threads/comm/Makefile.am
+++ b/test/mpi/threads/comm/Makefile.am
@@ -9,5 +9,5 @@ include $(top_srcdir)/threads/Makefile_threads.mtest
 
 EXTRA_DIST = testlist
 
-noinst_PROGRAMS = ctxdup dup_leak_test comm_dup_deadlock comm_create_threads comm_create_group_threads
+noinst_PROGRAMS = ctxdup dup_leak_test comm_dup_deadlock comm_create_threads comm_create_group_threads comm_idup ctxidup
 
diff --git a/test/mpi/threads/comm/comm_idup.c b/test/mpi/threads/comm/comm_idup.c
new file mode 100644
index 0000000..1a183ee
--- /dev/null
+++ b/test/mpi/threads/comm/comm_idup.c
@@ -0,0 +1,98 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2012 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include <stdio.h>
+#include <mpi.h>
+#include "mpitest.h"
+#include "mpithreadtest.h"
+
+#define NUM_THREADS 2
+#define NUM_ITER    1
+
+#define check(X_)       \
+    do {                \
+        if (!(X_)) {    \
+            printf("[%s:%d] -- Assertion failed: %s\n", __FILE__, __LINE__, #X_);\
+            MPI_Abort(MPI_COMM_WORLD, 1); \
+        }               \
+    } while (0)
+
+MPI_Comm               comms[NUM_THREADS];
+MTEST_THREAD_LOCK_TYPE comm_lock;
+int                    rank, size;
+int                    verbose = 0;
+
+MTEST_THREAD_RETURN_TYPE test_comm_dup(void *arg)
+{
+    int rank;
+    int i;
+    MPI_Request req;
+
+    MPI_Comm_rank(comms[*(int*)arg], &rank);
+
+    for (i = 0; i < NUM_ITER; i++) {
+        MPI_Comm    comm, self_dup;
+
+        if (*(int*)arg == rank) {
+            MTestSleep(1);
+        }
+
+        MTest_thread_lock(&comm_lock);
+        if (verbose) printf("%d: Thread %d - COMM_IDUP %d start\n", rank, *(int*)arg, i);
+        MPI_Comm_idup(MPI_COMM_SELF, &self_dup, &req);
+        MPI_Wait(&req, MPI_STATUS_IGNORE);
+        if (verbose) printf("\t%d: Thread %d - COMM_IDUP %d finish\n", rank, *(int*)arg, i);
+        MTest_thread_unlock(&comm_lock);
+        MPI_Comm_free(&self_dup);
+
+        if (verbose) printf("%d: Thread %d - comm_idup %d start\n", rank, *(int*)arg, i);
+        MPI_Comm_idup(comms[*(int*)arg], &comm, &req);
+        MPI_Wait(&req, MPI_STATUS_IGNORE);
+        MPI_Comm_free(&comm);
+        if (verbose) printf("\t%d: Thread %d - comm_idup %d finish\n", rank, *(int*)arg, i);
+    }
+
+    if (verbose) printf("%d: Thread %d - Done.\n", rank, *(int*)arg);
+    return (MTEST_THREAD_RETURN_TYPE)0;
+}
+
+
+int main(int argc, char **argv)
+{
+    int         thread_args[NUM_THREADS];
+    int         i, provided;
+
+    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
+
+    check(provided == MPI_THREAD_MULTIPLE);
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    MTest_thread_lock_create(&comm_lock);
+
+    for (i = 0; i < NUM_THREADS; i++) {
+        MPI_Comm_dup(MPI_COMM_WORLD, &comms[i]);
+    }
+
+    for (i = 0; i < NUM_THREADS; i++) {
+        thread_args[i] = i;
+        MTest_Start_thread( test_comm_dup, (void *)&thread_args[i] );
+    }
+
+    MTest_Join_threads();
+
+    for (i = 0; i < NUM_THREADS; i++) {
+        MPI_Comm_free(&comms[i]);
+    }
+
+    if (rank == 0)
+        printf(" No Errors\n");
+
+    MPI_Finalize();
+
+    return 0;
+}
diff --git a/test/mpi/threads/comm/ctxidup.c b/test/mpi/threads/comm/ctxidup.c
new file mode 100644
index 0000000..b13fd91
--- /dev/null
+++ b/test/mpi/threads/comm/ctxidup.c
@@ -0,0 +1,104 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2006 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "mpitest.h"
+#include "mpithreadtest.h"
+
+/*
+ * static char MTEST_Descrip[] = "Creating communications concurrently in different threads";
+ */
+
+MTEST_THREAD_RETURN_TYPE dup_thread(void *);
+
+MTEST_THREAD_RETURN_TYPE dup_thread(void *p)
+{
+    int rank;
+    int buffer[1];
+    MPI_Comm *comm2_ptr = (MPI_Comm *)p;
+    MPI_Comm comm3;
+    MPI_Request req;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+    if (rank & 0x1) {
+        /* If odd, wait for message */
+        MPI_Recv( buffer, 0, MPI_INT, rank, 0, MPI_COMM_WORLD,
+                MPI_STATUS_IGNORE );
+    }
+    MPI_Comm_idup( *comm2_ptr, &comm3, &req );
+    MPI_Wait(&req, MPI_STATUS_IGNORE);
+
+    MPI_Barrier( comm3 );
+    MPI_Recv( buffer, 0, MPI_INT, rank, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE );
+
+    MPI_Comm_free( &comm3 );
+    /* Tell the main thread that we're done */
+    MPI_Send( buffer, 0, MPI_INT, rank, 2, MPI_COMM_WORLD );
+
+    return (MTEST_THREAD_RETURN_TYPE)0;
+}
+
+int main( int argc, char *argv[] )
+{
+    int rank, size;
+    int provided;
+    int buffer[1];
+    MPI_Comm comm1, comm2, comm4;
+
+    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    /* Check that we're multi-threaded */
+    if (provided != MPI_THREAD_MULTIPLE) {
+        if (rank == 0) {
+            printf("MPI_Init_thread must return MPI_THREAD_MULTIPLE in order for this test to run.\n");
+            fflush(stdout);
+        }
+        MPI_Finalize();
+        return 1;
+    }
+
+    /* The test is this:
+       The main thread on ODD processors tells the other thread to start
+       a comm dup(on comm2), then starts a comm dup(on comm1) after a delay.
+       The main thread on even processors starts a comm dup(on comm1)
+
+       The second thread on ODD processors waits until it gets a message
+       (from the same process) before starting the comm dup on comm2.
+       */
+
+    /* Create two communicators */
+    MPI_Comm_dup( MPI_COMM_WORLD, &comm1 );
+    MPI_Comm_dup( MPI_COMM_WORLD, &comm2 );
+
+    /* Start a thread that will perform a dup comm2 */
+    MTest_Start_thread( dup_thread, (void *)&comm2 );
+
+    /* If we're odd, send to our new thread and then delay */
+    if (rank & 0x1) {
+        MPI_Ssend( buffer, 0, MPI_INT, rank, 0, MPI_COMM_WORLD );
+        MTestSleep(1);
+    }
+    MPI_Comm_dup( comm1, &comm4 );
+
+    /* Tell the threads to exit after we've created our new comm */
+    MPI_Barrier( comm4 );
+    MPI_Ssend( buffer, 0, MPI_INT, rank, 1, MPI_COMM_WORLD );
+    MPI_Recv( buffer, 0, MPI_INT, rank, 2, MPI_COMM_WORLD, MPI_STATUS_IGNORE );
+
+    MPI_Comm_free( &comm4 );
+    MPI_Comm_free( &comm1 );
+    MPI_Comm_free( &comm2 );
+
+    MTest_Finalize(0);
+    MPI_Finalize();
+    return 0;
+}
diff --git a/test/mpi/threads/comm/testlist b/test/mpi/threads/comm/testlist
index 866a3f1..6d94573 100644
--- a/test/mpi/threads/comm/testlist
+++ b/test/mpi/threads/comm/testlist
@@ -3,3 +3,5 @@ dup_leak_test 2
 comm_dup_deadlock 4
 comm_create_threads 4
 comm_create_group_threads 4
+comm_idup 4 mpiversion=3.0 xfail=ticket2069
+ctxidup 4

http://git.mpich.org/mpich.git/commitdiff/05eeccb59d7a0db0278e533b7b82cc059c514906

commit 05eeccb59d7a0db0278e533b7b82cc059c514906
Author: Huiwei Lu <huiweilu at mcs.anl.gov>
Date:   Tue Apr 1 23:01:01 2014 -0500

    Fixes MPI_Comm_idup
    
    This patch fixes two related tickets:
    1. MPI_Comm_idup in multithreaded environments
    2. MPI_Comm_idup fails to create multiple communicators
    Because these two tickets are tightly coupled, so they are fixed in this
    single patch.
    
    The original code did not consider the multithreaded case and did not
    use progress engine in correct order when saving a copy of global mask
    to local thread.
    
    Following changes were made to implement the MPI_Comm_idup correctly:
    
    1. It shares the same global flag 'mask_in_use' with other communicator
    functions to protect access to context_mask. And use CONTEXTID lock to
    protext critical sections.
    
    2. It uses the same algorithm as multithreaded MPI_Comm_dup
    (multi-threaded vertion of MPIR_Get_contextid_sparse_group) to allocate
    a context id, but in a nonblocking way. In the case of conflicts, the
    algorithm needs to retry the allocation process again. In the
    nonblocking algorithm, 1) new entries are inserted to the end of
    schedule to replace the 'while' loop in MPI_Comm_dup algorithm; 2) all
    arguments passed to sched_get_cid_nonblock are saved to gcn_state in
    order to be called in the future; 3) in sched_cb_gcn_allocate_cid, if
    the first try failed, it will insert sched_cb_gcn_copy_mask to the
    schedule again.
    
    3. There is a subtle difference between INTRACOMM and INTERCOMM when
    duplicating a communicator.  They needed to be treated differently in
    current algorithm. Specifically, 1) when calling sched_get_cid_nonblock,
    the parameters are different; 2) updating newcommp->recvcontext_id in
    MPIR_Get_intercomm_contextid_nonblock has been moved to
    sched_cb_gcn_bcast because this should happen after
    sched_cb_gcn_allocate_cid has succeed.
    
    Fixes #1935
    Fixes #1913
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpi/comm/commutil.c b/src/mpi/comm/commutil.c
index 1651fce..7d29e03 100644
--- a/src/mpi/comm/commutil.c
+++ b/src/mpi/comm/commutil.c
@@ -1222,57 +1222,166 @@ fn_fail:
 struct gcn_state {
     MPIR_Context_id_t *ctx0;
     MPIR_Context_id_t *ctx1;
+    int own_mask;
+    MPID_Comm *comm_ptr;
+    MPID_Comm *comm_ptr_inter;
+    MPID_Sched_t s;
+    MPID_Comm_kind_t gcn_cid_kind;
     uint32_t local_mask[MPIR_MAX_CONTEXT_MASK];
 };
 
+static int sched_cb_gcn_copy_mask(MPID_Comm *comm, int tag, void *state);
+static int sched_cb_gcn_allocate_cid(MPID_Comm *comm, int tag, void *state);
+static int sched_cb_gcn_bcast(MPID_Comm *comm, int tag, void *state);
+
+#undef FUNCNAME
+#define FUNCNAME sched_cb_gcn_bcast
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+static int sched_cb_gcn_bcast(MPID_Comm *comm, int tag, void *state)
+{
+    int mpi_errno = MPI_SUCCESS;
+    struct gcn_state *st = state;
+
+    if (st->gcn_cid_kind == MPID_INTERCOMM) {
+        if (st->comm_ptr_inter->rank == 0) {
+            mpi_errno = MPID_Sched_recv(st->ctx1, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, st->comm_ptr_inter, st->s);
+            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            mpi_errno = MPID_Sched_send(st->ctx0, 1, MPIR_CONTEXT_ID_T_DATATYPE, 0, st->comm_ptr_inter, st->s);
+            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            MPID_SCHED_BARRIER(st->s);
+        }
+
+        mpi_errno = st->comm_ptr->coll_fns->Ibcast_sched(st->ctx1, 1,
+                MPIR_CONTEXT_ID_T_DATATYPE, 0, st->comm_ptr, st->s);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        MPID_SCHED_BARRIER(st->s);
+    }
+
+    mpi_errno = MPID_Sched_cb(&MPIR_Sched_cb_free_buf, st, st->s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+fn_fail:
+    return mpi_errno;
+}
+
 #undef FUNCNAME
-#define FUNCNAME gcn_helper
+#define FUNCNAME sched_cb_gcn_allocate_cid
 #undef FCNAME
 #define FCNAME MPIU_QUOTE(FUNCNAME)
-static int gcn_helper(MPID_Comm *comm, int tag, void *state)
+static int sched_cb_gcn_allocate_cid(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);
+    MPIU_THREAD_CS_ENTER(CONTEXTID,);
+    if (st->own_mask) {
+        newctxid = MPIR_Find_and_allocate_context_id(st->local_mask);
+
+        if (st->ctx0)
+            *st->ctx0 = newctxid;
+        if (st->ctx1)
+            *st->ctx1 = newctxid;
+        mask_in_use = 0;
+
+        if (newctxid > 0) {
+            if (lowestContextId == st->comm_ptr->context_id)
+                lowestContextId = MPIR_MAXID;
+        }
+    }
+    MPIU_THREAD_CS_EXIT(CONTEXTID,);
+
+    if (*st->ctx0 == 0) {
+        /* do not own mask, try again */
+        mpi_errno = MPID_Sched_cb(&sched_cb_gcn_copy_mask, st, st->s);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        MPID_SCHED_BARRIER(st->s);
+    } else {
+        /* Successfully allocated a context id */
+        mpi_errno = MPID_Sched_cb(&sched_cb_gcn_bcast, st, st->s);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        MPID_SCHED_BARRIER(st->s);
+    }
+
+    /* --BEGIN ERROR HANDLING-- */
+    /* --END ERROR HANDLING-- */
+fn_fail:
+    return mpi_errno;
+}
+
+#undef FUNCNAME
+#define FUNCNAME sched_cb_gcn_copy_mask
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+static int sched_cb_gcn_copy_mask(MPID_Comm *comm, int tag, void *state)
+{
+    int mpi_errno = MPI_SUCCESS;
+    struct gcn_state *st = state;
+
+    MPIU_THREAD_CS_ENTER(CONTEXTID,);
+    if (st->comm_ptr->context_id < lowestContextId) {
+        lowestContextId = st->comm_ptr->context_id;
+    }
+    if (mask_in_use || (st->comm_ptr->context_id != lowestContextId)) {
+        memset(st->local_mask, 0, MPIR_MAX_CONTEXT_MASK * sizeof(int));
+        st->own_mask = 0;
+    } else {
+        MPIU_Memcpy(st->local_mask, context_mask, MPIR_MAX_CONTEXT_MASK * sizeof(uint32_t));
+        mask_in_use = 1;
+        st->own_mask = 1;
     }
+    MPIU_THREAD_CS_ENTER(CONTEXTID,);
 
-    if (st->ctx0)
-        *st->ctx0 = newctxid;
-    if (st->ctx1)
-        *st->ctx1 = newctxid;
+    mpi_errno = st->comm_ptr->coll_fns->Iallreduce_sched(MPI_IN_PLACE, st->local_mask, MPIR_MAX_CONTEXT_MASK,
+                                               MPI_UINT32_T, MPI_BAND, st->comm_ptr, st->s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    MPID_SCHED_BARRIER(st->s);
+
+    mpi_errno = MPID_Sched_cb(&sched_cb_gcn_allocate_cid, st, st->s);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    MPID_SCHED_BARRIER(st->s);
 
 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 only works for single-threaded code, it will totally fail
- * for any multithreaded communicator creation */
+/** The multi-threaded nonblocking algorithm of getting a context id
+ *
+ * 1. It shares the same global flag 'mask_in_use' with other communicator
+ * functions to protect access to context_mask. And use CONTEXTID lock to
+ * protext critical sections.
+ *
+ * 2. It uses the same algorithm as multithreaded MPI_Comm_dup (multi-threaded
+ * vertion of MPIR_Get_contextid_sparse_group) to allocate a context id, but in
+ * a nonblocking way. In the case of conflicts, the algorithm needs to retry
+ * the allocation process again. In the nonblocking algorithm, 1) new entries
+ * are inserted to the end of schedule to replace the 'while' loop in
+ * MPI_Comm_dup algorithm; 2) all arguments passed to sched_get_cid_nonblock
+ * are saved to gcn_state in order to be called in the future; 3) in
+ * sched_cb_gcn_allocate_cid, if the first try failed, it will insert
+ * sched_cb_gcn_copy_mask to the schedule again.
+ *
+ * 3. There is a subtle difference between INTRACOMM and INTERCOMM when
+ * duplicating a communicator.  They needed to be treated differently in
+ * current algorithm. Specifically, 1) when calling sched_get_cid_nonblock, the
+ * parameters are different; 2) updating newcommp->recvcontext_id in
+ * MPIR_Get_intercomm_contextid_nonblock has been moved to sched_cb_gcn_bcast
+ * because this should happen after sched_cb_gcn_allocate_cid has succeed.
+ */
 #undef FUNCNAME
-#define FUNCNAME gcn_sch
+#define FUNCNAME sched_get_cid_nonblock
 #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)
+static int sched_get_cid_nonblock(MPID_Comm *comm_ptr, MPIR_Context_id_t *ctx0,
+        MPIR_Context_id_t *ctx1, MPID_Sched_t s, MPID_Comm_kind_t gcn_cid_kind)
 {
     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 */
+    MPIU_THREAD_CS_ENTER(CONTEXTID,);
     if (initialize_context_mask) {
         MPIR_Init_contextid();
     }
@@ -1280,22 +1389,22 @@ static int gcn_sch(MPID_Comm *comm_ptr, MPIR_Context_id_t *ctx0, MPIR_Context_id
     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);
+    if (gcn_cid_kind == MPID_INTRACOMM) {
+        st->comm_ptr = comm_ptr;
+        st->comm_ptr_inter = NULL;
+    } else {
+        st->comm_ptr = comm_ptr->local_comm;
+        st->comm_ptr_inter = comm_ptr;
+    }
+    st->s = s;
+    st->gcn_cid_kind = gcn_cid_kind;
+    *(st->ctx0) = 0;
+    MPIU_THREAD_CS_EXIT(CONTEXTID,);
 
-    mpi_errno = MPID_Sched_cb(&gcn_helper, st, s);
+    mpi_errno = MPID_Sched_cb(&sched_cb_gcn_copy_mask, 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;
@@ -1328,7 +1437,7 @@ int MPIR_Get_contextid_nonblock(MPID_Comm *comm_ptr, MPID_Comm *newcommp, MPID_R
     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);
+    mpi_errno = sched_get_cid_nonblock(comm_ptr, &newcommp->context_id, &newcommp->recvcontext_id, s, MPID_INTRACOMM);
     if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
     /* finally, kick off the schedule and give the caller a request */
@@ -1353,7 +1462,6 @@ int MPIR_Get_intercomm_contextid_nonblock(MPID_Comm *comm_ptr, MPID_Comm *newcom
     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);
@@ -1363,7 +1471,6 @@ int MPIR_Get_intercomm_contextid_nonblock(MPID_Comm *comm_ptr, MPID_Comm *newcom
         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);
@@ -1374,22 +1481,7 @@ int MPIR_Get_intercomm_contextid_nonblock(MPID_Comm *comm_ptr, MPID_Comm *newcom
     /* 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);
+    mpi_errno = sched_get_cid_nonblock(comm_ptr, &newcommp->recvcontext_id, &newcommp->context_id, s, MPID_INTERCOMM);
     if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
     /* finally, kick off the schedule and give the caller a request */
diff --git a/test/mpi/.gitignore b/test/mpi/.gitignore
index d4b846f..f3a1916 100644
--- a/test/mpi/.gitignore
+++ b/test/mpi/.gitignore
@@ -600,6 +600,7 @@
 /comm/comm_group_rand
 /comm/comm_idup
 /comm/comm_idup_mul
+/comm/comm_idup_overlap
 /comm/comm_info
 /comm/commcreate1
 /comm/ctxsplit
diff --git a/test/mpi/comm/testlist b/test/mpi/comm/testlist
index c5ed8d8..b3987af 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 xfail=ticket1935
-comm_idup_overlap 2 mpiversion=3.0 xfail=ticket1935
+comm_idup_mul 2 mpiversion=3.0
+comm_idup_overlap 2 mpiversion=3.0
 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                            |  202 ++++++++++++++------
 test/mpi/.gitignore                                |    3 +
 test/mpi/comm/testlist                             |    4 +-
 test/mpi/threads/comm/Makefile.am                  |    2 +-
 .../comm/{comm_dup_deadlock.c => comm_idup.c}      |   16 +-
 test/mpi/threads/comm/{ctxdup.c => ctxidup.c}      |   38 ++--
 test/mpi/threads/comm/testlist                     |    2 +
 7 files changed, 184 insertions(+), 83 deletions(-)
 copy test/mpi/threads/comm/{comm_dup_deadlock.c => comm_idup.c} (79%)
 copy test/mpi/threads/comm/{ctxdup.c => ctxidup.c} (77%)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list