MPI_TYPE_FREE_KEYVAL(3)

πŸ’… MPI_Type_free_keyval β€” Open MPI manual page, bestie edition

Okay so this is MPI_Type_free_keyval(3) from the Open MPI manual, and it's literally the cleanup queen of the type-keyval world. Let's get into it πŸŽ€


✨ NAME ✨

MPI_Type_free_keyval β€” frees a previously created type key value. That's it, that's the whole job. She's a liberator. πŸ¦‹


🌸 SYNTAX 🌸

C Syntax

#include <mpi.h>

int MPI_Type_free_keyval(int *type_keyval)

Fortran Syntax

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

Fortran 2008 Syntax

USE mpi_f08
MPI_Type_free_keyval(type_keyval, ierror)
     INTEGER, INTENT(INOUT) :: type_keyval
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🫢 INPUT/OUTPUT PARAMETER 🫢

  • type_keyval β€” the key value you're about to free (integer). Yes, it's both input and output, she's versatile like that πŸ’…

⭐ OUTPUT PARAMETER ⭐

  • ierror β€” Fortran only, bestie: this is the error status (integer).

πŸŽ€ DESCRIPTION πŸŽ€

So the original manpage has a DESCRIPTION heading and then… nothing. Empty. Void. A ghost town. πŸ™ˆ No cap, there's genuinely no prose under it here, so I'm not gonna invent any β€” that would be a vibe crime. The name section tells you what she does, and the rest of the page is all about what happens when things go sideways. 😭


πŸ’€ ERRORS πŸ’€

Almost all MPI routines return an error value, okay? In C it's the return result of the function, and in Fortran it lands in the last argument. Literally every single one. πŸ”₯

Before that error value comes back to you, the current MPI error handler attached to the communication object (think: communicator, window, file) gets called. Now if there's no communication object associated with the MPI call, then the call counts as being attached to MPI_COMM_SELF and it calls that 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 you're 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 gets called for MPI I/O functions and MPI_ERRORS_ABORT gets called for all other MPI functions. That's the whole flowchart, congrats 🧚

Open MPI ships three predefined error handlers you can use β€” iconic trio honestly πŸ‘‘

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. Dramatic? Yes. Effective? Also yes πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. When it's called on a communicator, it acts as if MPI_Abort was called on that communicator. If it's 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 it's called on a session, it aborts only the local process. Context-aware queen πŸŽ€
  • MPI_ERRORS_RETURN β€” returns an error code to the application. The polite one 🫢

MPI applications can also implement their own error handlers, and here's the whole recipe list for that:

  • 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
⚠️ Real talk: note that MPI does not guarantee that an MPI program can continue past an error. Like, she might just be done. πŸ’…

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


🌈 SEE ALSO 🌈

  • MPI_Type_create_keyval β€” the one that made the keyval in the first place, so like, the origin story ✨

2003-2026, The Open MPI Community


And that's the page, bestie! πŸ“ This was MPI_TYPE_FREE_KEYVAL(3) from the Open MPI manual, dated Sep 11, 2026 β€” go free those keyvals, you absolute main character πŸ’œπŸ¦‹

πŸ“¦ where this page comes from