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 stdargs arguments 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 if MPI_Abort was called on that communicator. if called on a window or file, 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, 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_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, 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_errhandler
  • MPI_Comm_get_errhandler
  • MPI_Comm_set_errhandler

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