17.2.115. MPI_F_sync_reg
MPI_F_sync_reg — Prevent invalid register optimization of a Fortran buffer
17.2.115.1. INPUT/OUTPUT PARAMETERS
buf: Initial address of the buffer (choice).
17.2.115.2. DESCRIPTION
MPI_F_sync_reg has no executable statements; it exists only to prevent a Fortran compiler from making invalid assumptions about the contents of a buffer across an operation that the compiler cannot see. Passing buf to this routine forces the compiler, when necessary, to flush a cached register copy of the buffer back to memory, or to invalidate a cached register copy so that the buffer is reloaded from memory on its next use.
This is needed in Fortran code that aggressively optimizes register usage around nonblocking or one-sided operations, whose completion — and therefore whose effect on the buffer — is not visible to the compiler from the surrounding code.
17.2.115.3. NOTES
This routine is provided only in the Fortran bindings; it has no C binding because it would serve no purpose in C. It also has no ierror argument because there is no operation that can fail.
For example, after an MPI_Wait that completes a nonblocking receive
into buf, a call to MPI_F_sync_reg(buf) ensures that the compiler
reloads buf from memory rather than reusing a stale register copy that
predates the receive.
See also