I'm working on a project which contains several slave nodes and one master node. At some point I need to gather data from different slave nodes(master node can be treated as a slave node too) to master node. The data can be any type but let's suppose it is unsigned int. And that is how the data looks on slave nodes:
node0: |chunk01|chunk02|chunk03|chunk04|....
node1: |chunk11|chunk12|chunk13|chunk14|....
...
noden: |chunkn1|chunkn2|chunkn3|chunkn4|....
The data should be all gathered to node0 and look like this:
node0: |chunk01|chunk11|chunk21|....|chunkn1|chunk02|chunk12|...|chunkn2|...|chunknm|
Which means we concatenate the first chunk from each node together, then second chunk from each node together...
I don't know how to use MPI_Gatherv to implement this because each chunkij has different size, also each node only knows its own chunk size and start index, but not other node's info.
I'm not so familiar with MPI so I'm wondering is there any API which can gather data of different size from various nodes to one node?
MPI_Gatherw
... – Hristo Iliev