[MPI3 Fortran] Fortran extra_state argument to MPIattributefunctions

Jeff Squyres jsquyres at cisco.com
Wed May 27 19:53:48 CDT 2009


I guess I should clarify here -- the intent for this parameter is not  
to be interoperable with C.  The intent is that a Fortran application  
can pass some meaningful value through this parameter in the call to  
MPI_COMM_CREATE_KEYVAL, and then later that same Fortran application  
can get the extra_value back and do something meaningful with it.

The fact that the MPI implementation is written in C should not really  
have any impact on the discussion.



On May 27, 2009, at 4:32 PM, Aleksandar Donev wrote:

> On Wednesday 27 May 2009 12:54, Jeff Squyres wrote:
>
> > > USE ISO_C_BINDING ! F03 intrinsic module
> > > TYPE(C_PTR), VALUE :: extra_state
> >
> > Is this effectively a neutral type
> I am not sure exactly what you mean: It is meant to be "interoperable"
> with void*, that is, have the same physical representation and follow
> the passing conventions.
>
> > -- such that a Fortran app can
> > pass   a reference/pointer/whatever to some larger structure through
> > this type in the call to MPI_COMM_CREATE_KEYVAL and then "cast" it
> > back to the right type in the callback function?
> Yes, this can be done inside Fortran, so long as that "datastructure"
> has the TARGET attribute (which it ought to anyway if you want to be
> able to save and restore pointers to it).
>
> In fact, it is part of the design of TYPE(C_PTR) to be usable
> as "handles" for interoperable callbacks (you cannot get this by
> reading the standard but since I proposed it I know ;-)
>
> The only downside, as I mentioned, that it uses Fortran 2003 features.
> But they are widely implemented, so I would encourage you to use them.
>
> Best,
> Aleks
>
> --
> Aleksandar Donev, Ph.D.
> Lawrence Postdoctoral Fellow @ Lawrence Livermore National Laboratory
> High Performance Computational Materials Science and Chemistry
> E-mail: donev1 at llnl.gov
> Phone: (925) 424-6816  Fax: (925) 423-0785
> Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
> Web: http://cims.nyu.edu/~donev/
>
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
>


-- 
Jeff Squyres
Cisco Systems




More information about the mpiwg-fortran mailing list