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.
11 int main(int argc, char *argv[])
14 int size, dims[2], periods[2], remain[2];
16 MPI_Comm comm, newcomm;
18 MTest_Init(&argc, &argv);
20 /* First, create a 1-dim cartesian communicator */
22 MPI_Comm_size(MPI_COMM_WORLD, &size);
24 MPI_Cart_create(MPI_COMM_WORLD, 1, dims, periods, 0, &comm);
26 /* Now, extract a communicator with no dimensions */
28 MPI_Cart_sub(comm, remain, &newcomm);
30 MPI_Comm_rank(comm, &rank);
33 /* This should be congruent to MPI_COMM_SELF */
34 MPI_Comm_compare(MPI_COMM_SELF, newcomm, &result);
35 if (result != MPI_CONGRUENT) {
37 printf("cart sub to size 0 did not give self\n");
39 MPI_Comm_free(&newcomm);
41 else if (newcomm != MPI_COMM_NULL) {
43 printf("cart sub to size 0 did not give null\n");
46 /* Free the new communicator so that storage leak tests will