MPI_ERRHANDLER_FREE(3)

πŸ’– MPI_ERRHANDLER_FREE(3) πŸ’–

okay so bestie, welcome to the Open MPI manual page for MPI_ERRHANDLER_FREE(3), and like… this one is your lil cleanup queen. she frees an MPI-style error handler. that's it. that's the whole vibe. ✨


🌸 NAME 🌸

MPI_Errhandler_free β€” frees an MPI-style error handler. yes it's giving "tidying up after the party" and honestly? we love a girl who cleans up after herself πŸ§ΉπŸ’…


✨ SYNTAX ✨

πŸŽ€ C Syntax

#include <mpi.h>

int MPI_Errhandler_free(MPI_Errhandler *errhandler)

🧚 Fortran Syntax

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

πŸ¦‹ Fortran 2008 Syntax

USE mpi_f08
MPI_Errhandler_free(errhandler, ierror)
     TYPE(MPI_Errhandler), INTENT(INOUT) :: errhandler
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ“₯ INPUT PARAMETER πŸ“₯

  • errhandler β€” your MPI error handler (a handle, okurrr). on exit it gets set to MPI_ERRHANDLER_NULL, so like, don't be surprised when it's ✨gone✨ 🫢

πŸ“€ OUTPUT PARAMETER πŸ“€

  • ierror β€” Fortran only, bestie: this is the error status (integer). she only shows up for the Fortran girlies πŸ’œ

πŸ’« DESCRIPTION πŸ’«

so what this actually does: it marks the error handler associated with errhandler for deallocation and sets errhandler to MPI_ERRHANDLER_NULL. πŸ’€

but NOT me being dramatic β€” she doesn't get deallocated immediately, okay? the error handler will be deallocated after all communicators associated with it have been deallocated. it's giving "she's not leaving until everyone she came with has left the function" 😭 iconic behavior fr fr.


⚠️ ERRORS ⚠️

almost all MPI routines return an error value β€” C routines hand it back as the return result of the function, and Fortran routines tuck it into the last argument. standard πŸ’…

Before the error value is returned, the current MPI error handler associated with the communication object (like a communicator, window, or 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 β€” i.e. 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 the initial error handler by:

  • calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or
  • the mpi_initial_errhandler CLI argument to mpiexec, or
  • an info key to MPI_Comm_spawn / MPI_Comm_spawn_multiple.

and 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. no cap. πŸ”₯

Open MPI includes three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. like, everybody goes down together. πŸ’€
  • 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. (lowkey selective, highkey iconic πŸ‘‘)
  • MPI_ERRORS_RETURN β€” returns an error code to the application. she's 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, she said what she said. 😭

see the MPI man page for a full list of MPI error codes, and the Error Handling section of the MPI-3.1 standard for more information. iykyk πŸ“š

See also:

  • MPI_Comm_create_errhandler
  • MPI_Comm_get_errhandler
  • MPI_Comm_set_errhandler

2003-2026, The Open MPI Community 🫢


okay bestie that's the whole page, and real talk β€” this was the Open MPI girlies' own manual page for MPI_ERRHANDLER_FREE(3), dated Sep 10, 2026, brought to you by The Open MPI Community (Β© 2003-2026). go deallocate responsibly, mwah πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from