mpi-forum / mpi-issues

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

redo callbacks to support third-party languages #839

Open jeffhammond opened 8 months ago

jeffhammond commented 8 months ago

Problem

This issue will be rewritten with more detail later...

From @dalcinl:

All the MPI parts that involve user-defined state and callbacks have to be revisited, with the exception of generalized request that already does the right thing. Within generalized requests, the standard is quite clear that the free_fn callback is invoked only once. Makes total sense! The free_fn is a destructor routine for a user-defined context! In the case of attributes, a similar logic should be followed. An attribute delete callback is a destructor for the attribute value, destruction should be its only purpose, and it should be called only once by the MPI library. A consequence of this rule is that if an attribute delete callback fails, you have to consider the attribute value irremediably lost, remove any reference to it form the attribute list, and report the error back to the caller.

Proposal

We need every type of callback to have void * extra_state so that third-party languages and middleware can use it without having to do annoying workarounds like Mukautuva.

Changes to the Text

TODO

Impact on Implementations

Tedious work to implement new API functions and callback signatures.

Impact on Users

Third-party language support and middleware developers and Lisandro and I will be happier.

References and Pull Requests

https://github.com/pmodels/mpich/pull/6935#issuecomment-1985229607

https://github.com/jeffhammond/mukautuva/blob/main/README.md#translation-of-callbacks