MPI_COMM_DELETE_ATTR(3)
π MPI_Comm_delete_attr β the Open MPI manual, bestie edition π
okay so you're here because you need to delete an attribute value that's associated with a key. that's the whole vibe of MPI_Comm_delete_attr. let's get into it β¨
πΈ 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
π«Ά INPUT/OUTPUT PARAMETER π«Ά
commβ the communicator you're deleting the attribute from, bestie (it's a handle).
π INPUT PARAMETER π
comm_keyvalβ the key value, which is an integer. iykyk.
β OUTPUT PARAMETER β
ierrorβ Fortran only, bb: the error status (integer).
π DESCRIPTION π
So MPI_Comm_delete_attr deletes an attribute from cache by key. the way this works is it invokes the attribute delete function delete_fn that you specified way back when the comm_keyval was created. and like β the call will fail if that delete_fn function returns an error code that isn't MPI_SUCCESS. no cap, it just won't go through π
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 β don't come for me, that's just what the standard says). And whenever a communicator is deleted using MPI_Comm_free, all the callback delete functions for attributes that are currently set are invoked.
This function is literally the same as MPI_Attr_delete but it's needed to match the communicator-specific functions introduced in the MPI-2 standard. also β heads up β the use of MPI_Attr_delete is deprecated. π so maybe don't.
π NOTES π
okay important caveat time π the MPI standard does not define what happens if the delete_fn callback invokes other MPI functions. like, it's just not defined, periodt.
In Open MPI specifically: it is not valid for delete_fn callbacks (or any of their children β yes, the whole family tree) to add or delete attributes on the same object on which the delete_fn callback is being invoked. so don't do that. please. π«Ά
π ERRORS π
Almost all MPI routines return an error value, bestie β C routines give it back as the return result of the function, and Fortran routines put it in the last argument.
Before the error value is returned, the current MPI error handler associated with the communication object (like a communicator, window, or file) gets 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. That 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. 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.
Open MPI includes three predefined error handlers you can use β iconic lineup tbh:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. yeah. all of them. π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 ifMPI_Abortwas called on that communicator. If 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. If called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application. chillest of the three ngl.
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. like, it might just be over. π
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.
π COPYRIGHT π
2003-2026, The Open MPI Community
and that's the page babes π§ this one's from the Open MPI crew, dated Sep 11, 2026, and it's filed under MPI_COMM_DELETE_ATTR(3) β go delete those attributes responsibly, mwah πβ¨
π¦ where this page comes from
- arch rolling: openmpi 5.0.11-1 Β· BSD-3-Clause AND LicenseRef-MPICH
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms