Archives


- Beowulf
- Beowulf Announce
- Scyld-users
- Beowulf on Debian

[Beowulf] MPI programming question: Interleaved MPI_Gatherv?

Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.

Search

William Gropp gropp at mcs.anl.gov
Thu Mar 3 06:23:10 PST 2005


At 12:44 AM 3/1/2005, Michael Gauckler wrote:
>Dear List,
>
>I would like to gather the data from several processes.
>Instead of the comonly used stride, I want to interleave
>the data:
>
>Rank 0: AAAAA -> ABCDABCDABCDABCDABCD
>Rank 1: BBBBB ----^---^---^---^---^
>Rank 2: CCCCC -----^---^---^---^---^
>Rank 3: DDDDD ------^---^---^---^---^
>
>Since the stride of the receive type is indicated
>in multpiles of its mpi_type, no interleaving is
>possible (the smallest striping factor leads to
>AAAAABBBBBBCCCCCDDDDD).
>
>Is there a way to achieve this behaviour in an
>elegant way, as MPI_Gather promises it? Or do
>I need to do Send/Recv with self-aligned offsets?

You should be able to do this with MPI_Gather by creating a new datatype on 
the receiving process whose extent is the size of a single item; that will 
get you the correct offset for the first element.  In order to receive the 
subsequent elements into the desired location, you need to use a vector 
type containing the number of elements.  And for this to be fast, you need 
an MPI implementation that will handle the "resized" datatype efficiently 
(use MPI_Type_vector to create the full datatype and 
MPI_Type_create_resized to change its effective extent).  If you are moving 
large amounts of data, separate send/recvs are probably a better choice.

Bill


>Thank you for your help!
>
>  Michael
>
>_______________________________________________
>Beowulf mailing list, Beowulf at beowulf.org
>To change your subscription (digest mode or unsubscribe) visit 
>http://www.beowulf.org/mailman/listinfo/beowulf

William Gropp
http://www.mcs.anl.gov/~gropp 




More information about the Beowulf mailing list