[MPI3 Fortran] MPI non-blocking transfer

Aleksandar Donev donev1 at llnl.gov
Tue Feb 10 00:06:22 CST 2009


Hi,

> I do not understand, why the DD trick should not work together
> in the cases of
>  MPI_Isend + MPI_Wait + DD (to prohibit overwriting before MPI_Wait)
I do not wish to rehash all the previous Fortran committee discussions, 
but, let me give the simplest, albeit contrived, example. The Fortran 
standard is designed so as to permit the compiler great freedom in 
optimization, for example, by giving the compiler the freedom to assume 
that a variable does not get modified behind its back. The permitted 
"optimizations" (code transformations) include, among other things, 
perfectly useless/harmless code motion:

call MPI_Isend(buffer,...)
...
call DD(buffer)

the compiler *may* transform into intermediate code that does:

call MPI_Isend(buffer,...)
...
temp=buffer(1)
buffer(1)=temp
...
call DD(buffer)

which will be broken since during the silly temp motion buffer(1) may 
change and then be overwritten.

This is a silly example, but the point here is that there exist 
transformations that are rare, but allowed, and can cause parts of 
buffer to be copied to temporary storage and then back, overwritting 
what MPI is putting there. The only way to *properly* prevent that is to 
tell the compiler what is going on, rather than trying to *trick* it.

Best,
Aleks

-- 
Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ LLNL
High Performance Computational Materials Science and Chemistry
E-mail: donev1 at llnl.gov
Phone: (925) 424-6816  Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cherrypit.princeton.edu/donev



More information about the mpiwg-fortran mailing list