X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9b73466ada27682d1729f394549479da83ef4a99..a9c9083479c7a98cb890faad9d2f40e9a64ccd83:/teshsuite/smpi/mpich3-test/coll/scatter2.c diff --git a/teshsuite/smpi/mpich3-test/coll/scatter2.c b/teshsuite/smpi/mpich3-test/coll/scatter2.c index 5535a30956..96a55b0ce1 100644 --- a/teshsuite/smpi/mpich3-test/coll/scatter2.c +++ b/teshsuite/smpi/mpich3-test/coll/scatter2.c @@ -13,61 +13,62 @@ /* This example sends a vector and receives individual elements, but the root process does not receive any data */ -int main( int argc, char **argv ) +int main(int argc, char **argv) { MPI_Datatype vec; double *vecin, *vecout, ivalue; - int root, i, n, stride, err = 0; - int rank, size; + int root, i, n, stride, err = 0; + int rank, size; MPI_Aint vextent; - MTest_Init( &argc, &argv ); - - MPI_Comm_size( MPI_COMM_WORLD, &size ); - MPI_Comm_rank( MPI_COMM_WORLD, &rank ); + MTest_Init(&argc, &argv); + + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); n = 12; stride = 10; - vecin = (double *)malloc( n * stride * size * sizeof(double) ); - vecout = (double *)malloc( n * sizeof(double) ); - - MPI_Type_vector( n, 1, stride, MPI_DOUBLE, &vec ); - MPI_Type_commit( &vec ); - MPI_Type_extent( vec, &vextent ); - if (vextent != ((n-1)*(MPI_Aint)stride + 1) * sizeof(double) ) { - err++; - printf( "Vector extent is %ld, should be %ld\n", - (long) vextent, (long)(((n-1)*stride+1)*sizeof(double)) ); + vecin = (double *) malloc(n * stride * size * sizeof(double)); + vecout = (double *) malloc(n * sizeof(double)); + + MPI_Type_vector(n, 1, stride, MPI_DOUBLE, &vec); + MPI_Type_commit(&vec); + MPI_Type_extent(vec, &vextent); + if (vextent != ((n - 1) * (MPI_Aint) stride + 1) * sizeof(double)) { + err++; + printf("Vector extent is %ld, should be %ld\n", + (long) vextent, (long) (((n - 1) * stride + 1) * sizeof(double))); } /* Note that the exted of type vector is from the first to the - last element, not n*stride. - E.g., with n=1, the extent is a single double */ + * last element, not n*stride. + * E.g., with n=1, the extent is a single double */ - for (i=0; i