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,