Search code examples
c++cmemorympimessage-passing

In MPI_Gather(), MPI_Scatter() what is the difference between send count and receive count?


In MPI gather and scatter there is two counts for send and receive. I checked the docs and found out that both should have the same value.

Ex:- In MPI_Gather() both send_count and receive_count should have the size of the send buffer size. https://www.mpich.org/static/docs/v3.1/www3/MPI_Gather.html

Can someone explain what is the purpose of this redundant parameters?


Solution

  • To some extent, you are allowed to use different types - but the total size needs to match.

    Or to be more precise, the standard explains:

    The type signature of sendcount, sendtype on each process must be equal to the type signature of recvcount, recvtype at the root. This implies that the amount of data sent must be equal to the amount of data received, pairwise between each process and the root. Distinct type maps between sender and receiver are still allowed.