MPI_ATTR_GET(3)

πŸ’– MPI_ATTR_GET(3) β€” Open MPI manual, bestie edition πŸ’–

okay so. hi. sit down, grab a strawberry πŸ“, because we're talking about MPI_Attr_get, and this one is a legacy girly. It retrieves an attribute value by key... and it is deprecated in favor of MPI_Comm_get_attr. Like, MPI-2 deprecated it, MPI-3 literally deleted it. It said "I'm retiring" and then it retired. πŸ’…


✨ SYNTAX ✨

πŸŽ€ C Syntax

#include <mpi.h>

int MPI_Attr_get(MPI_Comm comm, int keyval,void *attribute_val,
     int *flag )

πŸŽ€ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'

MPI_ATTR_GET(COMM, KEYVAL, ATTRIBUTE_VAL, FLAG, IERROR)
     INTEGER COMM, KEYVAL, ATTRIBUTE_VAL, IERROR
     LOGICAL FLAG

🌸 INPUT PARAMETERS 🌸

  • comm β€” the communicator that the attribute is attached to (a handle). it's giving "where is this thing glued on".
  • keyval β€” the key value (an integer). your lil lookup key, iykyk πŸ—οΈ

πŸ¦‹ OUTPUT PARAMETERS πŸ¦‹

  • attribute_val β€” the attribute value, unless flag = false. so like, no flag, no value.
  • flag β€” true if an attribute value was actually extracted; false if there is just. no attribute associated with that key. the vibe check result, lowkey πŸ’€
  • ierror β€” Fortran only: the error status (integer).

πŸ‘‘ DESCRIPTION πŸ‘‘

Real talk bestie: use of this routine is deprecated as of MPI-2, and it was deleted in MPI-3. Please, please, use MPI_Comm_get_attr instead. ✨

Also: this function does not have a mpi_f08 binding. so if that's your era, this is not your era. πŸ™ˆ


πŸ”₯ ERRORS πŸ”₯

Almost all MPI routines return an error value β€” C routines hand it back as the return result of the function, and Fortran routines tuck it into the last argument. no cap.

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 there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF, and it'll call the associated MPI error handler. And 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. 🫣

The initial error handler can be changed 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 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. periodt.

Open MPI includes three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. dramatic, iconic, unrecoverable πŸ’€
  • 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. main character, but localized πŸŽ€
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one. the "here's your problem back, bestie" 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. πŸ›‘

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_Comm_get_attr β€” literally the glow-up replacement, go there bestie 🌈

2003-2026, The Open MPI Community


and that's the page!! no notes, ate, slay πŸ’œ

k byeee β€” this was Open MPI's MPI_ATTR_GET(3) manual page, dated Sep 10, 2026, brought to you by the lovely humans of The Open MPI Community (2003-2026). go use MPI_Comm_get_attr instead, ily 🫢✨
πŸ“¦ where this page comes from