[MPIWG Fortran] Question on Fortran binding errata

Jeff Squyres (jsquyres) jsquyres at cisco.com
Wed Feb 12 16:28:24 CST 2014


There's deep Fortran voodoo here.  :-)

The short version is that Fortran overloads functions sorta similar to C++, but with a different mechanism.  So you can:

    call foo(integer_value)
and
    call foo(floating_value)

and have it call 2 different back-end subroutines, just like C++.  The way this is done in fortran is with interfaces.  Something like this:

interface foo
   subroutine foo_integer(a)
       integer :: a
   end subroutine foo_integer

   subroutine foo_real(a)
       real :: a
   end subroutine foo_real
end interface foo

So you've declared one interface -- foo -- but with 2 different subroutine implementations -- foo_integer and foo_real (note that the above is a *declaration*, it is not an *implementation*).  You can then go implement foo_integer and foo_real, and the compiler will take care of figuring out which actual subroutine to invoke when an application invokes "call foo(x)".

The "specific procedure name" refers to the "inner" names (e.g., foo_integer and foo_real, in this example).  As Craig said, because of the MPI profiling layer, we mandated specific forms of specific procedure names.  Otherwise, 3rd party tools wouldn't be able to intercept calls via the MPI profiling mechanism (because the actual/back-end symbol for any given procedure would be unknown / implementation-specific).

Make sense?


On Feb 12, 2014, at 5:02 PM, Craig Rasmussen <rasmus at cas.uoregon.edu> wrote:

> We realized after working on MPI-3 for awhile that we would need Fortran wrappers and couldn't really call C routines directly.  One of the reasons is that the MPI C routines return a function value and most of the Fortran bindings are subroutines without a return value.  The language you refer to is a requirement on the implementer as to what the name of the wrapper routine is.
> 
> For example, if the user calls MPI_Isend and uses the MPI_F08 module, then the wrapper routine shall (must) be called MPI_Isend_f08.  Another requirement we have placed on implementors is that the wrapper name can't be hidden within a module so that Fortran module name mangling won't be done for the MPI_Isend_f08 routine.
> 
> Craig Rasmussen
> CAS Scientific Programmer
> rasmus at cas.uoregon.edu
> 
> 
> 
> 
> On Feb 12, 2014, at 1:28 PM, Junchao Zhang wrote:
> 
>> Hello, 
>>   On page 10, line 38 of the errata, http://www.mpi-forum.org/docs/mpi-3.0/errata-30.pdf, it reads
>> 
>> A Fortran call to an MPI routine shall result in a call to a procedure with one of the
>> specific procedure names and calling conventions, as described in Table 1.1 on page 11.
>> Case is not significant in the names.
>> 
>>    Can someone explain it a little more, especially, what is the meaning of "specific procedure names"?
>>    Thank you.
>> 
>> --Junchao Zhang
>> _______________________________________________
>> mpiwg-fortran mailing list
>> mpiwg-fortran at lists.mpi-forum.org
>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran
> 
> _______________________________________________
> mpiwg-fortran mailing list
> mpiwg-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran


-- 
Jeff Squyres
jsquyres at cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/




More information about the mpiwg-fortran mailing list