fixed a bug found in AMPI_Comm_split: when color is MPI_UNDEFINED, it supposed to...
authorGengbin Zheng <gzheng@illinois.edu>
Tue, 1 Feb 2011 18:33:49 +0000 (12:33 -0600)
committerGengbin Zheng <gzheng@illinois.edu>
Tue, 1 Feb 2011 18:33:49 +0000 (12:33 -0600)
src/libs/ck-libs/ampi/ampi.C

index a48452dc03b748487183f76d8d755cea0fb88e47..154b5f6e31fee66edaf1e61553b01365316733ff 100644 (file)
@@ -4734,8 +4734,11 @@ int AMPI_Comm_split(int src,int color,int key,int *dest)
 {
   AMPIAPI("AMPI_Comm_split");
 
-  getAmpiInstance(src)->split(color,key,dest, 0);
-  AMPI_Barrier(src);  // to prevent race condition in the new comm
+  if (color == MPI_UNDEFINED) *dest = MPI_COMM_NULL;
+  else {
+    getAmpiInstance(src)->split(color,key,dest, 0);
+    AMPI_Barrier(src);  // to prevent race condition in the new comm
+  }
 
 #if AMPIMSGLOG
   ampiParent* pptr = getAmpiParent();