X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9b73466ada27682d1729f394549479da83ef4a99..90f50bba185f1c86225aa498dcc3a01c9080b52b:/teshsuite/smpi/mpich3-test/coll/bcasttest.c diff --git a/teshsuite/smpi/mpich3-test/coll/bcasttest.c b/teshsuite/smpi/mpich3-test/coll/bcasttest.c index d7d9cda9f4..c3d080ac45 100644 --- a/teshsuite/smpi/mpich3-test/coll/bcasttest.c +++ b/teshsuite/smpi/mpich3-test/coll/bcasttest.c @@ -13,91 +13,77 @@ #define NUM_REPS 5 #define NUM_SIZES 4 -int main( int argc, char **argv) +int main(int argc, char **argv) { int *buf; int i, rank, reps, n; int bVerify = 1; - int sizes[NUM_SIZES] = { 100, 64*1024, 128*1024, 1024*1024 }; - int num_errors=0; - - MTest_Init( &argc, &argv ); + int sizes[NUM_SIZES] = { 100, 64 * 1024, 128 * 1024, 1024 * 1024 }; + int num_errors = 0; + + MTest_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); - if (argc > 1) - { - if (strcmp(argv[1], "-novalidate") == 0 || strcmp(argv[1], "-noverify") == 0) - bVerify = 0; + if (argc > 1) { + if (strcmp(argv[1], "-novalidate") == 0 || strcmp(argv[1], "-noverify") == 0) + bVerify = 0; } - buf = (int *) malloc(sizes[NUM_SIZES-1]*sizeof(int)); - memset(buf, 0, sizes[NUM_SIZES-1]*sizeof(int)); + buf = (int *) malloc(sizes[NUM_SIZES - 1] * sizeof(int)); + memset(buf, 0, sizes[NUM_SIZES - 1] * sizeof(int)); - for (n=0; n= 10) - { - printf("Error: Rank=%d, num_errors = %d\n", rank, num_errors); - fflush(stdout); - } - } - } + MPI_Bcast(buf, sizes[n], MPI_INT, ROOT, MPI_COMM_WORLD); + + if (bVerify) { + num_errors = 0; + for (i = 0; i < sizes[n]; i++) { + if (buf[i] != 1000000 * (n * NUM_REPS + reps) + i) { + num_errors++; + if (num_errors < 10) { + printf("Error: Rank=%d, n=%d, reps=%d, i=%d, buf[i]=%d expected=%d\n", + rank, n, reps, i, buf[i], 1000000 * (n * NUM_REPS + reps) + i); + fflush(stdout); + } + } + } + if (num_errors >= 10) { + printf("Error: Rank=%d, num_errors = %d\n", rank, num_errors); + fflush(stdout); + } + } + } } - + free(buf); - MTest_Finalize( num_errors ); + MTest_Finalize(num_errors); MPI_Finalize(); return 0; }