[Mpi-forum] MPI-3 Fortran implementation now available

Tobias Burnus burnus@net-b.de
Tue Feb 28 18:18:00 GMT 2012


On 02/28/2012 05:36 PM, Rasmussen, Craig E wrote:
> On Feb 28, 2012, at 5:50 AM, Richard Guenther wrote:
>
>> But wouldn't a vendor extension TYPE (*), __gfortran3_dimension (..) be
>> also ok that passes the existing descriptor?  The MPI implementation 
>> would
>> just need to know its specification?  [the '3' for the library SO 
>> version, which
>> I assume correlates with the descriptor "version"]
>>
>
> This would work fine.  It would be pretty easy to use configure magic 
> to substitute the existing gfortran descriptor for the standard one. 
>  The important thing is to _get_ the descriptor.  Current IGNORE_TKR 
> (and similar) compiler directives only pass the array address, not the 
> descriptor.

With my patch, you get for "TYPE(*), dimension(:)" the descriptor. [You 
still need one interface per rank as dimension(..) is not implemented. 
Furthermore, combining assumed-shape with bind(C) is not possible - you 
need to comment the check in decl.c, if you need it for playing.]

If you want to play around with the array descriptor, gfortran's current 
format is "documented" at
http://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgfortran/libgfortran.h;hb=HEAD#l321
Note: "stride" is really the stride [in units of sizeof(element)] and 
not a stride multiplier (with byte units). - Or use 
http://chasm-interop.sourceforge.net/

[The first version of gfortran's "dimension(..)" might use the current 
descriptor - but probably will reject its use with bind(C). But first 
type(*) and other things have to be implemented.]


On 02/28/2012 05:43 PM, Rasmussen, Craig E wrote:
> On Feb 28, 2012, at 7:40 AM, Tobias Burnus wrote:
>> Attached a patch of a rough and dirty implementation of TYPE(*). It 
>> should work, but it lacks several constraint checks - in particular 
>> for the actual argument and for the using assumed-type variables. 
>> There might be also issues with ambiguity checking for generic 
>> interfaces.
>>
>> If you compile GCC 4.7 yourself, you should be able to experiment 
>> with TYPE(*).
>
> Cool, time to play!

Feedback is welcome. Note that type(*) should also work with polymorphic 
arguments. And with BIND(C) expect a bogus warning.

It seems as if TYPE(*) will be one of the first new features for GCC 
4.8. However, the following is lacking and will take a while: Writing 
test cases and the implementation of:

"C407b An assumed-type variable name shall not appear in a designator or 
expression except as an actual argument corresponding to a dummy 
argument that is assumed-type, or as the first argument to any of the 
intrinsic and intrinsic module functions IS_CONTIGUOUS, LBOUND, PRESENT, 
RANK, SHAPE, SIZE, UBOUND, and C_LOC."

(Note to self: Fortran 2008's IS_CONTIGUOUS intrinsic is also still 
missing.)

Tobias



More information about the Fortran mailing list