I am having a problem using MPI_Scatterv
in a parallel program. Here is how it is defined :
int MPI_Scatterv(const void *sendbuf, const int *sendcounts,
const int *displs, MPI_Datatype sendtype, void *recvbuf,
int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
The way I understood it , the difference between MPI_Scatterv
and MPI_Scatter
is the fact that in MPI_Scatterv
segments do not have to be of the same length and they don't have to be continuous (gaps in memory are allowed). The part I do not understand is if the recvbuf
can be an array of different size for each process then what should be used for recvcount
. Let's say I want to send 5 elements of sendbuf to process 0 and 15 to process 1. What should the value of recvcount
be?