From: genaud Date: Tue, 30 Jun 2009 21:23:33 +0000 (+0000) Subject: MPI_Allreduce() X-Git-Tag: SVN~1234 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ca448021b42fde4a06bfab9aebebe00925c62d38?hp=865f97c868ce92518b1cf4f23e23bd1b16b7917c MPI_Allreduce() git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6407 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/smpi/smpi_mpi.c b/src/smpi/smpi_mpi.c index 730e3c8de6..f454c2765c 100644 --- a/src/smpi/smpi_mpi.c +++ b/src/smpi/smpi_mpi.c @@ -341,6 +341,32 @@ int SMPI_MPI_Reduce(void *sendbuf, void *recvbuf, int count, return retval; } +/** + * MPI_Allreduce + * + * Same as MPI_REDUCE except that the result appears in the receive buffer of all the group members. + **/ +int SMPI_MPI_Allreduce( void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, + MPI_Op op, MPI_Comm comm ) +{ + int retval = MPI_SUCCESS; + int root=0; // arbitrary choice + + smpi_bench_end(); + + retval = SMPI_MPI_Reduce( sendbuf, recvbuf, count, datatype, op, root, comm); + if (MPI_SUCCESS != retval) + return(retval); + retval = SMPI_MPI_Bcast( recvbuf, count, datatype, root, comm); + + smpi_bench_begin(); + return( retval ); +} + + + + + // used by comm_split to sort ranks based on key values int smpi_compare_rankkeys(const void *a, const void *b); int smpi_compare_rankkeys(const void *a, const void *b)