MPI_Type_contiguous(3)
π MPI_Type_contiguous(3) π
okay bestie, welcome to the MPI manual, and today's main character is MPI_Type_contiguous β she's giving "make me a brand new datatype that's just a bunch of the old one, back to back, no gaps, no drama" π
β¨ NAME β¨
MPI_Type_contiguous β Creates a contiguous datatype π§
πΈ SYNOPSIS πΈ
int MPI_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype)
int MPI_Type_contiguous_c(MPI_Count count, MPI_Datatype oldtype,
MPI_Datatype *newtype)
two flavours, same energy, pick ur fighter π«Ά
π INPUT PARAMETERS π
countβ the replication count, aka how many times we're copying the vibe. must be a non-negative integer fr fr, don't try to be quirky with negatives πoldtypeβ the old datatype (a handle). the original icon we're duplicating π
π¦ OUTPUT PARAMETERS π¦
newtypeβ the new datatype (a handle). the glow-up, freshly baked, all yours β¨
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe π which literally means multiple threads can use it at the same time with zero user-provided thread locks needed. no babysitting, no gatekeeping, just vibes π
BUT β and this is the plot twist β the routine is not interrupt safe π Typically this is because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, thread-safe yes, interrupt-safe no, we contain multitudes.
π 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. iykyk β¨
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. periodt π
π 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 π so like, pay attention bestie.
The error handler may be changed with:
MPI_Comm_set_errhandler(for communicators)MPI_File_set_errhandler(for files)MPI_Win_set_errhandler(for RMA windows)
The MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated π© (we don't do that anymore, it's giving legacy).
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. so, like, fingers crossed π€
here's the error roster:
MPI_SUCCESSβ No error; MPI routine completed successfully. ate and left no crumbs π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 counts, she's valid π )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 ur datatypes bestie, don't be that girlMPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code. the mysterious one π«οΈ
and that's the whole page, no notes, we ate πβ¨π
this lil love letter came from the MPI manual, dated 4/10/2026, and it's filed under MPI_Type_contiguous(3) β go forth and build contiguous datatypes, my gorgeous little parallel-computing genius ππ¦
π¦ 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