[MPI3 Fortran] [Mpi-comments] MPI 3.0: Fortran 2008 interface - issue with the LOGICAL kind

Craig Rasmussen rasmus at cas.uoregon.edu
Thu Mar 21 10:26:02 CDT 2013

On Mar 20, 2013, at 10:09 AM, Rolf Rabenseifner wrote:

> This mail contains a proposal how we can solve the current 
> Fortran problems and possibly making the tools people also happy. 
> Implications and proposal:
> - We should rewrite the linker names section MPI-3.0 17.1.5
>   with following goals:
>    - Allow additionally to define that the PMPI is provided 
>      only on the MPI C interface and the Fortran MPI routines 
>      internally call the C interface;

I talked with Martin yesterday and he would be happy to have the requirement in the standard that the Fortran wrappers MUST call the MPI C interface.  This would much simplify things for the tools community.  (I had earlier thought he would object to this solution.)

Rolf, I'm not sure what you mean by additionally.  It seems to me the easiest solution is to drop BIND(C) entirely from the MPI-3 use_mpi_f08 API entirely.  This would make things much simpler for both the MPI implementations and the tools community.  There would mean that the PMPI Fortran routines can go away.

The objection to this proposal will like come from vendors who implement MPI routines in Fortran for performance.  These implementations would require a Fortran wrapper that makes a call to the C interface via BIND(C).  Note that this C interface can still be written in Fortran using BIND(C).

In addition, as Bill points out, this is not necessarily a performance problem because the compiler could inline the wrapper call.

>      again, a macro definition in mpi.h tells whether this
>      is chosen.
>      Question: Would this cause a problem when linking a 
>      C or Fortran user application with some own 
>      MPI_Test etc. profiling routines that internally call 
>      PMPI_Test?

It would mean that a Fortran user would have to implement their own MPI_Test routine in C or in Fortran using BIND(C).  However, this would require some sophistication on the part of the Fortran programmer.

>    - If Fortran profiling is done through the MPI C binding
>      then there are no rules about the Fortran linker names
>      needed, and therefore, one may put the thin Fortran
>      wrappers into a Fortran module. 
>    - We can define BIND(C) for MPI routine groups as a 
>      future option that is currently not used.
>      This would reduce the current effort for the tools people.
>      Is there anybody who wants to implement one of the Fortran 
>      routine groups with BIND(C)?
> I would expect, that this is the best to solve the problem
> that #364 prohibits BIND(C) for some routines and implementors
> want to do the same method for all routines.

I suppose the _f08 linker names can't go away for now but presumably later (MPI 4?) they could go away?

> Don't forget that BIND(C) and TR29113 is still important
> for implementing these thin wrappers internally.
> Without using BIND(C) on the official mpi_f08 and mpi module
> interface, some features of TR29113 are not used:
>  - the extension for interoperabple CHARACTER(LEN=*),
>  - the extension for OPTIONAL dummy arguments.
> Other TR29113 features are heavily used:
> - The DIMENSION(..), TYPE(*) is needed for some internal
>   C-written MPI_Isend_desc.
> - The ASYNCHRONOUS usage for communication buffers.
> Should we go in this direction?

If we can get agreement with the tools community  (Martin said he will poll them) I believe this is the best way to go.  It is a path that leads eventually to a much smaller and cleaner Fortran MPI implementation.

I think we also need agreement from the MPI vendors with purely Fortran implementation for any of the MPI functions.


More information about the mpiwg-fortran mailing list