[Mpi3-tools] Issues with Fortran bindings for MPI_Pcontrol

Schulz, Martin schulz6 at llnl.gov
Sun Apr 14 15:40:43 CDT 2013

Hi all,

I am sending this to both the Fortran list and the tools list, since this affects both (sorry if some of you get this twice).

The MPI standard currently has some inconsistencies with respect to how the MPI_Pcontrol call is defined. The prototype in the tools chapter does not have the usual ierr return code (which is an historical artifact from the use of variable arguments up to MPI 2.2). In particular, it is now stated as:

MPI_Pcontrol(level) BIND(C)
   INTEGER, INTENT(IN) ::  level


This is, however, in contradiction to the text on page 19:

"All MPI Fortran subroutines have a return code in the last argument. With USE mpi_f08, this last argument is declared as OPTIONAL, except for user-defined callback func- tions (e.g., COMM_COPY_ATTR_FUNCTION) and their predefined callbacks (e.g., MPI_NULL_COPY_FN). A few MPI operations which are functions do not have the return code argument."

MPI_Pcontrol is not a function and hence shouldn't be covered by the last sentence.

We ran into this, when one developer added Pcontrol calls with ierr arguments, which led to a seg fault and then he pointed to the statement that all MPI routines require that argument.

We (Jeff S., Dave G., Bill, and I) had a brief discussion on this and it turns out that MPICH and Open MPI actually implement this differently: MPICH includes ierr (following the general rule) and Open MPI does not (following the specified prototype). This does cause problems for codes that are used on both implementations (as we had in our case that led to this discussion) and hence breaks portability.

The two options seem to be to either change the prototype or allow for exceptions to the general rule and there are obvious pros and cons for either option. That's why we thought it would be better to get both working  groups involved.

Any comments or other good ideas on how to fix this?


Martin Schulz, schulzm at llnl.gov, http://people.llnl.gov/schulzm
CASC @ Lawrence Livermore National Laboratory, Livermore, USA

More information about the mpiwg-tools mailing list