MPI_TYPE_HVECTOR(3)

πŸ’… MPI_TYPE_HVECTOR(3) πŸ’…

ok so real talk bestie, this is an Open MPI page β€” welcome to the strided-datatype corner of the universe πŸ¦‹


✨ NAME ✨

MPI_Type_hvector β€” makes you a vector (strided) datatype where the offset is measured in bytes. but babes, heads up: this routine is deprecated in favor of MPI_Type_create_hvector 😭


🌸 SYNTAX 🌸

πŸŽ€ C Syntax

#include <mpi.h>

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

πŸŽ€ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'

MPI_TYPE_HVECTOR(COUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE,
             IERROR)
     INTEGER COUNT, BLOCKLENGTH, STRIDE, OLDTYPE
     INTEGER NEWTYPE, IERROR

πŸ’– INPUT PARAMETERS πŸ’–

  • count β€” how many blocks you're working with. it's a nonnegative integer, no cap, no drama 🫢
  • blocklength β€” how many elements live inside each one of those blocks. also a nonnegative integer ✨
  • stride β€” the number of bytes between the start of each block. integer, and yes the byte thing is literally the whole point of this variant πŸ’…
  • oldtype β€” the old datatype, as a handle. the blueprint you're building on 🧚

🌈 OUTPUT PARAMETERS 🌈

  • newtype β€” your brand new datatype, as a handle. main character energy πŸ‘‘
  • ierror β€” Fortran only: the error status, as an integer πŸ’€

⭐ DESCRIPTION ⭐

so here's the tea πŸ“ β€” use of this routine is deprecated as of MPI-2. like, it's not evil, it's just old news. the glow-up you want is MPI_Type_create_hvector instead. slay, moving on ✨


😭 ERRORS 😭

almost every MPI routine hands you back an error value, no cap:

  • C routines give it to you as the return result of the function πŸ”₯
  • Fortran routines tuck it into the last argument πŸŽ€

and before that error value even reaches you, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. that's just how it goes πŸ’…

if there's no communication object associated with the MPI call, then the call counts as being attached to MPI_COMM_SELF and it'll call that associated MPI error handler. πŸ¦‹

now, 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 using the World model 🌍
  • or via the mpi_initial_errhandler CLI argument to mpiexec πŸ’»
  • or via the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple 🐣

and 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 other MPI functions. periodt πŸ’€

Open MPI ships three predefined error handlers you can use, and honestly they're iconic:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. dramatic? yes. effective? also yes 😭
  • 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 if MPI_Abort was called on that communicator. if it's called on a window or file, it acts as if MPI_Abort was 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. the chill one 🫢

MPI applications can also implement their own error handlers by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler
⚠️ note that MPI does not guarantee that an MPI program can continue past an error. like, fr fr, don't assume you can just keep vibing after one πŸ’€

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_hvector β€” the non-deprecated glow-up, go here first bestie πŸ’–
  • MPI_Type_vector 🌸

2003-2026, The Open MPI Community


and that's the whole page, bestie πŸ’œ this little gem was served up on Sep 11, 2026 by the lovely humans of The Open MPI Community β€” go forth and stride responsibly πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from