mpi-forum / mpi-issues

Tickets for the MPI Forum
http://www.mpi-forum.org/
67 stars 8 forks source link

Should OUT status of receive buffers in collectives be INOUT due to MPI_IN_PLACE ? #701

Open jaegerj opened 1 year ago

jaegerj commented 1 year ago

Problem

This issue was raised several times while reading the 4.0-RC document in 2020.

Collectives specify receive buffers as OUT, however, if MPI_IN_PLACE is used it becomes INOUT (section 6.2.1, especially page 186 line 46). Should this be taken care of in the bindings?

Some complementary information: The MPI_IN_PLACE possible INOUT status was already mentioned and singled out for the Fortran case in the MPI Standard. I feel like if the MPI Forum wanted it to be INOUT in the LIS, it would have been done when the Fortan case was handled.

I chose to isolate this remark in a separate issue for the MPI Forum to debate/decide and have a trace of the decision on the github.

References and Pull Requests

This issue was singled out from https://github.com/mpi-forum/mpi-issues/issues/341

RolfRabenseifner commented 1 year ago

I expect that the answer is very easy, especially when looking at Fortran:

The argument is an OUT argument if a buffer address is passed. If the special buffer address MPI_IN_PLACE is passed, then the argument is neither IN nor OUT.

Therefore it is never an IN argument, i.e., data is never passed to this receive buffer.

Therefore, this issue may be closed.

But another question may be needed: If, e.g., in MPI_ALLGATHER, MPI_IN_PLACE is passed to the send buffer, then the own location in the receive buffer is treated as input and sent to all other processes. Note that this problem does not exist in MPI_GATHER. I.e., the type of the recieve buffer depends on the address passed as send buffer (again, not data values!).