X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/01cfa7276bea34f747662c55a1ce2f2f7d38c1c6..aac4ba41ea27fe8168bebed009abebd7e5c3f006:/teshsuite/smpi/mpich3-test/perf/transp-datatype.c diff --git a/teshsuite/smpi/mpich3-test/perf/transp-datatype.c b/teshsuite/smpi/mpich3-test/perf/transp-datatype.c index b7ebc278b3..430831b6d0 100644 --- a/teshsuite/smpi/mpich3-test/perf/transp-datatype.c +++ b/teshsuite/smpi/mpich3-test/perf/transp-datatype.c @@ -21,11 +21,11 @@ #define SIZE 100 #define ITER 100 -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { int i, j, k; - static double a[SIZE][SIZE],b[SIZE][SIZE]; - double t1,t2,t,ts,tst; + static double a[SIZE][SIZE], b[SIZE][SIZE]; + double t1, t2, t, ts, tst; double temp; int myrank, mysize, errs = 0; MPI_Status status; @@ -33,94 +33,92 @@ int main(int argc, char* argv[]) MPI_Datatype col, xpose; - MTest_Init( &argc, &argv ); - MPI_Comm_rank(MPI_COMM_WORLD,&myrank); - MPI_Comm_size( MPI_COMM_WORLD, &mysize ); + MTest_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); + MPI_Comm_size(MPI_COMM_WORLD, &mysize); if (mysize != 2) { - fprintf( stderr, "This test must be run with 2 processes\n" ); - MPI_Abort( MPI_COMM_WORLD, 1 ); + fprintf(stderr, "This test must be run with 2 processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); } MPI_Type_extent(MPI_DOUBLE, &sizeofreal); - + MPI_Type_vector(SIZE, 1, SIZE, MPI_DOUBLE, &col); MPI_Type_hvector(SIZE, 1, sizeofreal, col, &xpose); MPI_Type_commit(&xpose); /* Preset the arrays so that they're in memory */ - for (i=0; i 2 * tst) { - errs ++; - fprintf( stderr, "Transpose time with datatypes is more than twice time without datatypes\n" ); - fprintf( stderr, "%f\t%f\t%f\n", t, ts, tst ); - } + /* if t and tst are too different, then there is a performance + * problem in the handling of the datatypes */ + + if (t > 2 * tst) { + errs++; + fprintf(stderr, + "Transpose time with datatypes is more than twice time without datatypes\n"); + fprintf(stderr, "%f\t%f\t%f\n", t, ts, tst); + } } MPI_Type_free(&col); MPI_Type_free(&xpose); - MTest_Finalize( errs ); + MTest_Finalize(errs); MPI_Finalize(); return 0; }