[MPI3 Fortran] Non-contiguous arrays (was Re: Argument data sizes)

Bill Long longb at cray.com
Thu Sep 18 12:43:08 CDT 2008



Iain Bason wrote:
>
> On Sep 18, 2008, at 1:13 PM, Jeff Squyres wrote:
>
>> How else would you do it efficiently for non-contiguous datatypes 
>> without a copy (which would be quite Bad for multiple reasons, 
>> especially for very large datasets)?  Such issues are certainly not 
>> unique to C (even in very large Fortran arrays, particularly if you 
>> want to send just a plane from the middle of a 3D array, or 
>> somesuch).  As another example of where datatypes are useful: with 
>> the Fortran equivalent of C structs, you need to build up a composed 
>> datatype to describe the message that you want to send/receive.
>
> Didn't this come up in another thread?  In Fortran, you can use 
> assumed shape arrays to pass these sorts of data without copying.  It 
> would be nice if MPI could take advantage of that in order to make 
> life easier for Fortran programmers.

The extensions being proposed for Fortran/C interoperability help with 
this.  The user can specify bind(c) on an interface with an 
assumed-shape argument. Or an assumed-rank argument, with the 
dimension(..) syntax. The argument gets passed as a descriptor (the 
address of the descriptor for the C folk) and the vendor supplies C 
library routines that let the C callee extract information from the 
descriptor about the described array, like base address, element size, 
rank, bounds/strides....  A C wrapper could decode this information and 
send/receive the data in as many contiguous chunks as required, all 
hidden from the Fortran user.

Cheers,
Bill

>
> Iain
>

-- 
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