|INOUT win||window object (handle)|
int MPI_Win_free(MPI_Win *win)
TYPE(MPI_Win), INTENT(INOUT) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
INTEGER WIN, IERROR
Frees the window object win and returns a null handle (equal to MPI_WIN_NULL). This is a collective call executed by all processes in the group associated with win. MPI_WIN_FREE(win) can be invoked by a process only after it has completed its involvement in RMA communications on window win: e.g., the process has called MPI_WIN_FENCE, or called MPI_WIN_WAIT to match a previous call to MPI_WIN_POST or called MPI_WIN_COMPLETE to match a previous call to MPI_WIN_START or called MPI_WIN_UNLOCK to match a previous call to MPI_WIN_LOCK. The memory associated with windows created by a call to MPI_WIN_CREATE may be freed after the call returns. If the window was created with MPI_WIN_ALLOCATE, MPI_WIN_FREE will free the window memory that was allocated in MPI_WIN_ALLOCATE. If the window was created with MPI_WIN_ALLOCATE_SHARED, MPI_WIN_FREE will free the window memory that was allocated in MPI_WIN_ALLOCATE_SHARED.
Freeing a window that was created with a call to MPI_WIN_CREATE_DYNAMIC detaches all associated memory; i.e., it has the same effect as if all attached memory was detached by calls to MPI_WIN_DETACH.
Advice to implementors.
MPI_WIN_FREE requires a barrier synchronization: no process
can return from free until all processes in the group of win
call free. This ensures that no process will attempt to access a
remote window (e.g., with lock/unlock) after it was freed. The
only exception to this rule is when the user sets the
no_locks info key to
true when creating the window. In that case, an MPI implementation may
free the local window without barrier synchronization.
( End of advice to implementors.)