X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/19b3962253112b19308537bc2400de141c119d99..a3d08dd00246eb26ced68c5b0e046096706bbe23:/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c diff --git a/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c b/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c index 0c83cb7256..107179fe01 100644 --- a/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c +++ b/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014. The SimGrid Team. +/* Copyright (c) 2013-2014, 2016-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -46,10 +46,9 @@ static void print_buffer_int(void *buf, int len, char *msg, int rank) { - int* v; printf("[%d] %s (#%d): ", rank, msg, len); for (int tmp = 0; tmp < len; tmp++) { - v = buf; + int* v = buf; printf("[%d]", v[tmp]); } printf("\n"); @@ -62,7 +61,6 @@ int main(int argc, char **argv) int i; int rank; int size; - int *sendcounts, *recvcounts, *rdispls, *sdispls; MPI_Init(&argc, &argv); @@ -70,6 +68,10 @@ int main(int argc, char **argv) /* Create the buffer */ MPI_Comm_size(comm, &size); + if(size<=0){ + printf("error : comm size <= 0, run with mpirun\n"); + return -1; + } MPI_Comm_rank(comm, &rank); int* sbuf = (int *) xbt_malloc(size * size * sizeof(int)); int* rbuf = (int *) xbt_malloc(size * size * sizeof(int)); @@ -81,10 +83,10 @@ int main(int argc, char **argv) } /* Create and load the arguments to alltoallv */ - sendcounts = (int *) xbt_malloc(size * sizeof(int)); - recvcounts = (int *) xbt_malloc(size * sizeof(int)); - rdispls = (int *) xbt_malloc(size * sizeof(int)); - sdispls = (int *) xbt_malloc(size * sizeof(int)); + int* sendcounts = (int*)xbt_malloc(size * sizeof(int)); + int* recvcounts = (int*)xbt_malloc(size * sizeof(int)); + int* rdispls = (int*)xbt_malloc(size * sizeof(int)); + int* sdispls = (int*)xbt_malloc(size * sizeof(int)); for (i = 0; i < size; i++) { sendcounts[i] = i; recvcounts[i] = rank; @@ -102,7 +104,7 @@ int main(int argc, char **argv) print_buffer_int( rbuf, size*size, strdup("rbuf:"),rank); - MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); if (0 == rank) { printf("Alltoallv TEST COMPLETE.\n"); }