MPI_Type_get_extent(3)
π MPI_Type_get_extent β bestie edition π
okay so this is a page from the MPI manual (yes, that MPI, the message-passing one), and today's main character is MPI_Type_get_extent β¨
πΈ NAME πΈ
MPI_Type_get_extent β get the lower bound and extent for a Datatype π¦
like. the shape of your datatype in memory, bestie. where it starts and how far it reaches. iconic behavior honestly.
π SYNOPSIS π
int MPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint *lb, MPI_Aint *extent)
int MPI_Type_get_extent_c(MPI_Datatype datatype, MPI_Count *lb,
MPI_Count *extent)
two flavors, same vibe. pick your size, babe π
π INPUT PARAMETERS π
datatypeβ the datatype you wanna get info on (handle). the little guy you're interrogating π
π OUTPUT PARAMETERS π
lbβ lower bound of datatype (integer). where it all begins, fr fr π±extentβ extent of datatype (integer). how much room it takes up. she's spacious π
π«Ά THREAD AND INTERRUPT SAFETY π«Ά
This routine is thread-safe. what does that mean? it means multiple threads can use it at the same time without you needing to write a single user-provided thread lock. no extra babysitting required, no cap β¨
however (and this is the important part, so listen up bestie π) β the routine is not interrupt safe. why? typically it's because of memory allocation routines like malloc, or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, it's giving thread-safe but not interrupt-safe. two different things, don't get it twisted π
πΊ NOTES FOR FORTRAN πΊ
All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. In Fortran, MPI routines are subroutines, and are invoked with the call statement. π
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. that's just the way it is, periodt π
π₯ ERRORS π₯
All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function and Fortran routines in the last argument. Before the value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job. π
The error handler may be changed with MPI_Comm_set_errhandler (for communicators), MPI_File_set_errhandler (for files), and MPI_Win_set_errhandler (for RMA windows). The MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated β so lowkey don't, bestie, we've moved on π«
The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. she's trying her best π₯Ί
MPI_SUCCESSβ no error; MPI routine completed successfully. we love a clean run πMPI_ERR_ARGβ invalid argument. some argument is invalid and is not identified by a specific error class (e.g.,MPI_ERR_RANK). vague on purpose, smh πMPI_ERR_TYPEβ invalid datatype argument. additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call. commit your types first, babe, it's the law πMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. the catch-all. when in doubt, callMPI_Error_stringπ
ngl the error section is giving "read the docs or cry" energy, but like, that's just MPI for you π
and that's the whole thing bestie!! this page came from the MPI manual, dated 4/10/2026, and if you ever need to find it again it lives under MPI_Type_get_extent(3) π mwah, go forth and get those extents π¦β¨π
π¦ where this page comes from
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms