MPI_TYPE_GET_TRUE_EXTENT(3)

πŸ’… MPI_TYPE_GET_TRUE_EXTENT(3) β€” Open MPI, section 3, bestie edition πŸŽ€

okay so this is the Open MPI man page for MPI_Type_get_true_extent and MPI_Type_get_true_extent_x, and it's literally about finding the true lower bound and extent of a data type's typemap while straight-up ignoring MPI_UB and MPI_LB markers. yes, ignoring. we don't see them. they're not in the group chat. πŸ’€


✨ SYNTAX ✨

🩡 C Syntax

#include <mpi.h>

int MPI_Type_get_true_extent(MPI_Datatype datatype,
     MPI_Aint *true_lb, MPI_Aint *true_extent)
int MPI_Type_get_true_extent_x(MPI_Datatype datatype,
     MPI_Count *true_lb, MPI_Count *true_extent)

🌸 Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_TYPE_GET_TRUE_EXTENT(DATATYPE, TRUE_LB, TRUE_EXTENT, IERROR)
     INTEGER DATATYPE, IERROR
     INTEGER(KIND=MPI_ADDRESS_KIND) TRUE_LB, TRUE_EXTENT
MPI_TYPE_GET_TRUE_EXTENT_X(DATATYPE, TRUE_LB, TRUE_EXTENT, IERROR)
     INTEGER DATATYPE, IERROR
     INTEGER(KIND=MPI_COUNT_KIND) TRUE_LB, TRUE_EXTENT

πŸ¦‹ Fortran 2008 Syntax

USE mpi_f08
MPI_Type_get_true_extent(datatype, true_lb, true_extent, ierror)
     TYPE(MPI_Datatype), INTENT(IN) :: datatype
     INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(OUT) :: true_lb, true_extent
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_Type_get_true_extent_x(datatype, true_lb, true_extent, ierror)
     TYPE(MPI_Datatype), INTENT(IN) :: datatype
     INTEGER(KIND = MPI_COUNT_KIND), INTENT(OUT) :: true_lb, true_extent
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🌟 INPUT PARAMETER 🌟

  • datatype β€” the data type you're being nosy about, bestie (handle). πŸ•΅οΈβ€β™€οΈ

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • true_lb β€” the true lower bound of the data type (integer). πŸ’–
  • true_extent β€” the true size of the data type (integer). ✨
  • ierror β€” Fortran only: error status (integer). 🫢

πŸ”₯ DESCRIPTION πŸ”₯

okay bestie, listen. the true_lb parameter hands you back the offset of the lowest unit of store that is addressed by the data type β€” that's the lower bound of the corresponding typemap, and it is fully ignoring MPI_LB markers. like, not invited. πŸ™ˆ

the true_extent parameter gives you the true size of the data type, aka the extent of the corresponding typemap, ignoring MPI_LB and MPI_UB markers, and performing no rounding for alignment. no rounding, no glow-up, just the raw truth. πŸ’…

for both functions: if either the true_lb or true_extent parameter can't express the value it needs to return (e.g., if the parameter is too small to hold the output value), it gets set to MPI_UNDEFINED. yes, it just gives up and says undefined. relatable. 😭

and the true_extent is the minimum number of bytes of memory necessary to hold a data type, uncompressed. minimum. bytes. uncompressed. no cap. 🧚

if you want the full detailed definitions of these parameters in relation to the typemap, go read section 4.1.8 of the MPI-3 standard. it's giving required reading, ngl. πŸ“š

πŸ’€ ERRORS πŸ’€

almost all MPI routines return an error value, bestie β€” C routines as the return result of the function, and Fortran routines in the last argument. classic. 🫠

before that error value comes back, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. and if there's no communication object 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 isn't 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. that's just how it is. πŸ’…


🌈 the three predefined error handlers Open MPI ships with 🌈

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. it's giving main character exit. πŸ’€
  • 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. spicy but contained. πŸ”₯
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one. 🫢

πŸ¦‹ writing your own error handlers (yes you can, icon behavior) πŸ¦‹

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. like, fr fr, don't count on it. 😭

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. πŸ“–


2003-2026, The Open MPI Community


alright bestie, that's the whole page, you ate it up πŸ’…βœ¨ β€” and for the record, this was the Open MPI MPI_TYPE_GET_TRUE_EXTENT(3) page, dated Sep 11, 2026. go forth and get those true extents, queen. πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from