From 9b7c1ca97a999253523379758746a51385a47df7 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 18 Aug 2005 19:39:45 +0000 Subject: [PATCH] Forgot to include the check for 0 in the Allreduce case (already got Reduce and Reduce_scatter) This commit was SVN r6929. --- ompi/mpi/c/allreduce.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ompi/mpi/c/allreduce.c b/ompi/mpi/c/allreduce.c index af53abafb0..6bbcf876cf 100644 --- a/ompi/mpi/c/allreduce.c +++ b/ompi/mpi/c/allreduce.c @@ -62,6 +62,14 @@ int MPI_Allreduce(void *sendbuf, void *recvbuf, int count, OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); } + /* MPI-1, p114, says that each process must supply at least + one element. But at least the Pallas benchmarks call + MPI_REDUCE with a count of 0. So be sure to handle it. */ + + if (0 == count) { + return MPI_SUCCESS; + } + /* Invoke the coll component to perform the back-end operation */ err = comm->c_coll.coll_allreduce(sendbuf, recvbuf, count,