Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MPI_Allreduce()
authorgenaud <genaud@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 30 Jun 2009 21:23:33 +0000 (21:23 +0000)
committergenaud <genaud@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 30 Jun 2009 21:23:33 +0000 (21:23 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6407 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/smpi/smpi_mpi.c

index 730e3c8..f454c27 100644 (file)
@@ -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)