Reputation: 717
I'm using MPI_Scatterv to scatter a very large array:
MPI_Scatterv(list, counts, displacements, MPI_LONG, pSubList, counts[rank], MPI_LONG, MASTER, MPI_COMM_WORLD);
and I've declared the variables counts and displacements as long (the int type is not enough), however, the MPI_Scatterv only accepts int variables for counts and displacements.
Any idea on how can I somehow solve this?
Upvotes: 2
Views: 782
Reputation: 74385
You can't substitute long for int, at least not in most MPI 2.2 implementations. Even if you create a user defined datatype as advised by Greg, you might (and mostly will) run into implementation limitations like using integer to represent offsets internally. The MPI 3.0 draft has specifically addressed this issue and requires that offset and count parameters be of long (64-bit) type in both C and Fortran bindings.
Until MPI 3.0 becomes standard and conformant implementations are out I would stick with some subcommunication scheme like distributing the data in several rounds with multiple scatters to subsets of ranks.
Upvotes: 2
Reputation: 4671
You could create a custom MPI datatype to represent a block of LONGs. Displacements and counts would then be multiples of that block size.
Upvotes: 0
Reputation: 3307
why not distribute your scatters as well so that int type will be enough ?
You can consider MPI processes running as the nodes of a Tree. And have the intermediate Tree Nodes have their own scatter/gathers of the corresponding sub-Trees.
Upvotes: 1