From e08c6e81f5e85b1cc32056af7dec3b43852b83bc Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 4 Oct 2006 22:36:01 +0000 Subject: [PATCH] * Fixes trac:338: Only look at root-significant values at the root (e.g., recvbuf in MPI_GATHER). * Minor style updates (constants on the left of == and !=) * Fix a minor buglet that crept in r11904: had a recvbuf where it should have been recvcount. Thankfully, this would have only affected erroneous programs. ;-) This commit was SVN r11980. The following SVN revision numbers were found above: r11904 --> open-mpi/ompi@17539dc154ab3a6f0cd64d66c499c3aad675e54d The following Trac tickets were found above: Ticket 338 --> https://svn.open-mpi.org/trac/ompi/ticket/338 --- ompi/mpi/c/gather.c | 5 +++-- ompi/mpi/c/gatherv.c | 3 ++- ompi/mpi/c/reduce.c | 5 +++-- ompi/mpi/c/scatter.c | 3 ++- ompi/mpi/c/scatterv.c | 3 ++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ompi/mpi/c/gather.c b/ompi/mpi/c/gather.c index 898579f62e..38275a383d 100644 --- a/ompi/mpi/c/gather.c +++ b/ompi/mpi/c/gather.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) || - MPI_IN_PLACE == recvbuf) { + (ompi_comm_rank(comm) == root && MPI_IN_PLACE == recvbuf)) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); } @@ -118,7 +119,7 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, (ompi_comm_rank(comm) != root || (ompi_comm_rank(comm) == root && MPI_IN_PLACE != sendbuf))) || (ompi_comm_rank(comm) == root && MPI_IN_PLACE == sendbuf && - 0 == recvbuf)) { + 0 == recvcount)) { return MPI_SUCCESS; } diff --git a/ompi/mpi/c/gatherv.c b/ompi/mpi/c/gatherv.c index 66befe91fa..3a5be2aaf5 100644 --- a/ompi/mpi/c/gatherv.c +++ b/ompi/mpi/c/gatherv.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) || - MPI_IN_PLACE == recvbuf) { + (ompi_comm_rank(comm) == root && MPI_IN_PLACE == recvbuf)) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); } diff --git a/ompi/mpi/c/reduce.c b/ompi/mpi/c/reduce.c index c3e24ac72b..0a0ef3d0d0 100644 --- a/ompi/mpi/c/reduce.c +++ b/ompi/mpi/c/reduce.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -55,8 +56,8 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count, int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg); free(msg); return ret; - } else if ((root != ompi_comm_rank(comm) && MPI_IN_PLACE == sendbuf) || - MPI_IN_PLACE == recvbuf) { + } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) || + (ompi_comm_rank(comm) == root && MPI_IN_PLACE == recvbuf)) { err = MPI_ERR_ARG; } else { OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count); diff --git a/ompi/mpi/c/scatter.c b/ompi/mpi/c/scatter.c index d3881a19c9..441c9e2069 100644 --- a/ompi/mpi/c/scatter.c +++ b/ompi/mpi/c/scatter.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,7 @@ int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == recvbuf) || - MPI_IN_PLACE == sendbuf) { + (ompi_comm_rank(comm) == root && MPI_IN_PLACE == sendbuf)) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); } diff --git a/ompi/mpi/c/scatterv.c b/ompi/mpi/c/scatterv.c index 608c613e81..7ace4b8ccd 100644 --- a/ompi/mpi/c/scatterv.c +++ b/ompi/mpi/c/scatterv.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == recvbuf) || - MPI_IN_PLACE == sendbuf) { + (ompi_comm_rank(comm) == root && MPI_IN_PLACE == sendbuf)) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); }