[MPI3 Fortran] MPI buffer arguments - void and call-by-reference
Bill Long
longb at cray.com
Tue Feb 17 17:44:56 CST 2009
Jeff Squyres wrote:
> On Feb 17, 2009, at 3:08 PM, Craig Rasmussen wrote:
>
>> This means that actual argument associated with the dummy argument
>> buf, can be an array or scalar of any type. If it is an array, it
>> can have any rank. The major impact to the MPI implementation is
>> that the buf argument will be passed by descriptor.
>
> Two knee-jerk questions:
>
> 1. Is there a standard layout / struct / whatever for this
> descriptor? Or does it vary by compiler? (I really hope you answer
> "yes" to the first question...)
There are actually two descriptors. One is the Fortran descriptor; a
pointer to this is passed as the actual argument. The other is the C
descriptor. This is defined in a C header file and has a standardized
set of components. There is also a function with a standardized
interface that converts a Fortran descriptor into the equivalent C
descriptor.
>
> 2. Is the descriptor available via C, or only available via Fortran?
> (meaning: does the MPI wrapper function *have* to be written in
> Fortran? I really hope you answer "yes, it's available in C"...)
The C descriptor definition and the conversion function are available
only to C. So you would need to write the wrapper routines in C.
Some background: Fortran implementations already use descriptors to
pass assumed-shape, allocatable, and pointer arrays. The format of
these descriptors varies with vendor, and the internal structure of the
descriptors is hidden from the user. The goal here is to provide an
equivalent C descriptor that is exposed to the C programmer and has a
portable set of components and a portable conversion routine. The
conversion routine is supplied by the Fortran vendor and knows about the
internals of that vendor's Fortran descriptor.
Cheers,
Bill
>
>> I think using TYPE(*) and DIMENSION(..) is an excellent solution for
>> MPI 3.0. The advantages are:
>>
>> 1. Current user code won't have to change beyond using the MPI3 module.
>
>
> Remember that we wanted to make Fortran MPI handles just like C
> handles, so users will need to change that as well. It won't just be
> s/use mpi/use mpi3/g.
>
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
More information about the mpiwg-fortran
mailing list