MPI_ERRHANDLER_CREATE(3)
๐ MPI_ERRHANDLER_CREATE(3) ๐
okay bestie, welcome to the Open MPI corner of the man page universe โจ this one is about MPI_Errhandler_create, and it comes with a warning label, so buckle up ๐
๐ธ NAME ๐ธ
MPI_Errhandler_create โ creates an MPI-style error handler. and no, i'm not being dramatic: this routine is deprecated in favor of MPI_Comm_create_errhandler, and the man page says it twice because it means it ๐
โจ SYNTAX โจ
๐ฆ C Syntax
#include <mpi.h>
int MPI_Errhandler_create(MPI_Handler_function *function,
MPI_Errhandler *errhandler)
๐ฆ Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_ERRHANDLER_CREATE(FUNCTION, ERRHANDLER, IERROR)
EXTERNAL FUNCTION
INTEGER ERRHANDLER, IERROR
๐ INPUT PARAMETER ๐
functionโ the user-defined error handling procedure. your special little error-catching bestie ๐ซถ
๐ OUTPUT PARAMETERS ๐
errhandlerโ the MPI error handler, aka the handle. the receipt for your registered handler, basically โจierrorโ Fortran only: error status (integer). classic Fortran, always putting the error status in the last argument ๐
๐ DESCRIPTION ๐
so here's the tea: use of this routine is deprecated as of MPI-2. please use MPI_Comm_create_errhandler instead. i'm not gonna nag you about it... okay maybe a little ๐
what it does (when you do use it): it registers the user routine function for use as an MPI error handler, and returns in errhandler a handle to the registered error handler. iconic behavior, honestly โญ
in the C language, the user routine should be a C function of type MPI_Handler_function, which is defined as:
typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...);
and here's what all that means, bestie:
- the first argument is the communicator in use.
- the second argument is the error code to be returned by the MPI routine that raised the error. and if the routine would have returned
MPI_ERR_IN_STATUS, then it's the error code returned in the status for the request that caused the error handler to be invoked. yes, that's a mouthful, i know ๐ญ - the remaining arguments are
stdargsarguments whose number and meaning is implementation-dependent. an implementation should clearly document these arguments. addresses are used so that the handler may be written in Fortran ๐ง
๐ฅ NOTE ๐ฅ
the MPI Standard states that an implementation may make the output value (errhandler) simply the address of the function. cute, right? except the action of MPI_Errhandler_free makes this impossible, since it is required to set the value of the argument to MPI_ERRHANDLER_NULL. in addition, the actual error handler must remain until all communicators that use it are freed. no shortcuts here, bestie ๐
๐ 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. so keep an eye on that return value, 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. 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. whew, that was a whole journey ๐ฎโ๐จ
Open MPI includes three predefined error handlers that can be used:
MPI_ERRORS_ARE_FATALโ causes the program to abort all connected MPI processes. like, everyone. all at once. ๐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 ifMPI_Abortwas called on that communicator. if called on a window or file, acts as ifMPI_Abortwas 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. it's giving targeted chaos ๐ฅMPI_ERRORS_RETURNโ returns an error code to the application. the chill one, honestly ๐
MPI applications can also implement their own error handlers by calling:
MPI_Comm_create_errhandlerthenMPI_Comm_set_errhandlerMPI_File_create_errhandlerthenMPI_File_set_errhandlerMPI_Session_create_errhandlerthenMPI_Session_set_errhandleror atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
note that MPI does not guarantee that an MPI program can continue past an error. like, bestie, do not assume you can just keep going. ๐ซถ
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_Comm_create_errhandlerMPI_Comm_get_errhandlerMPI_Comm_set_errhandler
๐ COPYRIGHT ๐
2003-2026, The Open MPI Community
and that's the whole page, bestie! mwah ๐ this has been MPI_ERRHANDLER_CREATE(3) from the Open MPI crew, dated Sep 11, 2026 โ now go use MPI_Comm_create_errhandler, the deprecation notice literally asked nicely ๐โจ๐ฆ
๐ฆ where this page comes from
- arch rolling: openmpi 5.0.11-1 ยท BSD-3-Clause AND LicenseRef-MPICH
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms