MPI_File_get_type_extent(3)
π MPI_File_get_type_extent β bestie edition π
okay so you found yourself a page in the MPI manual, section 3, and it's all about MPI_File_get_type_extent. pull up a chair, grab a boba, we're doing this π§β¨
β¨ NAME β¨
MPI_File_get_type_extent β returns the extent of datatype in the file π
πΈ SYNOPSIS πΈ
int MPI_File_get_type_extent(MPI_File fh, MPI_Datatype datatype,
MPI_Aint *extent)
int MPI_File_get_type_extent_c(MPI_File fh, MPI_Datatype datatype,
MPI_Count *extent)
like, two whole versions, the classic one and the _c one that hands you a big ol' MPI_Count instead of an MPI_Aint. iconic of them tbh π
π INPUT PARAMETERS π
fhβ the file handle π (yes it's a handle, we love that for it)datatypeβ the datatype, also a handle π¦
π OUTPUT PARAMETERS π
extentβ the datatype extent, an integer, and it's yours now π«Ά
π THREAD AND INTERRUPT SAFETY π
good news and meh news, bestie. this routine is thread-safe β¨ which means multiple threads can vibe with it at the same time and you do not need to bring your own thread locks. no cap.
but π it is not interrupt safe. and why? typically because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like... it's giving "great at parties, cannot be interrupted mid-sentence." noted.
π§ NOTES FOR FORTRAN π§
every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) gets one extra argument at the end of the argument list, and that's ierr. it's an integer and it means exactly the same thing as the return value of the routine in C. so literally the same info, just... relocated.
also, in Fortran, MPI routines are subroutines, and you invoke them with the call statement. periodt.
and!!! all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. so don't be weird about it π
π ERRORS π
okay so all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β C routines as the value of the function itself, and Fortran routines in that last argument. before that value comes back to you, the current MPI error handler gets called. and by default? that error handler aborts the MPI job. π so yeah, dramatic.
the error handler can be swapped out 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 β like, we don't do that anymore, it's retired, respect the elders but don't imitate them π
the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned.
β οΈ heads up: MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. so like, no promises, but they'll try π₯Ί
here's the error code roster, one bullet each, no skipping:
MPI_SUCCESSβ no error, the routine completed successfully, we ate πMPI_ERR_ARGβ invalid argument. some argument is invalid and is not identified by a specific error class (e.g.,MPI_ERR_RANK).MPI_ERR_TYPEβ invalid datatype argument. additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code.
and that's the whole page, bestie π this dropped on 4/10/2026 and yep, it's another banger from the MPI_File_get_type_extent(3) collection. go forth and know your 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