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],
42 /* Try calling Dims_create with nothing to do (all dimensions
46 MPI_Dims_create( nnodes, 2, dims );
47 if (prodof(2, dims) != nnodes) {
49 printf( "Dims_create returned the wrong decomposition (all given). " );
50 printf( "Is [%d x %d], should be 1 x %d\n", dims[0], dims[1],
56 /* 4 dimensional tests */
57 for (nnodes=4; nnodes <= 32; nnodes = nnodes * 2) {
63 MPI_Dims_create( nnodes, 4, dims );
64 if (prodof(4, dims) != nnodes) {
66 printf( "Dims_create returned the wrong decomposition. " );
67 printf( "Is [%d x %d x %d x %d], should be 1 x %d x 1 x 2\n",
68 dims[0], dims[1], dims[2], dims[3],
72 /* Try calling Dims_create with nothing to do (all dimensions
78 MPI_Dims_create( nnodes, 4, dims );
79 if (prodof(4, dims) != nnodes) {
81 printf( "Dims_create returned the wrong decomposition (all given). " );
82 printf( "Is [%d x %d x %d x %d], should be 1 x %d x 1 x 2\n",
83 dims[0], dims[1], dims[2], dims[3],
89 MTest_Finalize( errs );