[MPI3 Fortran] [Interop-tr] [Mpi-forum] Comment on Fortran WG5 ballot N1846

N.M. Maclaren nmm1 at cam.ac.uk
Wed Apr 20 12:22:06 CDT 2011

On Apr 20 2011, Bill Long wrote:
>Having the buf variable in a module is an effective method of solving 
>the "code motion across the MPI_Wait call" problem.  And probably a good 
>recommended practice anyway.

Unfortunately not, on both counts.

Global optimisation (sometimes even at link time) is increasingly common,
not least because it is essential for even reasonable efficiency with C.
Such a compiler can tell that the MPI module makes no reference to the
data module, directly or indirectly.  Therefore, if the buffer does not
have the ASYNCHRONOUS or TARGET attributes, code accessing it may be
moved across the MPI_Wait.

Also, this approach assumes that the only use of MPI is directly
by the 'end users', and prevents libraries built on top of MPI from
using non-blocking transfers.  ScaLAPACK, FFTW, NAG and many others
would be affected.

>Craig also pointed out another reason for not including buf as an 
>argument to MPI_Wait.  He argued, correctly, that the call to MPI_Wait 
>could be in a different program unit from the call to the 
>MPI_I{send/recv} call and, as a result,  the name of buf might not be 
>visible at the point where MPI_Wait is called.    To me this is a 
>definitive argument against a proposal to require buf in the MPI_Wait call.



More information about the mpiwg-fortran mailing list