13.5.1. Fence

PreviousUpNext
Up: Synchronization Calls Next: General Active Target Synchronization Previous: Synchronization Calls

MPI_WIN_FENCE(assert, win)
IN assertprogram assertion (integer)
IN winwindow object (handle)
C binding
int MPI_Win_fence(int assert, MPI_Win win)
Fortran 2008 binding
MPI_Win_fence(assert, win, ierror)

INTEGER, INTENT(IN) :: assert
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_WIN_FENCE(ASSERT, WIN, IERROR)

INTEGER ASSERT, WIN, IERROR

MPI_WIN_FENCE synchronizes RMA communication operations on win. The procedure is collective over the group of win. All RMA operations on win originating at a given origin process and started before the fence call will complete at that MPI process before the fence call returns. They will be completed at their target before the fence call returns at the target. Store accesses to shared-memory of win will become visible before the fence call returns at the target. RMA operations on win started by an origin process after the fence call returns will access their target window only after MPI_WIN_FENCE has been called by the target process.

The call closes an RMA access epoch if it was preceded by another fence call and the local MPI process initiated any RMA communication operations on win between these two calls. The call closes an RMA exposure epoch if it was preceded by another fence call and the local window was the target of RMA accesses between these two calls. The call opens an RMA access epoch if it is followed by another fence call and by RMA communication calls issued between these two fence calls. The call opens an exposure epoch if it is followed by another fence call and the local window is the target of RMA accesses between these two fence calls. Thus, the fence call is equivalent to calls to a subset of post, start, complete, wait.

A call to MPI_WIN_FENCE is usually synchronizing. However, a call to MPI_WIN_FENCE that is known not to close any epoch (in particular, a call with the MPI_MODE_NOPRECEDE assert set) is not necessarily synchronizing.

The assert argument is used to provide assertions on the context of the call that may be used for various optimizations. This is described in Section Assertions. A value of assert = 0 is always valid.


Advice to users.

Calls to MPI_WIN_FENCE should both precede and follow calls to RMA communication procedures that are synchronized with fence calls. ( End of advice to users.)


PreviousUpNext
Up: Synchronization Calls Next: General Active Target Synchronization Previous: Synchronization Calls


Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023