Advice to users.
All the material in this section is an advice to users.
( End of advice to users.)
A coherence problem exists between variables kept in registers
and the memory value of these variables. An RMA call may access a
variable in memory (or cache), while the up-to-date value of this
variable is in register. A get will not return the latest variable
value, and a put may be overwritten when the register is stored back
in memory.
The problem is illustrated by the following code:
In this example, variable buff is allocated in the register reg_A and therefore ccc will have the old value of buff and not the new value 777.
This problem, which also afflicts in some cases send/receive communication, is discussed more at length in Section A Problem with Register Optimization .
MPI implementations will avoid this problem for standard conforming C programs. Many Fortran compilers will avoid this problem, without disabling compiler optimizations. However, in order to avoid register coherence problems in a completely portable manner, users should restrict their use of RMA windows to variables stored in COMMON blocks, or to variables that were declared VOLATILE (while VOLATILE is not a standard Fortran declaration, it is supported by many Fortran compilers). Details and an additional solution are discussed in Section A Problem with Register Optimization , ``A Problem with Register Optimization,'' on page A Problem with Register Optimization . See also, ``Problems Due to Data Copying and Sequence Association,'' on page Problems Due to Data Copying and Sequence Association , for additional Fortran problems.