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[])
16 int size, rank, newrank;
18 MTest_Init(&argc, &argv);
20 MPI_Comm_size(MPI_COMM_WORLD, &size);
21 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
23 /* This defines a one dimensional cartision grid with a single point */
27 MPI_Cart_map(MPI_COMM_WORLD, 1, dims, periods, &newrank);
29 if (newrank != MPI_UNDEFINED) {
31 printf("rank outside of input communicator not UNDEFINED\n");
35 if (rank != newrank) {
37 printf("Newrank not defined and should be 0\n");
42 /* As of MPI 2.1, a 0-dimensional topology is valid (its also a
44 MPI_Cart_map(MPI_COMM_WORLD, 0, dims, periods, &newrank);
46 if (newrank != MPI_UNDEFINED) {
48 printf("rank outside of input communicator not UNDEFINED\n");
53 if (rank != newrank) {
55 printf("Newrank not defined and should be 0\n");