[MPI3 Fortran] Notes from conf call on MPI function symbol naming convention for tools

Rasmussen, Craig E rasmussn at lanl.gov
Thu Jul 7 11:48:35 CDT 2011


Yesterday we had a conference call on the symbol naming convention for PMPI usage and tools.  There are two proposals on the table that we need to discuss and I'd ultimately like to take a straw vote on.  I'll try to present the two alternatives along with pros and cons for each choice.  For each choice I'll show portions of the interface declaration.

Alternative 1:

   interface MPI_Send
      subroutine MPI_Send_f08(...) BIND(C,name="mpi_send_f08")
         use mpi_f08
         ...
      end subroutine
   end interface

Synopsis: This method provides a well-known and fixed binding name.

Pros:  This method provides a well-known and fixed binding name.  Thus C and Fortran PMPI and tools implementors will have a fixed C name (and thus symbol) to bind to.

Cons: This method won't work for all compilers until they implement the interop TR.  The reason is that compilers will reject the TYPE(*), DIMENSION(..) syntax as well as character strings in a BIND(C) procedure.  However, it turns out most compilers support this interface using some kind of IGNORE TKR compiler directive, though wrapper functions for character strings would have to be used until the TR is implemented.

This choice will force Fortran users of PMPI to use the BIND attribute and C name.


Alternative 2:

   interface 
      subroutine MPI_Send_f08(...)
         use mpi_f08
         ...
      end subroutine
   end interface

Synopsis:  This method has no C binding.

Pros: It can be implemented now with existing compilers.  Fortran users of PMPI don't have to use the BIND attribute and get the C name correct.

Cons: It forces MPI vendors to use non-standard binding names.  However, they (and tools people) have been doing this for years so this is a solved problem if not very elegant.  The biggest problem with this that when the TR is implemented, the BIND attribute will have to be used so that descriptors will be passed to the implementing routine.  The Fortran PMPI users will now have to start using the BIND attribute and the C binding label will be non-standard.  For example:

    subroutine MPI_Send_f08(...) BIND(C, name="mpi_send_f08__)

Note the trailing underscores.  So not only will Fortran PMPI users have to add the BIND attribute at sometime in the future, they will have to do it is a non-portable way.  For some compilers they will use the BIND attribute, for others not and the binding label will almost always be different.


I suppose there is a third alternative:

The standard would specify alternative 1, but allow implementors the option of providing wrapper functions (as in alternative 2) that call a C function with an interface consistent with alternative 1 (in the interim until all compilers implement the Interop TR).

-craig



More information about the mpiwg-fortran mailing list