I'm trying to recombine sub-arrays without the dark-grey rows with MPI_Gatherv
. Picture's worth a thousand words:
How would you send only parts of *sendbuf
(the first parameter in MPI_Gatherv manual) to the root process (without a wasteful rewriting in another structure, this time without the dark-grey rows)? The *displacements
(the 4th parameter) is only relevant to the *recvbuf
of the root process.
Thank you.
Update (or, being more precise)
I wanted to also send the "boundary" (light-grey) cells ... not just the "interior" (white) cells. As osgx correctly pointed out: in this case the MPI_Gatherv
suffices ... some conditional array indexing will do it.
What about constructing a datatype, which will allow you to send only white (Interior) cells?
The combined (derived) datatype can be a
MPI_Type_indexed
.The only problem will be with very first line and very last line in processes P0 and PN, because P1 and PN should send more data then P2....PN-1
For Interior+Boundary you can construct datatype of single "line" with
Then (for ARRAY sized [I][J] splitted for
stripecount
stripes )