MPI_COMM_DELETE_ATTR(3)
π MPI_COMM_DELETE_ATTR π
okay bestie, so this one is from the Open MPI manual, section 3 (that's the library-calls girlies, not the commands). Let's get into it π«Ά
β¨ NAME β¨
MPI_Comm_delete_attr β literally deletes the attribute value that's associated with a key. bye bye attribute π
β¨ SYNTAX β¨
πΈ C Syntax πΈ
#include <mpi.h>
int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
πΈ Fortran Syntax πΈ
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_COMM_DELETE_ATTR(COMM, COMM_KEYVAL, IERROR)
INTEGER COMM, COMM_KEYVAL, IERROR
πΈ Fortran 2008 Syntax πΈ
USE mpi_f08
MPI_Comm_delete_attr(comm, comm_keyval, ierror)
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, INTENT(IN) :: comm_keyval
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
β¨ PARAMETERS β¨
π INPUT/OUTPUT PARAMETER π
commβ the communicator you're deleting the attribute from (it's a handle, bestie).
π INPUT PARAMETER π
comm_keyvalβ the key value, and it's an integer.
π OUTPUT PARAMETER π
ierrorβ Fortran only: your error status (integer).
β¨ DESCRIPTION β¨
So MPI_Comm_delete_attr deletes an attribute out of the cache, by key. β¨ And here's the part that matters: this function invokes the attribute delete function delete_fn that you specified back when the comm_keyval was created. And if that delete_fn returns an error code that isn't MPI_SUCCESS? The call fails. no cap π
Whenever a communicator gets replicated using MPI_Comm_dup, all the callback copy functions for attributes that are currently set get invoked (in arbitrary order, so don't come for the ordering, it's not promised). And whenever a communicator is deleted using MPI_Comm_free, all the callback delete functions for attributes that are currently set get invoked.
This function is the same as MPI_Attr_delete, but it's needed so everything matches the communicator-specific functions that the MPI-2 standard introduced. Also: using MPI_Attr_delete is deprecated, so pls don't π The MPI_Attr_delete of it all is giving 2002, periodt.
β¨ NOTES β¨
Heads up bestie: the MPI standard does not define what happens if the delete_fn callback invokes other MPI functions. Undefined behaviour, truly iconic in a terrifying way π
In Open MPI specifically, it is not valid for delete_fn callbacks (or any of their children) to add or delete attributes on the same object that the delete_fn callback is being invoked on. just don't π«
β¨ ERRORS β¨
Almost all MPI routines return an error value. C routines give it back as the return result of the function, Fortran routines put it in the last argument. classic π
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 will call the associated MPI error handler. But when MPI_COMM_SELF isn't initialized (like, 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 instead π±
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 via an 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 other MPI functions.
π¦ The three predefined error handlers π¦
Open MPI ships three of them, ready to go:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. dramatic AND effective πMPI_ERRORS_ABORTβ an error handler you can invoke on a communicator, window, file, or session. When it's called on a communicator, it acts as ifMPI_Abortwas called on that communicator. If it's called on a window or file, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. And if it's called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application. the chill one π«Ά
π¦ DIY error handlers π¦
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. so like. plan accordingly π
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 π
β¨ COPYRIGHT β¨
2003-2026, The Open MPI Community
and that's the whole page, bestie!! π this Open MPI page is dated Sep 10, 2026 and it slid into your terminal courtesy of the Open MPI girlies β go delete those attributes responsibly, mwah ππ¦β¨
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms