I saw this on internet
MPI_Scatter takes an array of elements and distributes the elements in the order of process rank.
But I could not find it on the documentation.
I have an array and there are 4 processes. One process is root -> will scatter data among other 3 processes. The id-s are 0, 1, 2, 3.
Question: Will MPI_Scatter()
or MPI_Scatterv()
send the data in order, guaranteed?
Example 1:
0: [a, b, c, d, e]
// after scatter
1: [a, b]
2: [c, d]
3: [e]
Example 2:
0: [a, b]
// after scatter
1: [a]
2: [b]
3: [ ]
Also, does gather do the same thing? (preserve order)
MPI_Scatter()
scatter the data to all tasks including itself. In your case, you need theMPI_Scatterv()
variant since the send buffer size is not a multiple of the communicator size. - Gilles GouaillardetMPI_Scatterv()
send data in order of proc rank? - DonJoescatterv
or manualsend / recv
? (for similar examples to my question) - DonJoe