MPI_Type_get_value_index(3)
π MPI_Type_get_value_index β the manual page, but make it cute
okay bestie, so this is the page for MPI_Type_get_value_index from the MPI manual (section 3, the library-call girlies π§). Sit down, grab a strawberry lemonade, and let's get into it.
β¨ NAME β¨
MPI_Type_get_value_index β hands you back a handle to a predefined datatype that's suitable for using with MPI_MINLOC and MPI_MAXLOC, but only if such a predefined type actually exists. if it doesn't? well. that's a whole thing. π
πΈ SYNOPSIS πΈ
int MPI_Type_get_value_index(MPI_Datatype value_type, MPI_Datatype index_type,
MPI_Datatype *pair_type)
π INPUT PARAMETERS π
value_typeβ the datatype of the value in the pair (it's a handle, bestie)index_typeβ the datatype of the index in the pair (also a handle)
π OUTPUT PARAMETERS π
pair_typeβ the datatype of the value-index pair (yep, also a handle)
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe, no cap. that means multiple threads can use it at the same time and you do not need to bring your own user-provided thread locks. she handles herself. π
bUT. and this is the important part. 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, not her fault, it's the friend group she's running with π
π NOTES FOR FORTRAN π
Every single MPI routine in Fortran (except MPI_WTIME and MPI_WTICK, the special little exceptions) has an extra argument at the end of the argument list called ierr. ierr is an integer and it means the exact 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. periodt.
Also, all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. that's just the vibe over there.
π ERRORS π
okay so all MPI routines (again, except MPI_Wtime and MPI_Wtick) return an error value β C routines as the value of the function, and Fortran routines in that last argument. before the value gets returned, the current MPI error handler is called.
π¨ by default, that error handler aborts the MPI job. like, whole program, gone. bestie, do not play with this.
you can change the error handler:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows
there's also the MPI-1 routine MPI_Errhandler_set, which may be used, but its use is deprecated π (so like, iykyk, don't do it).
the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.
and note: MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. so it's giving hope, but conditional hope. π«Ά
Here's the error list, one by one:
MPI_SUCCESSβ no error; the MPI routine completed successfully. we love a clean run β¨MPI_ERR_ARGβ invalid argument. some argument is invalid and it's not identified by a specific error class (e.g.,MPI_ERR_RANK). vague?? iconic?? π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, it's the bare minimumMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. it's the "miscellaneous" pile and she's still valid
anyway that's the whole page, you ate that, go call MPI_Type_get_value_index responsibly π
this was MPI_Type_get_value_index(3), baby β version dated 4/10/2026, and it lives in the MPI section 3 manual set. mwah, take care of her π
π¦ 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