X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c81c99a491282f76757c2673961e3cdee6853539..90f50bba185f1c86225aa498dcc3a01c9080b52b:/teshsuite/smpi/mpich3-test/coll/exscan.c diff --git a/teshsuite/smpi/mpich3-test/coll/exscan.c b/teshsuite/smpi/mpich3-test/coll/exscan.c index 70f4c53d7b..4667a70fcb 100644 --- a/teshsuite/smpi/mpich3-test/coll/exscan.c +++ b/teshsuite/smpi/mpich3-test/coll/exscan.c @@ -13,86 +13,87 @@ static char MTEST_Descrip[] = "Test MPI_Exscan"; */ -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { int errs = 0; int rank, size; - int minsize = 2, count; + int minsize = 2, count; int *sendbuf, *recvbuf, i; - MPI_Comm comm; + MPI_Comm comm; - MTest_Init( &argc, &argv ); + MTest_Init(&argc, &argv); - /* The following illustrates the use of the routines to - run through a selection of communicators and datatypes. - Use subsets of these for tests that do not involve combinations - of communicators, datatypes, and counts of datatypes */ - while (MTestGetIntracommGeneral( &comm, minsize, 1 )) { - if (comm == MPI_COMM_NULL) continue; + /* The following illustrates the use of the routines to + * run through a selection of communicators and datatypes. + * Use subsets of these for tests that do not involve combinations + * of communicators, datatypes, and counts of datatypes */ + while (MTestGetIntracommGeneral(&comm, minsize, 1)) { + if (comm == MPI_COMM_NULL) + continue; - MPI_Comm_rank( comm, &rank ); - MPI_Comm_size( comm, &size ); - - for (count = 1; count < 65000; count = count * 2) { + MPI_Comm_rank(comm, &rank); + MPI_Comm_size(comm, &size); - sendbuf = (int *)malloc( count * sizeof(int) ); - recvbuf = (int *)malloc( count * sizeof(int) ); + for (count = 1; count < 65000; count = count * 2) { - for (i=0; i 0) { - int result; - for (i=0; i 0) { + int result; + for (i = 0; i < count; i++) { + result = rank * i * size + ((rank) * (rank - 1)) / 2; + if (recvbuf[i] != result) { + errs++; + if (errs < 10) { + fprintf(stderr, "Error in recvbuf[%d] = %d on %d, expected %d\n", + i, recvbuf[i], rank, result); + } + } + } + } #if MTEST_HAVE_MIN_MPI_VERSION(2,2) /* now try the MPI_IN_PLACE flavor */ - for (i=0; i