6

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?

Janaka Chathuranga
  • 1,742
  • 16
  • 19

1 Answers1

8

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.

Zulan
  • 21,896
  • 6
  • 49
  • 109
  • 1
    as an illustration, you can send one vector of 1000 MPI_DOUBLE (sendcount=1, sendtype=derived datatype), and receive 1000 MPI_DOUBLE (recvcount=1000, recvtype=MPI_DOUBLE). if you are using Open MPI, keep in mind that is use case is not correctly handled by the default coll/tuned collective module – Gilles Gouaillardet Jul 17 '17 at 03:49
  • You mean, if we are using different data types on send and receive calls, they can have different counts. Okay :) Thank you! – Janaka Chathuranga Jul 26 '17 at 11:32