Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] Doubt regarding MPI_GATHER
From: George Bosilca (bosilca_at_[hidden])
Date: 2009-11-23 13:48:35

The MPI standard provides the MPI_IN_PLACE to handle such situations.
If one consider that each node works on the same amount of data, then
the following call will do what you're looking for:

call MPI_Gather( MPI_IN_PLACE, var, MPI_REAL8,
                  a, var, MPI_REAL8,
                  0, MPI_COMM_WORLD, ierr )

For more information about MPI_Gather and the MPI_IN_PLACE please look
in the MPI standard version 2.2 at page 143.


On Nov 23, 2009, at 09:37 , Eugene Loh wrote:

> Anyhow, you can try:
> call MPI_Gather(a
> (istart),var,MPI_REAL8,a,var,MPI_REAL8,0,MPI_COMM_WORLD,ierr)
> Strictly speaking, this is not correct since the send and receive
> buffers overlap. So, the real thing to do is to declare a full
> array a(1:n) (only necessary on the root rank 0) and a "local" array
> a_local(istart:iend) on each process.