Scroll to navigation

MPI_F_SYNC_REG(3) Open MPI MPI_F_SYNC_REG(3)

NAME

MPI_F_sync_reg - Prevent invalid register optimization of a Fortran buffer

MPI_F_sync_reg — Prevent invalid register optimization of a Fortran buffer

SYNTAX

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_F_SYNC_REG(BUF)

<type> BUF(*)


Fortran 2008 Syntax

USE mpi_f08
MPI_F_sync_reg(buf)

TYPE(*), DIMENSION(..), ASYNCHRONOUS :: buf


INPUT/OUTPUT PARAMETERS

•
buf: Initial address of the buffer (choice).

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.

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 <#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:

•
MPI_Wait <#mpi-wait>



Author

The Open MPI community

Copyright

2003-2026, The Open MPI Community

October 13, 2026