MPI_WIN_SYNC(3)

πŸ’– MPI_WIN_SYNC πŸ’–

okay bestie, this is the MPI_WIN_SYNC page from the Open MPI manual (section 3, the library-calls one), and honestly? It's a lil bop. It's short, it's sweet, and it does exactly one job. Let's get into it. ✨


🌸 NAME 🌸

MPI_Win_sync β€” synchronize the private and public copies of the window. That's it. That's the whole gig. No cap.


✨ SYNTAX ✨

πŸŽ€ C Syntax

#include <mpi.h>

int MPI_Win_sync (MPI_Win win)

πŸ¦‹ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_WIN_SYNC(WIN, IERROR)
     INTEGER WIN, IERROR

🌈 Fortran 2008 Syntax

USE mpi_f08
MPI_Win_sync(win, ierror)
     TYPE(MPI_Win), INTENT(IN) :: win
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ’… INPUT PARAMETERS

  • win β€” the window object, as a handle. Your lil window. Your baby. πŸͺŸ

🫢 OUTPUT PARAMETER

  • ierror β€” Fortran only, bestie: the error status, and it's an integer. C girlies get the error back as the return value instead. πŸ’œ

πŸ‘‘ DESCRIPTION πŸ‘‘

So here's the tea: MPI_Win_sync synchronizes the private and public window copies of win. That's literally what it does.

For the purposes of synchronizing the private and public window, MPI_Win_sync has the effect of ending and reopening an access and exposure epoch on the window. Like, that's the vibe it's giving.

But β€” and this is important, bestie, do not skip this β€” it does not actually end an epoch and it does not complete any pending MPI RMA operations. So it's giving "end and reopen" energy without, y'know, actually doing the end and reopen. Iconic behavior honestly. πŸ™ˆ


😭 ERRORS 😭

Almost all MPI routines return an error value, okay? C routines give it to you as the return result of the function, and Fortran routines put it in the last argument. Fr fr.

Before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. And if there's no communication object associated with the MPI call? Then the call is considered attached to MPI_COMM_SELF and it will call the associated MPI error handler. Periodt.

When MPI_COMM_SELF is not initialized β€” that's 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. The way that you can change the initial error handler is 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 the 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. That's just how it is. πŸ’€

Open MPI includes three predefined error handlers that you can use, and they are:

  • MPI_ERRORS_ARE_FATAL β€” Causes the program to abort all connected MPI processes. Dramatic? Yes. Effective? Also yes.
  • 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, it 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, it aborts only the local process. So specific. We love a handler that knows what it wants. πŸ’…
  • MPI_ERRORS_RETURN β€” Returns an error code to the application. Chill. Communicative. A whole vibe.

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, it might just be over. No promises, 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. iykyk. πŸ“š


2003-2026, The Open MPI Community


okay that's the whole page!! πŸ¦‹ this was brought to you by the Open MPI manual, MPI_WIN_SYNC(3), dated Sep 10, 2026 β€” slay, stay synchronized, and don't forget to sync your private and public copies bestie πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from