1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2011 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
7 /* USE_STRICT_MPI may be defined in mpitestconf.h */
8 #include "mpitestconf.h"
12 /* FIXME: This test only checks that the MPI_Comm_split_type routine
13 doesn't fail. It does not check for correct behavior */
15 int main(int argc, char *argv[])
17 int rank, size, verbose=0;
21 MPI_Init(&argc, &argv);
23 if (getenv("MPITEST_VERBOSE"))
26 MPI_Comm_rank( MPI_COMM_WORLD, &wrank );
28 /* Check to see if MPI_COMM_TYPE_SHARED works correctly */
29 MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &comm);
30 if (comm == MPI_COMM_NULL)
31 printf("Expected a non-null communicator, but got MPI_COMM_NULL\n");
33 MPI_Comm_rank(comm, &rank);
34 MPI_Comm_size(comm, &size);
35 if (rank == 0 && verbose)
36 printf("Created subcommunicator of size %d\n", size);
40 /* Check to see if MPI_UNDEFINED is respected */
41 MPI_Comm_split_type(MPI_COMM_WORLD, (wrank % 2 == 0) ? MPI_COMM_TYPE_SHARED : MPI_UNDEFINED,
42 0, MPI_INFO_NULL, &comm);
43 if ((wrank % 2) && (comm != MPI_COMM_NULL))
44 printf("Expected MPI_COMM_NULL, but did not get one\n");
46 if (comm == MPI_COMM_NULL)
47 printf("Expected a non-null communicator, but got MPI_COMM_NULL\n");
49 MPI_Comm_rank(comm, &rank);
50 MPI_Comm_size(comm, &size);
51 if (rank == 0 && verbose)
52 printf("Created subcommunicator of size %d\n", size);
57 /* Use wrank because Comm_split_type may return more than one communicator
58 across the job, and if so, each will have a rank 0 entry. Test
59 output rules are for a single process to write the successful
60 test (No Errors) output. */
62 printf(" No errors\n");