MPI_Type_create_hvector(3)

πŸ“¦
version 5.0.1 Β· 5 versions
, in nixos 26.05, ubuntu stonking

πŸ’– MPI_Type_create_hvector(3) πŸ’–

okay bestie, welcome to the MPI corner of the manual, this one's MPI_Type_create_hvector and she is so useful. πŸ¦‹

✨ NAME ✨

MPI_Type_create_hvector β€” create a datatype with a constant stride given in bytes

🌸 SYNOPSIS 🌸

int MPI_Type_create_hvector(int count, int blocklength, MPI_Aint stride,
MPI_Datatype oldtype, MPI_Datatype *newtype)

int MPI_Type_create_hvector_c(MPI_Count count, MPI_Count blocklength,
MPI_Count stride, MPI_Datatype oldtype,
MPI_Datatype *newtype)

πŸŽ€ INPUT PARAMETERS πŸŽ€

  • count β€” number of blocks (non-negative integer) πŸ’…
  • blocklength β€” number of elements in each block (non-negative integer)
  • stride β€” number of bytes between start of each block (integer). yes bestie, bytes, that's the whole point of the h, no cap 🧚
  • oldtype β€” old datatype (handle)

πŸ’œ OUTPUT PARAMETERS πŸ’œ

  • newtype β€” new datatype (handle) β€” the shiny new baby you just made ✨

πŸ”₯ THREAD AND INTERRUPT SAFETY πŸ”₯

This routine is thread-safe. That means it's totally fine to use it from multiple threads at the same time, and you don't gotta bring your own thread locks, no user-provided locks needed, periodt. πŸ‘‘

But lowkey, it is not interrupt safe though. 😭 Typically that's because it uses memory allocation routines like malloc, or other non-MPICH runtime routines, and those are themselves not interrupt-safe. so yeah, threads = yes, interrupts = absolutely not.

🌈 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 they're invoked with the call statement.

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. iconic behavior honestly. πŸ’–

πŸ’€ 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. 😭 (yeah, dramatic, but true.)

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 β€” like, use the new ones please. 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. 🫢

  • MPI_SUCCESS β€” No error; MPI 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.
  • MPI_ERR_TYPE β€” Invalid datatype argument. Additionally, this error can occur if an uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call. commit ur types bestie, fr fr πŸ™ˆ
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

and that's the whole vibe check, babe. πŸ’… this page came from the MPI manual, dated 4/10/2026, and it's titled MPI_Type_create_hvector(3). go forth and stride in bytes, queen πŸ‘‘πŸŒΈ

πŸ“¦ where this page comes from