MPI_Type_create_hindexed(3)
π MPI_Type_create_hindexed β bestie's guide π
okay so this is from the MPI manual, section 3 (that's the library-functions girlies, obviously), and it's literally the glow-up tool for making a datatype that's an indexed datatype but with its displacements measured in bytes instead of in extents. no cap.
β¨ NAME β¨
MPI_Type_create_hindexed β Create a datatype for an indexed datatype with displacements in bytes π¦
πΈ SYNOPSIS πΈ
int MPI_Type_create_hindexed(int count, const int array_of_blocklengths[],
const MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_create_hindexed_c(MPI_Count count,
const MPI_Count array_of_blocklengths[],
const MPI_Count array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype *newtype)
look at her. two whole forms. the big-girl _c version with MPI_Count for when your counts are giving astronomically huge π₯
π INPUT PARAMETERS π
countβ the number of blocks, and ALSO the number of entries inarray_of_displacementsandarray_of_blocklengths. it's a non-negative integer bestie, don't play games πarray_of_blocklengthsβ how many elements are in each block (non-negative integer, obviously)array_of_displacementsβ the byte displacement of each block (an integer)oldtypeβ the old datatype (that's a handle, mwah)
π OUTPUT PARAMETERS π
newtypeβ the new datatype, your freshly served handle (also a handle)
π§ THREAD AND INTERRUPT SAFETY π§
so this routine is thread-safe. periodt. that means multiple threads can use it at the same time and you do NOT need to bring your own thread locks, she handles herself π
but um. she is not interrupt safe. the way that this is a thing is typically because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like. mind the gap π
π NOTES FOR FORTRAN π
every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK, those two are the exceptions, they're built different) has an extra argument called ierr chilling at the end of the argument list. ierr is an integer and it means exactly the same thing as the return value of the routine in C. in Fortran, MPI routines are subroutines, and you invoke them with the call statement. yes, call. svc.
also, all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. that's just the vibe over there π
π ERRORS π
all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value. C routines give it back as the value of the function, and Fortran routines put it in the last argument. before that value comes back at you, the current MPI error handler gets called. by default, this error handler literally aborts the whole MPI job π so like, don't be sloppy bestie.
you can change the error handler 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 like, we don't do that anymore, it's giving 1994.
the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.
β οΈ note that MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. key word attempt π
MPI_SUCCESSβ no error, the routine completed successfully. slay! β¨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_COUNTβ invalid count argument. count arguments must be non-negative; a count of zero is often valid. (yes, zero can be valid, she's not like other counts π )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 bestie, don't be sending out uncommitted datatypes, embarrassing π³MPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code.
and that's the whole page, no notes, you ate this fr fr π«Ά
this has been the MPI manual, page MPI_Type_create_hindexed(3), dated 4/10/2026 β sending you all the love, go build something iconic with it ππβ
π¦ 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