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

Rolf Rabenseifner rabenseifner at hlrs.de
Wed Mar 20 12:09:46 CDT 2013

This mail contains a proposal how we can solve the current 
Fortran problems and possibly making the tools people also happy. 

I need at least answers for
 - mpich (Bill Long),
 - OpenMPI (Jeff or Craig),
 - some tools people.

Let me summarize what I've learnt so far for mpi_f08:

 - #364 about LOGICAL correction is a must.
 - MPI-3.0 allows BIND(C) and non-BIND(C), with the
   new restrictions in #364
 - BIND(C) needs TR29113, therefore any implementation now
   should use non-BIND(C) for all non-TR29113 compilers. 
 - Most (or all) try to use the non-BIND(C) interface.
 - Best way to do this are thin wrappers in Fortran that
   internally call 
    - the oficial MPI-3.0 C binding
      (here, the tools people have a problem because they
       expect to wrap the Fortran interface and may therefore
       double-wrap), or
    - or an internal MPI-3.0 C routine
      (which is half-perfect for the tools folk, because
       they have to handle the implementation-dependant 
       Fortran names with underscores).
 - And at least Bill wants to include the Fortran MPI 
   library routines itselves in the mpi_f08 module.
   This is in conflict with the current MPI-3.0
   linker naming rules.

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;
      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 
    - 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.

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?

Best regards

----- Original Message -----
> From: "Bill Long" <longb at cray.com>
> To: "Jeff Squyres (jsquyres)" <jsquyres at cisco.com>
> Cc: "Martin Schulz" <schulzm at llnl.gov>, "MPI-3 Fortran working group" <mpi3-fortran at lists.mpi-forum.org>
> Sent: Wednesday, March 20, 2013 4:01:52 PM
> Subject: Re: [MPI3 Fortran] [Mpi-comments] MPI 3.0: Fortran 2008 interface - issue with the LOGICAL kind
> On 3/20/13 8:26 AM, Jeff Squyres (jsquyres) wrote:
> > On Mar 20, 2013, at 6:25 AM, Bill Long <longb at cray.com> wrote:
> >
> >> interface !--> MPI_Test
> >>
> >>    ! int MPI_Test(MPI_Request *request, int *flag, MPI_Status
> >>    *status);
> >>
> >>    Function MPI_Test_C( request, flag, status) &
> >>                BIND(C, name="MPI_Test") RESULT (res)
> >>      import :: C_request, c_int, MPI_Status_C
> >>      integer(C_request) :: request
> >
> > This is not correct. You cannot assume that MPI handles are integers
> > (they're pointers in Open MPI).
> This is correct for mpich. OpenMPI would evidently have a different
> version. But the concept is still the same - make a correct interface
> to the C library routine, however it is defined by the implementation,
> and then call that from a thin Fortran wrapper that takes care of the
> issues related to LOGICAL, the use of default INTEGER, and OPTIONAL
> arguments.
> Cheers,
> Bill
> >
> --
> 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
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran

Dr. Rolf Rabenseifner . . . . . . . . . .. email rabenseifner at hlrs.de
High Performance Computing Center (HLRS) . phone ++49(0)711/685-65530
University of Stuttgart . . . . . . . . .. fax ++49(0)711 / 685-65832
Head of Dpmt Parallel Computing . . . www.hlrs.de/people/rabenseifner
Nobelstr. 19, D-70550 Stuttgart, Germany . . . . (Office: Room 1.307)

More information about the mpiwg-fortran mailing list