[MPIWG Fortran] Provide Fortran datatypes if Fortran bindings not provided?

Bill Long longb at cray.com
Thu Feb 18 10:50:45 CST 2016

On Feb 18, 2016, at 9:10 AM, Jeff Hammond <jeff.science at gmail.com> wrote:

> Alternatively, the Fortran processes can use ISO_C_BINDING and convert to C datatypes before sending.  Since we have standardized the use of Fortran 2008 in MPI-3, there is absolutely no reason why this should not be the recommended practice, because it is completely reliable and well-defined.

I was tempted to go this direction in my initial reply, but resisted.  However, with Jeff opening the door….

I think the long term solution is to put thin Fortran wrappers in the mpi_f08 and mpi modules, which use the C interoperability in Fortran to call directly the C library routines.  Eliminate mpif.h,  the C-written wrappers designed to be called by “legacy” Fortran, and the Fortran tools interface.   This has the advantages of 

(1) The tools developers only have to worry about the C interface, 
(2) Execution overhead in the call chain is reduced, 
(3) The MPI spec is simplified, 
(4) Maintenance of implementations is simplified, and 
(5) We can finally admit that MPI is a C library.

The interoperability features in Fortran were designed to allow Fortran procedures to call C library routines directly.  We can hide this in the modules so that current codes do not have to be rewritten.  

Of course, this is not a new suggestion (at least from me), but it seems worth posting a reminder when a relevant issue comes up.


Bill Long                                                                       longb at cray.com
Fortran Technical Support  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

More information about the mpiwg-fortran mailing list