X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9b73466ada27682d1729f394549479da83ef4a99..90f50bba185f1c86225aa498dcc3a01c9080b52b:/teshsuite/smpi/mpich3-test/coll/uoplong.c diff --git a/teshsuite/smpi/mpich3-test/coll/uoplong.c b/teshsuite/smpi/mpich3-test/coll/uoplong.c index 39f857db98..ab8a43f751 100644 --- a/teshsuite/smpi/mpich3-test/coll/uoplong.c +++ b/teshsuite/smpi/mpich3-test/coll/uoplong.c @@ -9,8 +9,8 @@ #include #include -/* - * Test user-defined operations with a large number of elements. +/* + * Test user-defined operations with a large number of elements. * Added because a talk at EuroMPI'12 claimed that these failed with * more than 64k elements */ @@ -18,92 +18,92 @@ #define MAX_ERRS 10 #define MAX_COUNT 1200000 -void myop( void *cinPtr, void *coutPtr, int *count, MPI_Datatype *dtype ); +void myop(void *cinPtr, void *coutPtr, int *count, MPI_Datatype * dtype); -/* +/* * myop takes a datatype that is a triple of doubles, and computes * the sum, max, min of the respective elements of the triple. */ -void myop( void *cinPtr, void *coutPtr, int *count, MPI_Datatype *dtype ) +void myop(void *cinPtr, void *coutPtr, int *count, MPI_Datatype * dtype) { int i, n = *count; - double const *cin = (double *)cinPtr; - double *cout = (double *)coutPtr; - - for (i=0; i cin[1]) ? cout[1] : cin[1]; - cout[2] = (cout[2] < cin[2]) ? cout[2] : cin[2]; - cin += 3; - cout += 3; + double const *cin = (double *) cinPtr; + double *cout = (double *) coutPtr; + + for (i = 0; i < n; i++) { + cout[0] += cin[0]; + cout[1] = (cout[1] > cin[1]) ? cout[1] : cin[1]; + cout[2] = (cout[2] < cin[2]) ? cout[2] : cin[2]; + cin += 3; + cout += 3; } } -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { int errs = 0; int wsize, wrank, i, count; MPI_Datatype tripleType; double *inVal, *outVal; - double maxval, sumval; + double maxval, sumval, minval; MPI_Op op; - MTest_Init( &argc, &argv ); - MPI_Op_create( myop, 0, &op ); - MPI_Type_contiguous( 3, MPI_DOUBLE, &tripleType ); - MPI_Type_commit( &tripleType ); + MTest_Init(&argc, &argv); + MPI_Op_create(myop, 0, &op); + MPI_Type_contiguous(3, MPI_DOUBLE, &tripleType); + MPI_Type_commit(&tripleType); - MPI_Comm_size( MPI_COMM_WORLD, &wsize ); - MPI_Comm_rank( MPI_COMM_WORLD, &wrank ); + MPI_Comm_size(MPI_COMM_WORLD, &wsize); + MPI_Comm_rank(MPI_COMM_WORLD, &wrank); - for (count=1; count