Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] send and receive buffer the same on root
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2010-09-16 13:06:51

The description for MPI_GATHERV says (from

The specification of counts, types, and displacements should not cause any location on the root to be written more than once. Such a call is erroneous. The ``in place'' option for intracommunicators is specified by passing MPI_IN_PLACE as the value of sendbuf at the root. In such a case, sendcount and sendtype are ignored, and the contribution of the root to the gathered vector is assumed to be already in the correct place in the receive buffer

So if I understand your situation properly, you should be using MPI_IN_PLACE -- meaning that in general, you're probably getting lucky even if it works with Open MPI.

On Sep 16, 2010, at 6:01 PM, Tom Rosmond wrote:

> I am working with a Fortran 90 code with many MPI calls like this:
> call mpi_gatherv(x,nsize(rank+1),
> mpi_real,x,nsize,nstep,mpi_real,root,mpi_comm_world,mstat)
> 'x' is allocated on root to be large enough to hold the results of the
> gather, other arrays and parameters are defined correctly, and the code
> runs as it should. However, I am concerned that having the same send
> and receive buffer on root is a violation of the MPI standard. Am I
> correct? I am aware of the MPI_IN_PLACE feature that can be used in
> this situation, by defining it as the send buffer at root.
> The fact that the code as written seems to work on most system we run on
> (some with OpenMPI, some with proprietary MPI's) indicates that in spite
> of the standard, implementations allow it. Is this correct, or are we
> just lucky.
> T. Rosmond
> _______________________________________________
> users mailing list
> users_at_[hidden]

Jeff Squyres
For corporate legal information go to: