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
> 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.