[MPI3 Fortran] Proposing changes to Fortran 2008

Lionel, Steve steve.lionel at intel.com
Sun Mar 16 15:04:29 CDT 2008


Jeff Squyres wrote:

> I admit that I know so little about Fortran that much of your mail  
> went over my head.  :-(  But a question about the above: is it  
> possible to allow non-contiguous datatypes to be passed through  
> without having the compiler copy them into contiguous areas?  It may  
> be possible, for example, for the MPI datatype to accurately describe

> the non-contiguousness of the data, and MPI is well-equipped to handle

> such situations.

It is possible - but to do so in a standard-conforming way requires that
the called routine be coded in Fortran.  There is a proposal in front of
the Fortran standards committee to enhance C interop to provide some
standard way for C code to obtain the stride information.  At present,
there's not even a way for a Fortran routine to get this (the compiled
code knows but there's no intrinsic to get that information.)  

The way this is done is for the explicit interface to declare the array
as "assumed shape", for example A(:).  The colon, in the absence of
lower and upper bounds, tells the compiler to pass information regarding
rank, size and stride.  If the called routine has an assumed-shape dummy
argument, the language requires that an explicit interface be visible to
the caller.

Amusingly, the called routine does NOT know the lower bound - if you
pass an array declared as 2:5 it is received as 1:4 - a fact that trips
up Fortran programmers all too frequently.

Steve Lionel
Intel




More information about the mpiwg-fortran mailing list