MPI_TYPE_GET_TRUE_EXTENT_X(3)
π MPI_TYPE_GET_TRUE_EXTENT_X(3) β an Open MPI moment β¨
okay bestie, sit down, because today we're learning about MPI_Type_get_true_extent and MPI_Type_get_true_extent_x β the twin icons from the Open MPI manual. They return the true lower bound and extent of a data type's corresponding typemap, and the whole vibe is that they ignore MPI_UB and MPI_LB markers. no cap, that's the entire personality. π
πΈ SYNOPSIS πΈ
β¨ 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. it's a handle, and it's the one you want info on. π
π«Ά OUTPUT PARAMETERS π«Ά
true_lbβ the true lower bound of the data type. it's an integer, it's giving "where does the actual data start". βtrue_extentβ the true size of the data type. also an integer. literally the real estate footprint, no rounding, no games. π₯ierrorβ Fortran only, bestie! it's the error status, and yes it's an integer. π
π§ DESCRIPTION π§
so the true_lb parameter returns the offset of the lowest unit of store that is addressed by the data type β meaning the lower bound of the corresponding typemap, with MPI_LB markers completely ignored. bye to those markers, we don't see them. π
and true_extent returns the true size of the data type: the extent of the corresponding typemap, ignoring both MPI_LB and MPI_UB markers, and performing no rounding for alignment. zero alignment glow-up. none. periodt.
for both functions: if either thetrue_lbortrue_extentparameter can't express the value it's supposed to return (like, the parameter is literally too small to hold the output value), it gets set toMPI_UNDEFINED. that's the fallback queen. π
true_extent is the minimum number of bytes of memory necessary to hold a data type, uncompressed. so it's the raw, un-squished size. π
if you want the detailed lore and definitions of these parameters in relation to the typemap, go read section 4.1.8 of the MPI-3 standard. iykyk. π
π ERRORS π
almost all MPI routines return an error value, bestie β C routines hand it back as the return result of the function, and Fortran routines put it in the last argument. classic. π
before that error value comes back, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. and if there's no communication object attached to the MPI call, then the call is considered attached to MPI_COMM_SELF and it'll call the associated MPI error handler. simple as that.
when MPI_COMM_SELF isn't initialized (i.e., 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. and 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 the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. so many options, so little time. π
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. that's the rule. π¦
Open MPI ships with three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. dramatic, but make it effective. π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. context is everything, bestie. β¨MPI_ERRORS_RETURNβ returns an error code to the application. the chill 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
note that MPI does not guarantee that an MPI program can continue past an error. so don't be cute about 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 info. go off, queen. ππ
π COPYRIGHT π
2003-2026, The Open MPI Community
and that's the whole page, bestie!! πβ¨ no cap, you ate that. stay iconic out there in typemap land β π signed off from the Open MPI corner of the universe, dated Sep 11, 2026. periodt. π ππ¦
π¦ 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