1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
13 static char MTEST_Descrip[] = "Test comm split";
16 int main(int argc, char *argv[])
19 int rank, size, color, srank;
22 MTest_Init(&argc, &argv);
24 MPI_Comm_dup(MPI_COMM_WORLD, &comm);
26 MPI_Comm_rank(comm, &rank);
27 MPI_Comm_size(comm, &size);
30 fprintf(stderr, "This test requires at least four processes.");
31 MPI_Abort(MPI_COMM_WORLD, 1);
34 color = MPI_UNDEFINED;
37 MPI_Comm_split(comm, color, size - rank, &scomm);
40 /* Check that the ranks are ordered correctly */
41 MPI_Comm_rank(scomm, &srank);
42 if (srank != 1 - rank) {
45 MPI_Comm_free(&scomm);
48 if (scomm != MPI_COMM_NULL) {