[mpich-commits] r10686 - in mpich2/trunk/src: mpi/comm mpid/ch3/src

balaji at mcs.anl.gov balaji at mcs.anl.gov
Thu Nov 29 10:19:33 CST 2012


Author: balaji
Date: 2012-11-29 10:19:33 -0600 (Thu, 29 Nov 2012)
New Revision: 10686

Modified:
   mpich2/trunk/src/mpi/comm/comm_split_type.c
   mpich2/trunk/src/mpid/ch3/src/mpid_init.c
Log:
Added support for MPI_UNDEFINED in MPI_Comm_split_type. Fixes tt#1753.

Reviewed by goodell.

Modified: mpich2/trunk/src/mpi/comm/comm_split_type.c
===================================================================
--- mpich2/trunk/src/mpi/comm/comm_split_type.c	2012-11-28 19:56:15 UTC (rev 10685)
+++ mpich2/trunk/src/mpi/comm/comm_split_type.c	2012-11-29 16:19:33 UTC (rev 10686)
@@ -34,11 +34,16 @@
 {
     int mpi_errno = MPI_SUCCESS;
 
-    MPIU_Assert(split_type == MPI_COMM_TYPE_SHARED);
+    /* Only MPI_COMM_TYPE_SHARED and MPI_UNDEFINED are supported */
+    MPIU_Assert(split_type == MPI_COMM_TYPE_SHARED || split_type == MPI_UNDEFINED);
 
     if (MPID_Comm_fns == NULL || MPID_Comm_fns->split_type == NULL) {
-        /* Default implementation is to just return MPI_COMM_SELF */
-        mpi_errno = MPIR_Comm_split_impl(comm_ptr, comm_ptr->rank, key, newcomm_ptr);
+        int color = (split_type == MPI_COMM_TYPE_SHARED) ? comm_ptr->rank : MPI_UNDEFINED;
+
+        /* The default implementation is to either pass MPI_UNDEFINED
+         * or the local rank as the color (in which case a dup of
+         * MPI_COMM_SELF is returned) */
+        mpi_errno = MPIR_Comm_split_impl(comm_ptr, color, key, newcomm_ptr);
     }
     else {
         mpi_errno =

Modified: mpich2/trunk/src/mpid/ch3/src/mpid_init.c
===================================================================
--- mpich2/trunk/src/mpid/ch3/src/mpid_init.c	2012-11-28 19:56:15 UTC (rev 10685)
+++ mpich2/trunk/src/mpid/ch3/src/mpid_init.c	2012-11-29 16:19:33 UTC (rev 10686)
@@ -55,7 +55,7 @@
     mpi_errno = MPID_Get_node_id(comm_ptr, comm_ptr->rank, &id);
     if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
-    nid = id;
+    nid = (stype == MPI_COMM_TYPE_SHARED) ? id : MPI_UNDEFINED;
     mpi_errno = MPIR_Comm_split_impl(comm_ptr, nid, key, newcomm_ptr);
     if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 



More information about the commits mailing list