X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f2df13795e01302813a6aef10825ec7e922ce530..HEAD:/teshsuite/smpi/mpich3-test/topo/topodup.c?ds=sidebyside diff --git a/teshsuite/smpi/mpich3-test/topo/topodup.c b/teshsuite/smpi/mpich3-test/topo/topodup.c index f1c5515ff1..c589edc87e 100644 --- a/teshsuite/smpi/mpich3-test/topo/topodup.c +++ b/teshsuite/smpi/mpich3-test/topo/topodup.c @@ -9,7 +9,7 @@ #include #include "mpitest.h" -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { int errs = 0, i, k; int dims[2], periods[2], wsize; @@ -18,112 +18,107 @@ int main( int argc, char *argv[] ) int *index, *edges, *outindex, *outedges; MPI_Comm comm1, comm2; - MTest_Init( &argc, &argv ); + MTest_Init(&argc, &argv); - MPI_Comm_size( MPI_COMM_WORLD, &wsize ); + MPI_Comm_size(MPI_COMM_WORLD, &wsize); - /* Create a cartesian topology, get its characteristics, then - dup it and check that the new communicator has the same properties */ + /* Create a cartesian topology, get its characteristics, then + * dup it and check that the new communicator has the same properties */ dims[0] = dims[1] = 0; - MPI_Dims_create( wsize, 2, dims ); + MPI_Dims_create(wsize, 2, dims); periods[0] = periods[1] = 0; - MPI_Cart_create( MPI_COMM_WORLD, 2, dims, periods, 0, &comm1 ); + MPI_Cart_create(MPI_COMM_WORLD, 2, dims, periods, 0, &comm1); - MPI_Comm_dup( comm1, &comm2 ); - MPI_Topo_test( comm2, &topo_type ); + MPI_Comm_dup(comm1, &comm2); + MPI_Topo_test(comm2, &topo_type); if (topo_type != MPI_CART) { - errs++; - printf( "Topo type of duped cart was not cart\n" ); + errs++; + printf("Topo type of duped cart was not cart\n"); } else { - MPI_Cart_get( comm2, 2, outdims, outperiods, outcoords ); - for (i=0; i<2; i++) { - if (outdims[i] != dims[i]) { - errs++; - printf( "%d = outdims[%d] != dims[%d] = %d\n", outdims[i], - i, i, dims[i] ); - } - if (outperiods[i] != periods[i]) { - errs++; - printf( "%d = outperiods[%d] != periods[%d] = %d\n", - outperiods[i], i, i, periods[i] ); - } - } + MPI_Cart_get(comm2, 2, outdims, outperiods, outcoords); + for (i = 0; i < 2; i++) { + if (outdims[i] != dims[i]) { + errs++; + printf("%d = outdims[%d] != dims[%d] = %d\n", outdims[i], i, i, dims[i]); + } + if (outperiods[i] != periods[i]) { + errs++; + printf("%d = outperiods[%d] != periods[%d] = %d\n", + outperiods[i], i, i, periods[i]); + } + } } - MPI_Comm_free( &comm2 ); - MPI_Comm_free( &comm1 ); + MPI_Comm_free(&comm2); + MPI_Comm_free(&comm1); /* Now do the same with a graph topology */ if (wsize >= 3) { - index = (int*)malloc(wsize * sizeof(int) ); - edges = (int*)malloc(wsize * 2 * sizeof(int) ); - if (!index || !edges) { - printf( "Unable to allocate %d words for index or edges\n", - 3 * wsize ); - MPI_Abort( MPI_COMM_WORLD, 1 ); - } - index[0] = 2; - for (i=1; i