MPI_TYPE_CREATE_HINDEXED(3)
π MPI_TYPE_CREATE_HINDEXED(3) π
okay so this is the Open MPI manual, bestie, and we're about to talk about the most slay little datatype constructor in the whole MPI_Type_* family. buckle up π
β¨ NAME β¨
MPI_Type_create_hindexed β creates an indexed datatype with offsets in bytes.
πΈ SYNTAX πΈ
π» C Syntax π»
#include <mpi.h>
int MPI_Type_create_hindexed(int count, int *array_of_blocklengths,
MPI_Aint *array_of_displacements, MPI_Datatype oldtype,
MPI_Datatype *newtype)
π§ Fortran Syntax π§
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_TYPE_CREATE_HINDEXED(COUNT, ARRAY_OF_BLOCKLENGTHS,
ARRAY_OF_DISPLACEMENTS, OLDTYPE, NEWTYPE, IERROR)
INTEGER COUNT, ARRAY_OF_BLOCKLENGTHS(*)
INTEGER ARRAY_OF_DISPLACEMENTS(*), OLDTYPE, NEWTYPE
INTEGER IERROR
π₯ INPUT PARAMETERS π₯
countβ the number of blocks, aka the number of entries inarray_of_displacementsandarray_of_blocklengths. it's an integer, no cap. πarray_of_blocklengthsβ how many elements live in each block. it's an array of nonnegative integers, so like, be normal about it. β¨array_of_displacementsβ the byte displacement of each block. in C it's an array ofMPI_Aint; in Fortran it's an array of integer. β¨oldtypeβ the old datatype, as a handle. the blueprint, the blueprint π
π€ OUTPUT PARAMETERS π€
newtypeβ your brand new datatype handle. main character energy fr fr. πierrorβ Fortran only: the error status, as an integer. π
π DESCRIPTION π
so like β this function is literally identical to MPI_Type_indexed except for ONE thing, and it's the thing that matters: the block displacements in array_of_displacements are given in bytes, not in multiples of the oldtype extent. that's the whole vibe check. π₯
say oldtype has type map
{(type(0), disp(0)), ..., (type(n-1), disp(n-1))},
with extent ex. let B be the array_of_blocklength argument and D be the array_of_displacements argument. the newly created datatype has
n x S^count-1
(i=0) B[i] entries:
{(type(0), disp(0) + D[0]),...,(type(n-1), disp(n-1) + D[0]),...,
(type(0), disp(0) + (D[0] + B[0]-1)* ex),...,
type(n-1), disp(n-1) + (D[0]+ B[0]-1)* ex),...,
(type(0), disp(0) + D[count-1]),...,(type(n-1), disp(n-1) + D[count-1]),...,
(type(0), disp(0) + D[count-1] + (B[count-1] -1)* ex),...,
(type(n-1), disp(n-1) + D[count-1] + (B[count-1] -1)* ex)}
like, look at that math. it ate. π«Ά
π¨ ERRORS π¨
almost all MPI routines hand back an error value, bestie: C routines give it to you as the return result of the function, and Fortran routines put it in the last argument. π
before that error value even gets returned, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. if there's no communication object attached to the MPI call, then the call counts as attached to MPI_COMM_SELF and it'll call the associated MPI error handler. when MPI_COMM_SELF is not 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 in the World model, or by using 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 MPI_ERRORS_RETURN gets called for MPI I/O functions and MPI_ERRORS_ABORT gets called for all the other MPI functions. it's giving "the system has opinions". π
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 everyone. πMPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. when it's called on a communicator, it acts as ifMPI_Abortwas called on that communicator. if it's 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 it's called on a session, it aborts only the local process. β¨MPI_ERRORS_RETURNβ returns an error code to the application. polite. respectful. π
MPI applications can also implement their own error handlers by calling:
MPI_Comm_create_errhandlerand thenMPI_Comm_set_errhandlerMPI_File_create_errhandlerand thenMPI_File_set_errhandlerMPI_Session_create_errhandlerand thenMPI_Session_set_errhandler, or atMPI_Session_initMPI_Win_create_errhandlerand thenMPI_Win_set_errhandler
note that MPI does not guarantee that an MPI program can continue past an error. so like, don't count on it, babe. π
see the MPI man page for a full list of MPI error codes. π
see the Error Handling section of the MPI-3.1 standard for more information. π
see also:
MPI_Type_create_structMPI_Type_create_hvectorMPI_Type_indexed
π Copyright π
2003-2026, The Open MPI Community
okay that's the whole page, bestie, ily π«Ά it's from Sep 10, 2026 and it lives in the MPI_TYPE_CREATE_HINDEXED(3) slot of the Open MPI manual β go build something iconic with it. πβ¨π
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms