(j3.2006) Section from MPI-2 standard on VOLATILE
Wed May 28 12:49:47 EDT 2008
Dan, Bill, and others:
Please look at Section 10.2.2 "Problems With Fortran Bindings for MPI"
in the MPI-2 report, which focuses on problems with Fortran 90+ and MPI
(the MPI Forum is misguided that such problems do not exist in Fortran
77, it is just that they become more pronounced with the addition of new
features in F90). The PDF is readily available on-line. Focus on the
section on Register Optimization, although all of it is good reading if
only for the reason that J3 should help them re-write this section for
MPI-3 to accurately reflect our standard. And also because it talks
about problems with strong typing (our TYPE(*) task).
Note in particular this piece:
"MPI WAIT on a concurrent thread modifies buf between the invocation of
and the finish of MPI WAIT. But the compiler cannot see any possibility
that buf can be
changed after MPI IRECV has returned, and may schedule the load of buf
earlier than typed
in the source. It has no reason to avoid using a register to hold buf
across the call to
MPI WAIT. It also may reorder the instructions as in the case on the right.
To prevent instruction reordering or the allocation of a buffer in a
register there are
two possibilities in portable Fortran code:"
and to answer Bill and Dan:
"In the longer term, the attribute VOLATILE is under consideration for
Fortran 2000 and
would give the buffer or variable the properties needed, but it would
of any code containing the buffer or variable."
This is where I got what I said, so instead of me arguing with Dan he
can argue with the MPI Forum :-)
More information about the J3