Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a convenience feature for PMPI wrapper library writers, that allows them to have F77 language wrapping for free (something allowed but not required by the standard).
Eg if a wrapper library redefines
int MPI_Send(...args...) { ... record stuff... ; rv = PMPI_Send; return(rv); }
and a Fortran app calls mpi_send() it's possible to have the mpi_send() definition in fortran/mpif-h/send_f.c call MPI_Send which would resolve back out into the wrapper library.
A longer discussion about this feature is here:
#3954
The main argument against this is it's not required by the standard, and hence there's no good way for wrapper library writers to use this functionality: If they want to support all MPI vendors they can't rely on having access to the above. If they want to be complete, they have to write their own mpi_send() as well, and call either pmpi_send or PMPI_Send from it.
The argument for this feature is that pragmatically these C-only wrapper tools already exist, and customers try to use them with their Fortran apps, so it's a nice convenience feature to offer (and it's not random, it's an optional part of the standard).
This PR changes the fortran/mpif-h/send_f.c (etc) code from a direct PMPI_Send() call to a function pointer where the function pointer defaults to PMPI_Send(), and gives runtime control:
-mca mpi_fortcall PMPI : the default behavior (mpi_send calls PMPI_Send)
-mca mpi_fortcall MPI : make mpi_send call MPI_Send
The code's got an extra
#if OMPI_FORTRAN_USE_FPTR
that isn't being used right now, but is a stub for the idea of making this configurable. Eg if someone wanted no trace of the above changes and just wanted the original direct PMPI_Send() calls.