1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2003 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
10 int prodof(int, const int[]);
12 * Test edge cases of Dims_create
14 int prodof(int ndims, const int dims[])
17 for (i = 0; i < ndims; i++)
22 int main(int argc, char *argv[])
27 MTest_Init(&argc, &argv);
29 /* 2 dimensional tests */
30 for (nnodes = 1; nnodes <= 32; nnodes = nnodes * 2) {
34 MPI_Dims_create(nnodes, 2, dims);
35 if (prodof(2, dims) != nnodes) {
37 printf("Dims_create returned the wrong decomposition. ");
38 printf("Is [%d x %d], should be 1 x %d\n", dims[0], dims[1], nnodes);
41 /* Try calling Dims_create with nothing to do (all dimensions
45 MPI_Dims_create(nnodes, 2, dims);
46 if (prodof(2, dims) != nnodes) {
48 printf("Dims_create returned the wrong decomposition (all given). ");
49 printf("Is [%d x %d], should be 1 x %d\n", dims[0], dims[1], nnodes);
54 /* 4 dimensional tests */
55 for (nnodes = 4; nnodes <= 32; nnodes = nnodes * 2) {
61 MPI_Dims_create(nnodes, 4, dims);
62 if (prodof(4, dims) != nnodes) {
64 printf("Dims_create returned the wrong decomposition. ");
65 printf("Is [%d x %d x %d x %d], should be 1 x %d x 1 x 2\n",
66 dims[0], dims[1], dims[2], dims[3], nnodes / 2);
69 /* Try calling Dims_create with nothing to do (all dimensions
75 MPI_Dims_create(nnodes, 4, dims);
76 if (prodof(4, dims) != nnodes) {
78 printf("Dims_create returned the wrong decomposition (all given). ");
79 printf("Is [%d x %d x %d x %d], should be 1 x %d x 1 x 2\n",
80 dims[0], dims[1], dims[2], dims[3], nnodes / 2);