X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/93d811622222dd8585da7e210069976ab9675598..2a7da3fc475a11817defb8d201da3887c9215b1a:/teshsuite/smpi/bcast_coll.c diff --git a/teshsuite/smpi/bcast_coll.c b/teshsuite/smpi/bcast_coll.c index 140288391c..008543a04b 100644 --- a/teshsuite/smpi/bcast_coll.c +++ b/teshsuite/smpi/bcast_coll.c @@ -9,19 +9,25 @@ int main(int argc, char **argv) { - int size, rank; - int value = 3; + int i, size, rank; + int *values; int status; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + values = (int *) xbt_malloc(size * sizeof(int)); - if (0 == rank) { - value = 17; - } - status = MPI_Bcast(&value, 1, MPI_INT, 0, MPI_COMM_WORLD); - printf("node %d has value %d after broadcast\n", rank, value); + for (i = 0; i < size; i++) + values[i] = (0 == rank) ? 17 : 3; + + status = MPI_Bcast(values, size, MPI_INT, 0, MPI_COMM_WORLD); + + printf("[%d] values=[", rank); + for (i = 0; i < size; i++) + printf("%d ", values[i]); + printf("]\n"); MPI_Barrier(MPI_COMM_WORLD);