|
Let's turn now to gather and gatherv, which are the exact inverses of scatter and scatterv. In fact, we don't even need new diagrams! Simply think about reversing the directions of the arrows in the previous diagrams. We will therefore turn our attention directly to the syntax of the gatherv call. Again, we'll look at it in Fortran:
INTEGER RECVCOUNTS(0:NPROC-1), DISPLS(0:NPROC-1)
...
CALL MPI_GATHERV
( SENDBUF, SENDCOUNT, SENDTYPE,
RECVBUF, RECVCOUNTS, DISPLS, RECVTYPE,
ROOT, COMM, IERROR )
Here, RECVCOUNTS(I) plays the role that SENDCOUNTS(I) played in the call to MPI_Scatterv. Its location in the argument list has been shifted appropriately, to put it among the arguments relating to the receiver. DISPLS(I) in this case indicates where to place the data arriving from process I. It is given as an offset relative to address RECVBUF on the ROOT process, and it is in units of SENDTYPE. Therefore, compared to MPI_Gather, there is an additional array DISPLS, while RECVCOUNTS has been stretched into an array.
|