[mpich-commits] r10689 - mpich2/trunk/test/mpi/comm
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Thu Nov 29 10:20:03 CST 2012
Author: balaji
Date: 2012-11-29 10:20:03 -0600 (Thu, 29 Nov 2012)
New Revision: 10689
Modified:
mpich2/trunk/test/mpi/comm/cmsplit_type.c
Log:
Updated the comm_split_type test to respect MPI_UNDEFINED.
Reviewed by goodell.
Modified: mpich2/trunk/test/mpi/comm/cmsplit_type.c
===================================================================
--- mpich2/trunk/test/mpi/comm/cmsplit_type.c 2012-11-29 16:20:02 UTC (rev 10688)
+++ mpich2/trunk/test/mpi/comm/cmsplit_type.c 2012-11-29 16:20:03 UTC (rev 10689)
@@ -24,16 +24,36 @@
verbose = 1;
MPI_Comm_rank( MPI_COMM_WORLD, &wrank );
+
+ /* Check to see if MPI_COMM_TYPE_SHARED works correctly */
MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &comm);
+ if (comm == MPI_COMM_NULL)
+ printf("Expected a non-null communicator, but got MPI_COMM_NULL\n");
+ else {
+ MPI_Comm_rank(comm, &rank);
+ MPI_Comm_size(comm, &size);
+ if (rank == 0 && verbose)
+ printf("Created subcommunicator of size %d\n", size);
+ MPI_Comm_free(&comm);
+ }
- MPI_Comm_rank(comm, &rank);
- MPI_Comm_size(comm, &size);
+ /* Check to see if MPI_UNDEFINED is respected */
+ MPI_Comm_split_type(MPI_COMM_WORLD, (wrank % 2 == 0) ? MPI_COMM_TYPE_SHARED : MPI_UNDEFINED,
+ 0, MPI_INFO_NULL, &comm);
+ if ((wrank % 2) && (comm != MPI_COMM_NULL))
+ printf("Expected MPI_COMM_NULL, but did not get one\n");
+ if (wrank % 2 == 0) {
+ if (comm == MPI_COMM_NULL)
+ printf("Expected a non-null communicator, but got MPI_COMM_NULL\n");
+ else {
+ MPI_Comm_rank(comm, &rank);
+ MPI_Comm_size(comm, &size);
+ if (rank == 0 && verbose)
+ printf("Created subcommunicator of size %d\n", size);
+ MPI_Comm_free(&comm);
+ }
+ }
- if (rank == 0 && verbose)
- printf("Created subcommunicator of size %d\n", size);
-
- MPI_Comm_free(&comm);
-
/* Use wrank because Comm_split_type may return more than one communicator
across the job, and if so, each will have a rank 0 entry. Test
output rules are for a single process to write the successful
More information about the commits
mailing list