From f888b68a52740ad761cdd4fe614f251576b3697c Mon Sep 17 00:00:00 2001 From: degomme Date: Sat, 11 Feb 2017 21:15:28 +0100 Subject: [PATCH] Update group --- .../smpi/mpich3-test/group/CMakeLists.txt | 4 +- teshsuite/smpi/mpich3-test/group/glpid.c | 45 +++ .../smpi/mpich3-test/group/groupcreate.c | 106 +++--- .../smpi/mpich3-test/group/groupnullincl.c | 93 +++--- teshsuite/smpi/mpich3-test/group/grouptest.c | 313 +++++++++--------- teshsuite/smpi/mpich3-test/group/grouptest2.c | 235 ++++++------- teshsuite/smpi/mpich3-test/group/gtranks.c | 180 +++++----- .../smpi/mpich3-test/group/gtranksperf.c | 48 +-- 8 files changed, 533 insertions(+), 491 deletions(-) create mode 100644 teshsuite/smpi/mpich3-test/group/glpid.c diff --git a/teshsuite/smpi/mpich3-test/group/CMakeLists.txt b/teshsuite/smpi/mpich3-test/group/CMakeLists.txt index 4025562c4c..1da613ab62 100644 --- a/teshsuite/smpi/mpich3-test/group/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/group/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") - foreach(file groupcreate grouptest2 grouptest gtranks gtranksperf) #groupnullincl + foreach(file groupcreate grouptest2 grouptest gtranks gtranksperf) #groupnullincl glpid add_executable(${file} ${file}.c) target_link_libraries(${file} simgrid mtest_c) endforeach() @@ -20,7 +20,7 @@ if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS) SET_TESTS_PROPERTIES(test-smpi-mpich3-group-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") endif() -foreach(file groupcreate grouptest2 grouptest gtranks gtranksperf groupnullincl) +foreach(file groupcreate grouptest2 grouptest gtranks gtranksperf groupnullincl glpid) set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.c) endforeach() diff --git a/teshsuite/smpi/mpich3-test/group/glpid.c b/teshsuite/smpi/mpich3-test/group/glpid.c new file mode 100644 index 0000000000..d698af5f28 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/group/glpid.c @@ -0,0 +1,45 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include +#include "mpi.h" +#include "mpiimpl.h" + +int main(int argc, char *argv[]) +{ + MPIR_Group group, *group_ptr = &group; + int i; + + MPI_Init(&argc, &argv); + + /* Setup a sample group */ + group.handle = 1; + group.ref_count = 1; + group.size = 4; + group.rank = 0; + group.idx_of_first_lpid = -1; + group.lrank_to_lpid = (MPII_Group_pmap_t *) + MPL_malloc(group.size * sizeof(MPII_Group_pmap_t)); + for (i = 0; i < group.size; i++) { + group.lrank_to_lpid[i].lrank = i; + group.lrank_to_lpid[i].lpid = group.size - i - 1; + group.lrank_to_lpid[i].next_lpid = -1; + group.lrank_to_lpid[i].flag = 0; + } + + /* Set up the group lpid list */ + MPII_Group_setup_lpid_list(group_ptr); + + /* Print the group structure */ + printf("Index of first lpid = %d\n", group.idx_of_first_lpid); + for (i = 0; i < group.size; i++) { + printf("lrank_to_lpid[%d].next_lpid = %d, .lpid = %d\n", + i, group.lrank_to_lpid[i].next_lpid, group.lrank_to_lpid[i].lpid); + } + + MPI_Finalize(); + return 0; +} diff --git a/teshsuite/smpi/mpich3-test/group/groupcreate.c b/teshsuite/smpi/mpich3-test/group/groupcreate.c index c8952d84e1..8079f55ea8 100644 --- a/teshsuite/smpi/mpich3-test/group/groupcreate.c +++ b/teshsuite/smpi/mpich3-test/group/groupcreate.c @@ -8,79 +8,79 @@ /* stdlib.h Needed for malloc declaration */ #include -int main( int argc, char **argv ) +int main(int argc, char **argv) { int i, n, n_goal = 2048, n_all, rc, n_ranks, *ranks, rank, size, len; int group_size; MPI_Group *group_array, world_group; char msg[MPI_MAX_ERROR_STRING]; - MPI_Init( &argc, &argv ); - MPI_Comm_size( MPI_COMM_WORLD, &size ); - MPI_Comm_rank( MPI_COMM_WORLD, &rank ); + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); n = n_goal; - - group_array = (MPI_Group *)malloc( n * sizeof(MPI_Group) ); - MPI_Comm_group( MPI_COMM_WORLD, &world_group ); + group_array = (MPI_Group *) malloc(n * sizeof(MPI_Group)); + + MPI_Comm_group(MPI_COMM_WORLD, &world_group); n_ranks = size; - ranks = (int *)malloc( size * sizeof(int) ); - for (i=0; i #include "mpitest.h" -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { int errs = 0; int rc, result; @@ -16,57 +16,58 @@ int main( int argc, char *argv[] ) MPI_Group group, outgroup; MPI_Comm comm; - MTest_Init( &argc, &argv ); + MTest_Init(&argc, &argv); /* To improve reporting of problems about operations, we - change the error handler to errors return */ - MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_RETURN ); + * change the error handler to errors return */ + MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN); - while (MTestGetComm( &comm, 1 )) { - if (comm == MPI_COMM_NULL) continue; + while (MTestGetComm(&comm, 1)) { + if (comm == MPI_COMM_NULL) + continue; - MPI_Comm_group( comm, &group ); - rc = MPI_Group_incl( group, 0, 0, &outgroup ); - if (rc) { - errs++; - MTestPrintError( rc ); - printf( "Error in creating an empty group with (0,0)\n" ); - - /* Some MPI implementations may reject a null "ranks" pointer */ - rc = MPI_Group_incl( group, 0, ranks, &outgroup ); - if (rc) { - errs++; - MTestPrintError( rc ); - printf( "Error in creating an empty group with (0,ranks)\n" ); - } - } + MPI_Comm_group(comm, &group); + rc = MPI_Group_incl(group, 0, 0, &outgroup); + if (rc) { + errs++; + MTestPrintError(rc); + printf("Error in creating an empty group with (0,0)\n"); - if (outgroup != MPI_GROUP_EMPTY) { - /* Is the group equivalent to group empty? */ - rc = MPI_Group_compare( outgroup, MPI_GROUP_EMPTY, &result ); - if (result != MPI_IDENT) { - errs++; - MTestPrintError( rc ); - printf( "Did not create a group equivalent to an empty group\n" ); - } - } - rc = MPI_Group_free( &group ); - if (rc) { - errs++; - MTestPrintError( rc ); - } - if (outgroup != MPI_GROUP_NULL) { - rc = MPI_Group_free( &outgroup ); - if (rc) { - errs++; - MTestPrintError( rc ); - } - } + /* Some MPI implementations may reject a null "ranks" pointer */ + rc = MPI_Group_incl(group, 0, ranks, &outgroup); + if (rc) { + errs++; + MTestPrintError(rc); + printf("Error in creating an empty group with (0,ranks)\n"); + } + } - MTestFreeComm( &comm ); + if (outgroup != MPI_GROUP_EMPTY) { + /* Is the group equivalent to group empty? */ + rc = MPI_Group_compare(outgroup, MPI_GROUP_EMPTY, &result); + if (result != MPI_IDENT) { + errs++; + MTestPrintError(rc); + printf("Did not create a group equivalent to an empty group\n"); + } + } + rc = MPI_Group_free(&group); + if (rc) { + errs++; + MTestPrintError(rc); + } + if (outgroup != MPI_GROUP_NULL) { + rc = MPI_Group_free(&outgroup); + if (rc) { + errs++; + MTestPrintError(rc); + } + } + + MTestFreeComm(&comm); } - - MTest_Finalize( errs ); + + MTest_Finalize(errs); MPI_Finalize(); return 0; - + } diff --git a/teshsuite/smpi/mpich3-test/group/grouptest.c b/teshsuite/smpi/mpich3-test/group/grouptest.c index e0e2d93c3b..c2904deb60 100644 --- a/teshsuite/smpi/mpich3-test/group/grouptest.c +++ b/teshsuite/smpi/mpich3-test/group/grouptest.c @@ -8,168 +8,171 @@ #include #include -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { MPI_Group g1, g2, g4, g5, g45, selfgroup, g6; int ranks[16], size, rank, myrank, range[1][3]; int errs = 0; int i, rin[16], rout[16], result; - MPI_Init(&argc,&argv); - - MPI_Comm_group( MPI_COMM_WORLD, &g1 ); - MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); - MPI_Comm_size( MPI_COMM_WORLD, &size ); - if (size < 8) { - fprintf( stderr, - "Test requires 8 processes (16 prefered) only %d provided\n", - size ); - errs++; - } - - /* 16 members, this process is rank 0, return in group 1 */ - ranks[0] = myrank; ranks[1] = 2; ranks[2] = 7; - if (myrank == 2) ranks[1] = 3; - if (myrank == 7) ranks[2] = 6; - MPI_Group_incl( g1, 3, ranks, &g2 ); - - /* Check the resulting group */ - MPI_Group_size( g2, &size ); - MPI_Group_rank( g2, &rank ); - - if (size != 3) { - fprintf( stderr, "Size should be %d, is %d\n", 3, size ); - errs++; - } - if (rank != 0) { - fprintf( stderr, "Rank should be %d, is %d\n", 0, rank ); - errs++; - } - - rin[0] = 0; rin[1] = 1; rin[2] = 2; - MPI_Group_translate_ranks( g2, 3, rin, g1, rout ); - for (i=0; i<3; i++) { - if (rout[i] != ranks[i]) { - fprintf( stderr, "translated rank[%d] %d should be %d\n", - i, rout[i], ranks[i] ); - errs++; - } - } - - /* Translate the process of the self group against another group */ - MPI_Comm_group( MPI_COMM_SELF, &selfgroup ); - rin[0] = 0; - MPI_Group_translate_ranks( selfgroup, 1, rin, g1, rout ); - if (rout[0] != myrank) { - fprintf( stderr, "translated of self is %d should be %d\n", - rout[0], myrank ); - errs++; - } - - for (i=0; i g2 - intersect ( w, g3 ) => g3 - intersect ( g2, g3 ) => empty - - g4 = rincl 1:n-1:2 - g5 = rexcl 1:n-1:2 - union( g4, g5 ) => world - g6 = rincl n-1:1:-1 - g7 = rexcl n-1:1:-1 - union( g6, g7 ) => concat of entries, similar to world - diff( w, g2 ) => g3 - */ - MPI_Group_free( &g2 ); - - range[0][0] = 1; - range[0][1] = size-1; - range[0][2] = 2; - MPI_Group_range_excl( g1, 1, range, &g5 ); - - range[0][0] = 1; - range[0][1] = size-1; - range[0][2] = 2; - MPI_Group_range_incl( g1, 1, range, &g4 ); - MPI_Group_union( g4, g5, &g45 ); - MPI_Group_compare( MPI_GROUP_EMPTY, g4, &result ); - if (result != MPI_UNEQUAL) { - errs++; - fprintf( stderr, "Comparison with empty group gave %d, not 3\n", - result ); - } - MPI_Group_free( &g4 ); - MPI_Group_free( &g5 ); - MPI_Group_free( &g45 ); - - /* Now, duplicate the test, but using negative strides */ - range[0][0] = size-1; - range[0][1] = 1; - range[0][2] = -2; - MPI_Group_range_excl( g1, 1, range, &g5 ); - - range[0][0] = size-1; - range[0][1] = 1; - range[0][2] = -2; - MPI_Group_range_incl( g1, 1, range, &g4 ); - - MPI_Group_union( g4, g5, &g45 ); - - MPI_Group_compare( MPI_GROUP_EMPTY, g4, &result ); - if (result != MPI_UNEQUAL) { - errs++; - fprintf( stderr, "Comparison with empty group (formed with negative strides) gave %d, not 3\n", - result ); - } - MPI_Group_free( &g4 ); - MPI_Group_free( &g5 ); - MPI_Group_free( &g45 ); - MPI_Group_free( &g1 ); - - if (myrank == 0) + MPI_Init(&argc, &argv); + + MPI_Comm_group(MPI_COMM_WORLD, &g1); + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + if (size < 8) { + fprintf(stderr, "Test requires 8 processes (16 prefered) only %d provided\n", size); + errs++; + } + + /* 16 members, this process is rank 0, return in group 1 */ + ranks[0] = myrank; + ranks[1] = 2; + ranks[2] = 7; + if (myrank == 2) + ranks[1] = 3; + if (myrank == 7) + ranks[2] = 6; + MPI_Group_incl(g1, 3, ranks, &g2); + + /* Check the resulting group */ + MPI_Group_size(g2, &size); + MPI_Group_rank(g2, &rank); + + if (size != 3) { + fprintf(stderr, "Size should be %d, is %d\n", 3, size); + errs++; + } + if (rank != 0) { + fprintf(stderr, "Rank should be %d, is %d\n", 0, rank); + errs++; + } + + rin[0] = 0; + rin[1] = 1; + rin[2] = 2; + MPI_Group_translate_ranks(g2, 3, rin, g1, rout); + for (i = 0; i < 3; i++) { + if (rout[i] != ranks[i]) { + fprintf(stderr, "translated rank[%d] %d should be %d\n", i, rout[i], ranks[i]); + errs++; + } + } + + /* Translate the process of the self group against another group */ + MPI_Comm_group(MPI_COMM_SELF, &selfgroup); + rin[0] = 0; + MPI_Group_translate_ranks(selfgroup, 1, rin, g1, rout); + if (rout[0] != myrank) { + fprintf(stderr, "translated of self is %d should be %d\n", rout[0], myrank); + errs++; + } + + for (i = 0; i < size; i++) + rin[i] = i; + MPI_Group_translate_ranks(g1, size, rin, selfgroup, rout); + for (i = 0; i < size; i++) { + if (i == myrank && rout[i] != 0) { + fprintf(stderr, "translated world to self of %d is %d\n", i, rout[i]); + errs++; + } + else if (i != myrank && rout[i] != MPI_UNDEFINED) { + fprintf(stderr, "translated world to self of %d should be undefined, is %d\n", + i, rout[i]); + errs++; + } + } + MPI_Group_free(&selfgroup); + + /* Exclude everyone in our group */ { - if (errs == 0) { - printf( " No Errors\n" ); - } - else { - printf( "Found %d errors\n", errs ); - } + int ii, *lranks, g1size; + + MPI_Group_size(g1, &g1size); + + lranks = (int *) malloc(g1size * sizeof(int)); + for (ii = 0; ii < g1size; ii++) + lranks[ii] = ii; + MPI_Group_excl(g1, g1size, lranks, &g6); + if (g6 != MPI_GROUP_EMPTY) { + fprintf(stderr, "Group formed by excluding all ranks not empty\n"); + errs++; + MPI_Group_free(&g6); + } + free(lranks); + } + + /* Add tests for additional group operations */ + /* + * g2 = incl 1,3,7 + * g3 = excl 1,3,7 + * intersect (w, g2) => g2 + * intersect (w, g3) => g3 + * intersect (g2, g3) => empty + * + * g4 = rincl 1:n-1:2 + * g5 = rexcl 1:n-1:2 + * union(g4, g5) => world + * g6 = rincl n-1:1:-1 + * g7 = rexcl n-1:1:-1 + * union(g6, g7) => concat of entries, similar to world + * diff(w, g2) => g3 + */ + MPI_Group_free(&g2); + + range[0][0] = 1; + range[0][1] = size - 1; + range[0][2] = 2; + MPI_Group_range_excl(g1, 1, range, &g5); + + range[0][0] = 1; + range[0][1] = size - 1; + range[0][2] = 2; + MPI_Group_range_incl(g1, 1, range, &g4); + + MPI_Group_union(g4, g5, &g45); + + MPI_Group_compare(MPI_GROUP_EMPTY, g4, &result); + if (result != MPI_UNEQUAL) { + errs++; + fprintf(stderr, "Comparison with empty group gave %d, not 3\n", result); + } + MPI_Group_free(&g4); + MPI_Group_free(&g5); + MPI_Group_free(&g45); + + /* Now, duplicate the test, but using negative strides */ + range[0][0] = size - 1; + range[0][1] = 1; + range[0][2] = -2; + MPI_Group_range_excl(g1, 1, range, &g5); + + range[0][0] = size - 1; + range[0][1] = 1; + range[0][2] = -2; + MPI_Group_range_incl(g1, 1, range, &g4); + + MPI_Group_union(g4, g5, &g45); + + MPI_Group_compare(MPI_GROUP_EMPTY, g4, &result); + if (result != MPI_UNEQUAL) { + errs++; + fprintf(stderr, + "Comparison with empty group (formed with negative strides) gave %d, not 3\n", + result); + } + MPI_Group_free(&g4); + MPI_Group_free(&g5); + MPI_Group_free(&g45); + MPI_Group_free(&g1); + + if (myrank == 0) { + if (errs == 0) { + printf(" No Errors\n"); + } + else { + printf("Found %d errors\n", errs); + } } MPI_Finalize(); diff --git a/teshsuite/smpi/mpich3-test/group/grouptest2.c b/teshsuite/smpi/mpich3-test/group/grouptest2.c index 7d8fb7e152..16bbaab507 100644 --- a/teshsuite/smpi/mpich3-test/group/grouptest2.c +++ b/teshsuite/smpi/mpich3-test/group/grouptest2.c @@ -24,190 +24,191 @@ MPI_Group_union /* stdlib.h Needed for malloc declaration */ #include -int main( int argc, char **argv ) +int main(int argc, char **argv) { - int errs=0, toterr; + int errs = 0, toterr; MPI_Group basegroup; MPI_Group g1, g2, g3, g4, g5, g6, g7, g8, g9, g10; MPI_Group g3a, g3b; - MPI_Comm comm, newcomm, splitcomm, dupcomm; - int i, grp_rank, rank, grp_size, size, result; - int nranks, *ranks, *ranks_out; - int range[1][3]; - int worldrank; + MPI_Comm comm, newcomm, splitcomm, dupcomm; + int i, grp_rank, rank, grp_size, size, result; + int nranks, *ranks, *ranks_out; + int range[1][3]; + int worldrank; - MPI_Init( &argc, &argv ); - MPI_Comm_rank( MPI_COMM_WORLD, &worldrank ); + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &worldrank); comm = MPI_COMM_WORLD; - MPI_Comm_group( comm, &basegroup ); - MPI_Comm_rank( comm, &rank ); - MPI_Comm_size( comm, &size ); + MPI_Comm_group(comm, &basegroup); + MPI_Comm_rank(comm, &rank); + MPI_Comm_size(comm, &size); /* Get the basic information on this group */ - MPI_Group_rank( basegroup, &grp_rank ); + MPI_Group_rank(basegroup, &grp_rank); if (grp_rank != rank) { - errs++; - fprintf( stdout, "group rank %d != comm rank %d\n", grp_rank, rank ); + errs++; + fprintf(stdout, "group rank %d != comm rank %d\n", grp_rank, rank); } - MPI_Group_size( basegroup, &grp_size ); + MPI_Group_size(basegroup, &grp_size); if (grp_size != size) { - errs++; - fprintf( stdout, "group size %d != comm size %d\n", grp_size, size ); + errs++; + fprintf(stdout, "group size %d != comm size %d\n", grp_size, size); } /* Form a new communicator with inverted ranking */ - MPI_Comm_split( comm, 0, size - rank, &newcomm ); - MPI_Comm_group( newcomm, &g1 ); - ranks = (int *)malloc( size * sizeof(int) ); - ranks_out = (int *)malloc( size * sizeof(int) ); - for (i=0; i MAX_WORLD_SIZE) { - fprintf( stderr, - "This test requires a comm world with no more than %d processes\n", - MAX_WORLD_SIZE ); - MPI_Abort( MPI_COMM_WORLD, 1 ); - exit(1); + fprintf(stderr, + "This test requires a comm world with no more than %d processes\n", MAX_WORLD_SIZE); + MPI_Abort(MPI_COMM_WORLD, 1); } if (size < 4) { - fprintf( stderr, "This test requiers at least 4 processes\n" ); - MPI_Abort( MPI_COMM_WORLD, 1 ); - exit(1); + fprintf(stderr, "This test requiers at least 4 processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); } - MPI_Comm_group( comm, &gworld ); - for (i=0; i #include "mpitest.h" -#include /* for fabs(3) */ +#include /* for fabs(3) */ /* Measure and compare the relative performance of MPI_Group_translate_ranks * with small and large group2 sizes but a constant number of ranks. This @@ -22,57 +22,58 @@ /* number of iterations used for timing */ #define NUM_LOOPS (1000000) -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { int errs = 0; int *ranks; int *ranksout; MPI_Group gworld, grev, gself; - MPI_Comm comm; - MPI_Comm commrev; + MPI_Comm comm; + MPI_Comm commrev; int rank, size, i; double start, end, time1, time2; - MTest_Init( &argc, &argv ); + MTest_Init(&argc, &argv); comm = MPI_COMM_WORLD; - MPI_Comm_size( comm, &size ); - MPI_Comm_rank( comm, &rank ); + MPI_Comm_size(comm, &size); + MPI_Comm_rank(comm, &rank); - ranks = malloc(size*sizeof(int)); - ranksout = malloc(size*sizeof(int)); + ranks = malloc(size * sizeof(int)); + ranksout = malloc(size * sizeof(int)); if (!ranks || !ranksout) { fprintf(stderr, "out of memory\n"); MPI_Abort(MPI_COMM_WORLD, 1); - exit(1); } /* generate a comm with the rank order reversed */ - MPI_Comm_split(comm, 0, (size-rank-1), &commrev); + MPI_Comm_split(comm, 0, (size - rank - 1), &commrev); MPI_Comm_group(commrev, &grev); MPI_Comm_group(MPI_COMM_SELF, &gself); MPI_Comm_group(comm, &gworld); /* sanity check correctness first */ - for (i=0; i < size; i++) { + for (i = 0; i < size; i++) { ranks[i] = i; ranksout[i] = -1; } MPI_Group_translate_ranks(grev, size, ranks, gworld, ranksout); - for (i=0; i < size; i++) { - if (ranksout[i] != (size-i-1)) { + for (i = 0; i < size; i++) { + if (ranksout[i] != (size - i - 1)) { if (rank == 0) - printf("%d: (gworld) expected ranksout[%d]=%d, got %d\n", rank, i, (size-rank-1), ranksout[i]); + printf("%d: (gworld) expected ranksout[%d]=%d, got %d\n", rank, i, + (size - rank - 1), ranksout[i]); ++errs; } } MPI_Group_translate_ranks(grev, size, ranks, gself, ranksout); - for (i=0; i < size; i++) { - int expected = (i == (size-rank-1) ? 0 : MPI_UNDEFINED); + for (i = 0; i < size; i++) { + int expected = (i == (size - rank - 1) ? 0 : MPI_UNDEFINED); if (ranksout[i] != expected) { if (rank == 0) - printf("%d: (gself) expected ranksout[%d]=%d, got %d\n", rank, i, expected, ranksout[i]); + printf("%d: (gself) expected ranksout[%d]=%d, got %d\n", rank, i, expected, + ranksout[i]); ++errs; } } @@ -89,10 +90,11 @@ int main( int argc, char *argv[] ) if (rank != 0) { MTestSleep(10); } - else /* rank==0 */ { - MTestSleep(1); /* try to avoid timing while everyone else is making syscalls */ + else { /* rank==0 */ - MPI_Group_translate_ranks(grev, size, ranks, gworld, ranksout); /*throwaway iter*/ + MTestSleep(1); /* try to avoid timing while everyone else is making syscalls */ + + MPI_Group_translate_ranks(grev, size, ranks, gworld, ranksout); /*throwaway iter */ start = MPI_Wtime(); for (i = 0; i < NUM_LOOPS; ++i) { MPI_Group_translate_ranks(grev, size, ranks, gworld, ranksout); @@ -100,7 +102,7 @@ int main( int argc, char *argv[] ) end = MPI_Wtime(); time1 = end - start; - MPI_Group_translate_ranks(grev, size, ranks, gself, ranksout); /*throwaway iter*/ + MPI_Group_translate_ranks(grev, size, ranks, gself, ranksout); /*throwaway iter */ start = MPI_Wtime(); for (i = 0; i < NUM_LOOPS; ++i) { MPI_Group_translate_ranks(grev, size, ranks, gself, ranksout); @@ -112,7 +114,7 @@ int main( int argc, char *argv[] ) if (fabs(time1 - time2) > (2.00 * time2)) { printf("too much difference in MPI_Group_translate_ranks performance:\n"); printf("time1=%f time2=%f\n", time1, time2); - printf("(fabs(time1-time2)/time2)=%f\n", (fabs(time1-time2)/time2)); + printf("(fabs(time1-time2)/time2)=%f\n", (fabs(time1 - time2) / time2)); if (time1 < time2) { printf("also, (time1