MPI_TYPE_SET_ATTR(3)
π MPI_TYPE_SET_ATTR
okay bestie, so this is the Open MPI manual page for MPI_TYPE_SET_ATTR(3) β yes it's a whole man page, yes it's about gluing attributes onto datatypes, and yes we're gonna make it make sense. π«Ά
β¨ NAME β¨
MPI_Type_set_attr β sets a key value/attribute pair to a data type. literally that's the whole job description. π
π SYNTAX π
π C Syntax
#include <mpi.h>
int MPI_Type_set_attr(MPI_Datatype type, int type_keyval,
void *attribute_val)
π Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_TYPE_SET_ATTR(TYPE, TYPE_KEYVAL, ATTRIBUTE_VAL, IERROR)
INTEGER TYPE, TYPE_KEYVAL, IERROR
INTEGER(KIND=MPI_ADDRESS_KIND) ATTRIBUTE_VAL
π Fortran 2008 Syntax
USE mpi_f08
MPI_Type_set_attr(datatype, type_keyval, attribute_val, ierror)
TYPE(MPI_Datatype), INTENT(IN) :: datatype
INTEGER, INTENT(IN) :: type_keyval
INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: attribute_val
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π¦ INPUT/OUTPUT PARAMETER π¦
typeβ the data type the attribute is getting attached to (it's a handle, bestie). π
πΈ INPUT PARAMETERS πΈ
type_keyvalβ the key value (an integer, no cap).attribute_valβ the attribute value itself.
β OUTPUT PARAMETER β
ierrorβ Fortran only: the error status (integer). so Fortran girlies get the tea handed back to them directly. π
π« DESCRIPTION π«
So for whatever data type you hand it, MPI_Type_set_attr sets the key value to the value of the specified attribute. that's it. that's the function. short and iconic, honestly. π
π ERRORS π
okay this is the long part but it's important, stay with me.
Almost all MPI routines return an error value β C routines pass it back as the return result of the function, and Fortran routines stick it in that last argument. classic.
Before the error value actually gets returned, the current MPI error handler associated with the communication object gets called (think: communicator, window, file). 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 error handler associated with that. And when MPI_COMM_SELF isn't initialized β meaning 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_errhandleronMPI_COMM_SELFwhen you're using the World model, or - the
mpi_initial_errhandlerCLI argument tompiexec, 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. so like, default behavior is not always gentle, iykyk. π
Open MPI ships with three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. it's giving nuclear option. π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 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. If it's called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application. the polite one. π«Ά
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
β οΈ heads up bestie: MPI does not guarantee that an MPI program can continue past an error. like, no promises. plan accordingly. β¨
See the MPI man page for a full list of MPI error codes. π
See the Error Handling section of the MPI-3.1 standard if you want even more detail.
See also:
MPI_Type_get_attr
π Copyright π
2003-2026, The Open MPI Community.
and that's the whole page, bestie!! π this lil drop came to you from the Open MPI manual, dated Sep 10, 2026, and it's the MPI_TYPE_SET_ATTR(3) page. slay, go set some attributes, and remember: MPI_Type_get_attr is right there when you need to read them back. periodt. πβ¨π¦
π¦ 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