X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7f04fa5306f52960db709bb520c49e9f4ecec000..253aec39d6b6cdae39cd320f47f952b7cd665048:/teshsuite/smpi/reduce_coll.c diff --git a/teshsuite/smpi/reduce_coll.c b/teshsuite/smpi/reduce_coll.c index ee629e310b..3b284570f4 100644 --- a/teshsuite/smpi/reduce_coll.c +++ b/teshsuite/smpi/reduce_coll.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010. The SimGrid Team. +/* Copyright (c) 2009-2010, 2013. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -34,22 +34,41 @@ int main(int argc, char *argv[]) sb[i] = rank*size + i; rb[i] = 0; } - printf("[%d] sndbuf=[", rank); for (i = 0; i < size; i++) printf("%d ", sb[i]); printf("]\n"); - - status = MPI_Reduce(sb, rb, size, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); + + int root=0; + status = MPI_Reduce(sb, rb, size, MPI_INT, MPI_SUM, root, MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD); - printf("[%d] rcvbuf=[", rank); - for (i = 0; i < size; i++) - printf("%d ", rb[i]); + if (rank == root) { + printf("[%d] rcvbuf=[", rank); + for (i = 0; i < size; i++) + printf("%d ", rb[i]); + printf("]\n"); + if (status != MPI_SUCCESS) { + printf("all_to_all returned %d\n", status); + fflush(stdout); + } + } + + + printf("[%d] second sndbuf=[", rank); + for (i = 0; i < 1; i++) + printf("%d ", sb[i]); printf("]\n"); + + root=size-1; + status = MPI_Reduce(sb, rb, 1, MPI_INT, MPI_PROD, root, MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); - - if (rank == 0) { + if (rank == root) { + printf("[%d] rcvbuf=[", rank); + for (i = 0; i < 1; i++) + printf("%d ", rb[i]); + printf("]\n"); if (status != MPI_SUCCESS) { printf("all_to_all returned %d\n", status); fflush(stdout);