mpi-forum/mpi-issues

remove incorrect rationale about pass by reference in reduce callbacks

Opened this issue · 0 comments

Problem

In Section 6.9, we have contradictory rationale/advice to users. In the rationale, we say that len and type are passed to user-defined reduce callbacks by reference in C for compatibility with Fortran. However, we later say that the reduce functions are invoked with language-specific calling conventions for the datatype handle, since those are not guaranteed to be compatible between C and Fortran.

Rationale. The len argument allows MPI_REDUCE to avoid calling the function for each element in the input buffer. Rather, the system can choose to apply the function to chunks of input. In C, it is passed in as a reference for reasons of compatibility with Fortran.

The Fortran version of MPI_REDUCE will invoke a user-defined reduce function using the Fortran calling conventions and will pass a Fortran-type datatype argument; the C version will use C calling convention and the C representation of a datatype handle. Users who plan to mix languages should define their reduction functions accordingly. (End of advice to users.)

The only logic I can see for this text is that someone assumed the MPICH design where datatype handles are integers in C and that Fortran INTEGER was not larger then C int.

Proposal

In C, it is passed in as a reference for reasons of compatibility with Fortran.

should be removed, because there really isn't a good reason for C to pass by reference.

We should also redo reduction callbacks altogether, which is part of the plan for a future release of the standard.

Changes to the Text

TBD

Impact on Implementations

The text change has no impact.

Impact on Users

The text is more correct.

References and Pull Requests