[MPI3 Fortran] [Mpi-comments] MPI 3.0:Fortran 2008 interface - issue with the LOGICAL kind
longb at cray.com
Sat Mar 16 23:17:35 CDT 2013
On 3/15/13 7:46 PM, Craig Rasmussen wrote:
> On Mar 15, 2013, at 3:30 PM, Bill Long wrote:
>> Hi Craig,
>> There were many follow-up messages in this thread....
>> On 3/15/13 12:16 PM, Craig Rasmussen wrote:
>>> On Mar 10, 2013, at 10:18 PM, Schulz, Martin wrote:
>>>> Hi all,
>>>> I am trying to catch up with the various threads on this (sorry, last week was hectic and I didn't get to all emails). I have to admit that I am still confused why there is a problem, but we can clarify this during a phone call or during the march meeting. However, doesn't not doing BINDC create a problem, since I now have to again deal with the no/one/two underscore issue? This sounds like a bad interface design to me, especially when we starting mixing things.
>>> Yes, I believe that removing BIND(C) entirely makes it virtually impossible for the tools community. Not only is there the underscore issue but some implementors want to put the code in modules which makes name mangling MUCH worse.
>> I would prefer that the tools people ignore the Fortran wrappers completely and instead only target the underlying C functions in the MPI library. If a library function is entirely replaced by a Fortran routine, then that routine requires a BIND(C) specifying the C name. Otherwise, BIND(C) would not be needed for the wrappers. This scheme seems to circumvent all of the recent problems, and also make life much simpler for the tools people who only need to look at the C functions. It also avoids the problem of aggressively optimizing compilers inlining and eliminating the wrappers (which would then be unavailable for the tools). I would think that forcing users to throttle back compiler optimization just to get the tools to work would be counterproductive.
> We had several discussions about this a year or so ago. I agreed with you. But for reasons I don't fully understand, this wasn't deemed sufficient. A couple of issues that need to be considered are:
> 1. A vendor is allowed to implement the standard purely in Fortran. There is at least one major compiler vendor that implements a portion of the MPI routines in Fortran for performance.
If you implement the worker routine in Fortran then that will require
BIND(C) since it will need the correct C interface and name so that C
users can call it. For those cases, BIND(C) is definitely required. And
you will need to provide the PMPI interface, unless the routine is so
trivial that the tools would be uninterested. I'm assuming that is not
the case for you example since the goal was performance.
> 2. Martin has stated that the tools community wants control at the earliest opportunity. Thus they want control at the wrapper level. I really don't understand this but so it is.
I think some subsequent emails a least partially clarified this.
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