MPI_KEYVAL_FREE(3)

πŸ’… MPI_KEYVAL_FREE(3)

okay so this is an Open MPI man page, bestie β€” buckle up πŸŽ€

🌸 NAME 🌸

MPI_Keyval_free β€” frees the attribute key for a communicator cache attribute β€” and heads up, this routine is deprecated in favor of MPI_Comm_free_keyval. no cap, it's giving "old faithful but we've moved on" 😭


✨ SYNOPSIS ✨

πŸ’» 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). yes that's literally the whole description, she's concise πŸ’…

πŸ¦‹ OUTPUT PARAMETER πŸ¦‹

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

πŸ’œ DESCRIPTION πŸ’œ

real talk: use of this routine is deprecated as of MPI-2. please use MPI_Comm_free_keyval instead. that's it, that's the whole description β€” she's short but she means it 🌈


πŸ”₯ ERRORS πŸ”₯

Almost all MPI routines return an error value β€” C routines give it back as the return result of the function, and Fortran routines put it in the last argument. periodt.

Before that error value comes back, the current MPI error handler associated with the communication object (like a communicator, window, or file) gets called. If there's no communication object associated with the MPI call, then the call counts as attached to MPI_COMM_SELF and will call the associated MPI error handler. And when MPI_COMM_SELF isn't 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 that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. If no other appropriate error handler has been set, then MPI_ERRORS_RETURN is called for MPI I/O functions, and MPI_ERRORS_ABORT is called for all other MPI functions. iykyk πŸ’€

Open MPI ships three predefined error handlers you can use, and they are lowkey iconic:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. dramatic but effective πŸ’€
  • 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. 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, fr fr, don't count on it 😭

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


and that's the whole vibe check, bestie β€” page brought to you by Open MPI, dated Sep 11, 2026, filed under MPI_KEYVAL_FREE(3). slay, go free those keyvals (with MPI_Comm_free_keyval, obviously πŸ’…βœ¨)

πŸ“¦ where this page comes from