[MPI3 Fortran] Fortran extra_state argument to MPIattributefunctions

Jeff Squyres jsquyres at cisco.com
Thu May 28 15:19:36 CDT 2009

On May 28, 2009, at 2:03 PM, Aleksandar Donev wrote:

> But the point here is to find something for MPI. In most MPI codes,  
> I am
> sure people will not check the integer handles and in fact simply do
> illegal things like Jeff mentioned: pass the first element of an array
> and that way later refer to the whole array. Also, the C interface
> already uses void*, and trying to do "better" than that seems  
> pointless.
> I though the decision was not to "modernize" the MPI interface but
> rather try to emulate the C interface as closely as possible.

I wish it were this clear.  :-)

1. The (void*) extra_state/cookie/whatever_you_want_to_call it  
mechanism is very widely used in C in a large number of interfaces --  
MPI was just re-using a very popular mechanism there (in C).

2. The *intent* for the Fortran callback is to provide whatever is  
natural for Fortran programmers to effect some kind of handle/token/ 
whatever_you_want_to_call_it functionality.  It does not have to  
mirror the C interface; it should mirror the intent from the language  
neutral bindings.  This is in the scope of MPI-3, so changing the  
prototype of both MPI_COMM_CREATE_KEYVAL and the associated callback  
routines is permissible.  If a "more modern" prototype is the Right  
way to go (and is readily available in most/all existing Fortran  
compilers), then great.  If something like C_PTR/C_LOC is a better  
compromise, then so be it.  I guess this really comes down to the MPI  
community asking the Fortran community: what is the Right Thing to do  
here / what does the Fortran community want to effect this intent?

Does that make sense?

Jeff Squyres
Cisco Systems

More information about the mpiwg-fortran mailing list