MPI_WIN_FLUSH_ALL(3)

πŸ“¦
version 5.0.10 Β· 4 versions
, in ubuntu stonking
πŸ’– bestie alert πŸ’– you're in the Open MPI manual, section 3, and the page is MPI_WIN_FLUSH_ALL β€” aka MPI_Win_flush_all, riding shotgun with its twin MPI_Win_flush. πŸ¦‹

okay so the whole vibe of this page, in one breath: complete all outstanding RMA operations at both the origin and the target. That's the assignment. Periodt. ✨


🌸 SYNTAX 🌸

πŸ“ C Syntax

#include <mpi.h>

int MPI_Win_flush (int rank, MPI_Win win)

int MPI_Win_flush_all (MPI_Win win)

πŸ“ Fortran Syntax

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

MPI_WIN_FLUSH_ALL(WIN, IERROR)
     INTEGER WIN, IERROR

πŸ“ Fortran 2008 Syntax

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

MPI_Win_flush_all(win, ierror)
     TYPE(MPI_Win), INTENT(IN) :: win
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸŽ€ INPUT PARAMETERS πŸŽ€

  • rank β€” the rank of the window, and it's a nonnegative integer, no cap. πŸ’…
  • win β€” the window object (handle). The whole little universe you're flushing into. 🌈

πŸŽ€ OUTPUT PARAMETER πŸŽ€

  • ierror β€” Fortran only: error status (integer). The Fortran girlies get the receipts at the end of the call, not as the return value. 🫢

πŸ‘‘ DESCRIPTION πŸ‘‘

MPI_Win_flush completes all outstanding RMA operations initiated by the calling process to the target rank on the specified window. And bestie, "completes" means both sides β€” the operations are completed at the origin and at the target. Not one, not the other. Both. Fr fr. 😀

MPI_Win_flush_all does the same thing but sends the energy to all targets. Every single one. No picking favorites.

⚠️ BIG ONE, DO NOT SKIP: this can ONLY be called from within a passive target epoch. Not an active one. Not "eh, close enough." Passive only. If you're in the wrong epoch, that's on you. πŸ’€

πŸ’€ ERRORS πŸ’€

Okay so almost all MPI routines hand you back an error value β€” C routines give it to you as the return result of the function, and Fortran routines tuck it into the last argument. πŸ’Œ

Before that error value comes back to you, the current MPI error handler that's associated with the communication object (think: communicator, window, file) gets called. If there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and it'll call the associated MPI error handler. 🫠

And when MPI_COMM_SELF isn't 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. 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 via the mpi_initial_errhandler CLI argument to mpiexec, or the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. ✨

If no other appropriate error handler has been set, then MPI_ERRORS_RETURN gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets 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. Everyone. Gone. πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. When it's called on a communicator, it acts as if MPI_Abort was called on that communicator. If it's 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 it's called on a session, it aborts only the local process. 🌸
  • 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, don't count on walking it off. 😭

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_Win_flush_local
  • MPI_Win_lock
  • MPI_Win_lock_all

and that's the whole page, bestie, you ate πŸ‘‘πŸ’…

legal-ish sign-off, because we keep the receipts: this is Copyright 2003-2026, The Open MPI Community πŸ’– and the page stamp says Sep 10, 2026, filed under MPI_WIN_FLUSH_ALL(3), straight outta the Open MPI manual. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from