[MPI3 Fortran] Proposing changes to Fortran 2008

Aleksandar Donev donev1 at llnl.gov
Thu Mar 27 12:01:11 CDT 2008

On Thursday 27 March 2008 07:53, Hubert Ritzdorf wrote:

> This is what some vendors already implemented (using different names).
> When I remember (and understood)
> it correctly, you mentioned that they didn't it right.
They have not integrated it with the rest of the standard. You can do many 
things that apparently work fine until you try them with polymorphic 
assumed-shape arrays of a parameterized derived type (yes, Fortran has 
those). A standard has to be internally fully self-consistent...it cannot 
just say "oh, no one will do that, just make it work".

> Since the 
> behaviour should be well-defined if an
> interface description is not available and the vendors have to implement
> it, and it should be possible
> to specify it for a single argument.
The existing standard says the following about implicit interfaces. A 
routine's interface can be omitted, however, the interface exists and there 
is a *unique* interface (modulo some attributes that can be omitted). That 
is, an MPI_Send routine, which exists somewhere, according to the Fortran 
standard, has to either accept an integer buffer or a real buffer. It cannot 
accept both. There is a *unique* interface. If the interface is implicit, it 
is up to the user to ensure the actual arguments actually match the type/rank 
etc. of the dummy. If it is explicit, the compiler helps check it. That is 
the ONLY difference between implicit and explicit interfaces.

Now, compilers often allow users to violate the standard and call MPI_Send 
with both a real and an integer buffer array, and they either do not do any 
analysis to detect it, or if they do, they offer a compiler switch to 
say "close your eyes please". It is however, not conforming to the Fortran 
standard, period.

> There are 2 general problems for MPI with these copy-in/copy-out behaviour:
I understand the problems it causes with MPI. But, it also make a lot of 
wonderful things work in Fortran. You cannot remove it from Fortran just to 
accommodate MPI. Saying "don't do copy in/out" will only work if you specify, 
in details, what to do about situations where copy in/out is required. Should 
we disallow those situations (i.e., put rules like "the actual argument shall 
not be..."). Do some existing Fortran codes rely on copy in/out, for example:

CALL MPI_Send(my_array(1,:),...) ! Will copy column 1 into a contig buffer

Should we now make those programs non-conforming? I am not offering answers 
here, I am pointing out that explicit answers are required.


More information about the mpiwg-fortran mailing list