MPI_WIN_UNLOCK(3)
π MPI_Win_unlock π
okay so this is the Open MPI manual page for MPI_Win_unlock, aka MPI_WIN_UNLOCK(3) β yes bestie, we're doing RMA today, put your little MPI hat on π
π¦ NAME π¦
MPI_Win_unlock β closes out an RMA access epoch that you opened with a call to MPI_Win_lock.
like. it's the goodbye half of the lock/unlock situationship. periodt.
β¨ SYNTAX β¨
πΈ C Syntax πΈ
#include <mpi.h>
int MPI_Win_unlock(int rank, MPI_Win win)
πΈ Fortran Syntax πΈ
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_WIN_UNLOCK(RANK, WIN, IERROR)
INTEGER RANK, WIN, IERROR
πΈ Fortran 2008 Syntax πΈ
USE mpi_f08
MPI_Win_unlock(rank, win, ierror)
INTEGER, INTENT(IN) :: rank
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT PARAMETERS π
rankβ rank of the window. nonnegative integer, so keep it cute and keep it >= 0 πwinβ the window object (handle). the whole point of the operation, honestly.
π OUTPUT PARAMETER π
ierrorβ Fortran only: error status (integer).
π DESCRIPTION π
MPI_Win_unlock completes an RMA access epoch that was started by a call to MPI_Win_lock. and the way it does that is so thorough: any RMA operations you issued during that period will have completed both at the origin and at the target by the time this call returns. both sides. no loose ends. iconic β¨
so what are locks even for? locks protect accesses to the locked target window that were made by RMA calls issued between the lock and the unlock call, AND they protect local load/store accesses to a locked local window that you executed between the lock and the unlock call. yes, local load/store too, don't forget the local side bestie π«Ά
and here's the exclusivity tea:
- accesses protected by an exclusive lock will not be concurrent at the window site with other accesses to the same window that are lock protected
- accesses protected by a shared lock will not be concurrent at the window site with accesses protected by an exclusive lock to the same window
read that twice, it's giving subtle. π
π ERRORS π
almost all MPI routines return an error value, okay? C routines hand it back as the return result of the function, and Fortran routines put it in that last argument. classic.
before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. and if there's no communication object associated with the MPI call? then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. and when MPI_COMM_SELF is not initialized β meaning before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively β the error raises the initial error handler. you can change that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or with the mpi_initial_errhandler CLI argument to mpiexec, or with an info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. π
and if no other appropriate error handler has been set, then MPI_ERRORS_RETURN is called for MPI I/O functions and MPI_ERRORS_ABORT is called for all other MPI functions.
Open MPI ships three predefined error handlers you can use, and they are:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. like, everyone. gone. πMPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. When called on a communicator, it acts as ifMPI_Abortwas called on that communicator. If called on a window or file, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. If called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application, no drama, just a code π«Ά
MPI applications can also implement their own error handlers by calling:
MPI_Comm_create_errhandlerand thenMPI_Comm_set_errhandlerMPI_File_create_errhandlerand thenMPI_File_set_errhandlerMPI_Session_create_errhandlerand thenMPI_Session_set_errhandler, or atMPI_Session_initMPI_Win_create_errhandlerand thenMPI_Win_set_errhandler
β οΈ note that MPI does not guarantee that an MPI program can continue past an error. so like, plan accordingly bestie π
see the MPI man page for a full list of MPI error codes. and see the Error Handling section of the MPI-3.1 standard for more information.
and also, literally:
MPI_Win_lockMPI_Win_unlock_all
π Copyright π
2003-2026, The Open MPI Community
that's the whole page, bestie π this dropped Sep 10, 2026, it's the MPI_WIN_UNLOCK(3) page, and it lives under Open MPI. go close your access epochs responsibly, lock and unlock, always in pairs, iykyk π§β¨
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms