MPI_KEYVAL_FREE(3)

πŸ’– MPI_Keyval_free πŸ’–

okay so bestie, welcome to MPI_KEYVAL_FREE(3) β€” yes that's the page name, it's a whole Open MPI manual page and we're gonna get through it together 🫢

🌸 NAME 🌸

MPI_Keyval_free β€” frees attribute key for communicator cache attribute.

fr fr, heads up: this routine is deprecated in favor of MPI_Comm_free_keyval.

✨ SYNTAX ✨

πŸ“ C Syntax

#include <mpi.h>

int MPI_Keyval_free(int *keyval)

πŸ“ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'

MPI_KEYVAL_FREE(KEYVAL, IERROR)
     INTEGER KEYVAL, IERROR

πŸŽ€ INPUT PARAMETER πŸŽ€

  • keyval β€” frees the integer key value (integer). that's it, that's the whole input, she's simple πŸ’…

πŸŽ€ OUTPUT PARAMETER πŸŽ€

  • ierror β€” Fortran only: error status (integer).

πŸ’« DESCRIPTION πŸ’«

okay so, real talk: use of this routine is deprecated as of MPI-2. like, please just use MPI_Comm_free_keyval instead. it's giving "old faithful but we moved on" 😭

😭 ERRORS 😭

Almost all MPI routines return an error value, bestie β€” C routines hand it back as the return result of the function, and Fortran routines tuck it into the last argument. iconic behavior, honestly.

Before that error value gets returned, the current MPI error handler associated with the communication object (like a communicator, window, or file) is called. And if there's no communication object associated with the MPI call? then the call counts as attached to MPI_COMM_SELF and it'll call the associated MPI error handler. Now β€” 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. 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 the 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 the other MPI functions. no cap ✨

Open MPI includes three predefined error handlers that can be used:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. πŸ’€
  • 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.
  • MPI_ERRORS_RETURN β€” returns an error code to the application.

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, it might just be over, that's the vibe πŸ™ˆ

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_Keyval_create
  • MPI_Comm_create_keyval
  • MPI_Comm_free_keyval

2003-2026, The Open MPI Community.


okay bestie that's the whole page, and lemme leave you with the receipts: this one came from Open MPI, dated Sep 10, 2026, and it's the MPI_KEYVAL_FREE(3) page. go forth and free your keyvals (the right way, with MPI_Comm_free_keyval, iykyk) πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from