On 07/06/2012 05:27 PM, Ryan S. Davis wrote:
> Hi all,
>
> I am trying to scatter data from the master process to the others using
> scatterv and my own datatype that maps out the blocks of data in memory.
>
> The problem is that I dont know what unit size the function (scatterv)
> is using to measure displacements in. I assume that it is using the
> extent of the user-defined datatype, but I need
> to specify the displacements in bytes.
>
> For example, if I specify a displacement of 2 from the sendbuffer, does
> this mean 2 bytes
> or 2*MPI_Type_size() or 2*MPI_Type_extent()? The man page isn't very
> clear on this.
>
> I know that there is function MPI_Type_hindexed, that accepts
> displacements measured is bytes
> when creating new datatypes.
> Is there something similar for scatterv/gatherv?
>
> Thanks.
Hi Ryan
I think MPI multiplies the displacement values by the type extent,
to get the buffer addresses being scattered.
So, if I understood your question right, the
answer is: the second address will be 2*MPI_Type_extent()
bytes away from the sendbuffer initial address.
MPI, The Complete Reference, Vol. 1, 2nd Edition,
by M. Snir et al., p. 212-
" MPI_Scatterv
...
The outcome is as if the root executed n send operations,
MPI_Send(sendbuf+displs[i].extent(sendtype), sendcounts[i], sendtype, i,
...), i=0 to n-1, and each process executed a receive,
MPI_Recv(recvbuf, recvcount, recvtype, root,...)."
There is a similar description/clarification
for MPI_Gatherv on pp 202-209, and examples with
user defined types.
I hope this helps,
Gus Correa
|