MPI_WIN_SET_ERRHANDLER(3)
π MPI_Win_set_errhandler β Open MPI π
okay so bestie, this is the Open MPI man page for MPI_Win_set_errhandler, and it does exactly one thing: it glues a brand-new error handler onto a window. That's it. That's the whole personality. β¨
πΈ SYNTAX πΈ
C Syntax
#include <mpi.h>
int MPI_Win_set_errhandler(MPI_Win win, MPI_Errhandler errhandler)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_WIN_SET_ERRHANDLER(WIN, ERRHANDLER, IERROR)
INTEGER WIN, ERRHANDLER, IERROR
Fortran 2008 Syntax
USE mpi_f08
MPI_Win_set_errhandler(win, errhandler, ierror)
TYPE(MPI_Win), INTENT(IN) :: win
TYPE(MPI_Errhandler), INTENT(IN) :: errhandler
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT/OUTPUT PARAMETER π
winβ the window, as a handle. (yes it's both input and output coded, that's just how the standard labels it, don't come for me π )
π INPUT PARAMETER π
errhandlerβ the shiny new error handler you're assigning to this window (a handle).
π€ OUTPUT PARAMETER π€
ierrorβ Fortran only: the error status, as an integer. (C girlies get their error as the return value instead, slay)
π DESCRIPTION π
MPI_Win_set_errhandler attaches a new error handler to a window. That's the vibe. π¦
And there's a rule here, bestie, don't skip it: the error handler you pass must be either a predefined error handler, or one you made yourself by calling MPI_Win_create_errhandler. No random handles, no homemade structs, no "it's giving error handler" energy. It's got to be one of those two. periodt.
π ERRORS π
Almost all MPI routines return an error value. C routines hand it back as the return result of the function, and Fortran routines stash it in that last argument. fr fr.
Before that error value ever gets returned, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. And if there's no communication object associated with the MPI call at all? Then the call is considered attached to MPI_COMM_SELF and it'll call the MPI error handler attached to that. π
Now here's the part where you have to pay attention π β when MPI_COMM_SELF is not initialized (that means 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. And you can change that initial error handler:
- by calling
MPI_Comm_set_errhandleronMPI_COMM_SELFwhen you're using the World model, or - via the
mpi_initial_errhandlerCLI argument tompiexec, or - via 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 gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all other MPI functions. That's the default lore. π
Open MPI ships three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. yes, all of them. dramatic but effective π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 ifMPI_Abortwas called on that communicator. If it's 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 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_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(hey, that's this one!! you're literally reading it π)
β οΈ Note that MPI does not guarantee that an MPI program can continue past an error. Like, don't assume. It's not promised. π
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.
Β©οΈ Copyright Β©οΈ
2003-2026, The Open MPI Community
and that's the whole page bestie, you ate it up π stay hydrated, set your errhandlers responsibly, and remember: error handlers are not a personality trait, they're a lifestyle π§π
β with love, from the Open MPI girlies, version dated Sep 10, 2026, MPI_WIN_SET_ERRHANDLER(3), mwah π
π¦ 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