MPI_WIN_CREATE(3)

πŸ’– MPI_WIN_CREATE(3) πŸ’–

okay so this is the Open MPI page for MPI_Win_create, and bestie, it's a whole mood β€” it's the one-sided MPI call that hands you back a window object for RMA operations. let's get into it ✨


🌸 SYNTAX 🌸

✨ C Syntax ✨

#include <mpi.h>

MPI_Win_create(void *base, MPI_Aint size, int disp_unit,
     MPI_Info info, MPI_Comm comm, MPI_Win *win)

✨ Fortran Syntax ✨

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_WIN_CREATE(BASE, SIZE, DISP_UNIT, INFO, COMM, WIN, IERROR)
     <type> BASE(*)
     INTEGER(KIND=MPI_ADDRESS_KIND) SIZE
     INTEGER DISP_UNIT, INFO, COMM, WIN, IERROR

✨ Fortran 2008 Syntax ✨

USE mpi_f08
MPI_Win_create(base, size, disp_unit, info, comm, win, ierror)
     TYPE(*), DIMENSION(..), ASYNCHRONOUS :: base
     INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size
     INTEGER, INTENT(IN) :: disp_unit
     TYPE(MPI_Info), INTENT(IN) :: info
     TYPE(MPI_Comm), INTENT(IN) :: comm
     TYPE(MPI_Win), INTENT(OUT) :: win
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸŽ€ INPUT PARAMETERS πŸŽ€

  • base β€” the initial address of the window (a choice). where the memory actually lives πŸ’…
  • size β€” size of the window in bytes, a nonnegative integer. no cap on how big you dream πŸ¦‹
  • disp_unit β€” local unit size for displacements, in bytes, and it's gotta be a positive integer. yes, positive. yes, integer. iykyk 🌸
  • info β€” the info argument (handle)
  • comm β€” the communicator (handle)

🫢 OUTPUT PARAMETERS 🫢

  • win β€” the window object returned by the call (handle). this is the whole point, bestie πŸ‘‘
  • ierror β€” Fortran only: error status (integer)

πŸ’œ DESCRIPTION πŸ’œ

so MPI_Win_create is a one-sided MPI communication collective call, and it gets executed by all processes in the group of comm. it returns a window object that those processes can then use to do RMA operations. literally the group chat of memory exposure.

each process specifies a window of existing memory that it exposes to RMA accesses by the processes in the group of comm. the window consists of size bytes, starting at address base. and a process may elect to expose no memory at all by specifying size = 0 β€” valid, iconic, zero vibes but legal πŸ™ˆ

if the base value used by MPI_Win_create was allocated by MPI_Alloc_mem, the size of the window can be no larger than the value set by the MPI_Alloc_mem function. no take-backs, no overreach 🚫

the displacement unit argument is provided to facilitate address arithmetic in RMA operations: the target displacement argument of an RMA operation is scaled by the factor disp_unit specified by the target process, at window creation. math but make it cute ✨

🌈 the info keys that are supported 🌈

no_locks

if set to true, then the implementation may assume that the local window is never locked (by a call to MPI_Win_lock or MPI_Win_lock_all). setting this value if only active synchronization may allow the implementation to enable certain optimizations. so like, only claim this if you mean it 🫢

accumulate_ordering

by default, accumulate operations from one initiator to one target on the same window memory location are strictly ordered. if the info key accumulate_ordering is set to none, no ordering of accumulate operations guaranteed. they key can also be a comma-separated list of required orderings consisting of rar, war, raw, and waw for read-after-read, write-after-read, read-after-write, and write-after-write, respectively. looser ordering constraints are likely to result in improved performance. so like... freedom is fast, ngl πŸ”₯

accumulate_ops

if set to same_op, the implementation will assume that all concurrent accumulate calls to the same target address will use the same operation. if set to same_op_no_op, then the implementation will assume that all concurrent accumulate calls to the same target address will use the same operation or MPI_NO_OP. the default is same_op_no_op. that default is lowkey doing the most, respect πŸ’…

same_size

if set to true, then the implementation may assume that the argument size is identical on all processes, and that all processes have provided this info key with the same value. so like, everyone has to actually agree, not just say they agree πŸ¦‹

same_disp_unit

if set to true, then the implementation may assume that the argument disp_unit is identical on all processes, and that all processes have provided this info key with the same value. same energy, same rules, same value πŸ’–


⭐ NOTES ⭐

common choices for disp_unit are 1 (no scaling), and (in C syntax) sizeof(type), for a window that consists of an array of elements of type type. the later choice will allow one to use array indices in RMA calls, and have those scaled correctly to byte displacements, even in a heterogeneous environment. yes, even then. slay 🌍

use memory allocated by MPI_Alloc_mem to guarantee properly aligned window boundaries (such as word, double-word, cache line, page frame, and so on). alignment is self-care, periodt πŸŽ€


πŸ’€ ERRORS πŸ’€

almost all MPI routines return an error value; C routines as the return result of the function and Fortran routines in the last argument.

before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. if no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. when MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively) the error raises the initial error handler. the initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or the mpi_initial_errhandler CLI argument to mpiexec or info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. 😭 it's a whole chain of command

Open MPI includes three predefined error handlers that can be used:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. not a drill πŸ’€
  • 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 if MPI_Abort was called on that communicator. if called on a window or file, acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. if called on a session, aborts only the local process. contextual king πŸ‘‘
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one 🫢

MPI applications can also implement their own error handlers by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler

note that MPI does not guarantee that an MPI program can continue past an error. like, bestie, it might just be over 😭

see the MPI man page for a full list of MPI error codes.

see the Error Handling section of the MPI-3.1 standard for more information.


πŸ‘€ SEE ALSO πŸ‘€

  • MPI_Alloc_mem
  • MPI_Free_mem
  • MPI_Win_allocate
  • MPI_Win_allocate_shared

the whole window-allocating friend group, go read them too πŸ’–


2003-2026, The Open MPI Community


and that's the page, bestie 🫢 this was the MPI_WIN_CREATE(3) man page from the Open MPI crew, dated Sep 11, 2026 β€” go forth and expose your memory responsibly βœ¨πŸ’…

πŸ“¦ where this page comes from