MPI_Psend_init(3)
π MPI_Psend_init π
okay bestie, welcome to the MPI manual page for MPI_Psend_init(3) β yes that's the section-3 MPI page, we're doing the real ones now β¨
πΈ NAME πΈ
MPI_Psend_init β creates a partitioned communication send request π«Ά
β¨ SYNOPSIS β¨
int MPI_Psend_init(const void *buf, int partitions, MPI_Count count,
MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
MPI_Info info, MPI_Request *request)
π INPUT PARAMETERS π
bufβ the initial address of the send buffer (it's a choice, so it can be whatever type you want, we love the freedom π )partitionsβ how many partitions you want (a non-negative integer, no negative vibes allowed)countβ the number of elements you send per partition (also a non-negative integer, same rule bestie)datatypeβ the type of each element (handle)destβ the rank of the destination (integer) π―tagβ the message tag (integer)commβ the communicator (handle)infoβ the info argument (handle)
π¦ OUTPUT PARAMETERS π¦
requestβ the communication request (handle) β this is your lil ticket to the partitioned-send party ποΈ
π THREAD AND INTERRUPT SAFETY π
okay so this one is thread-safe, periodt β¨. which means multiple threads can use it at the same time and you do not need to bring your own thread locks. no user-provided locking, we're free π
BUT. π¨ it is not interrupt safe. and the reason is usually kinda mundane: it uses memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, not its fault, but still β not interrupt safe, no cap.
π NOTES FOR FORTRAN π
- All MPI routines in Fortran (except for
MPI_WTIMEandMPI_WTICK) have an extra argumentierrchillin' at the end of the argument list.ierris an integer and it means exactly the same thing as the return value of the routine in C. - In Fortran, MPI routines are subroutines, and you invoke them with the
callstatement. - All MPI objects (like
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran. yes literally, INTEGER. iykyk π
π ERRORS π
so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β C routines as the value of the function, Fortran routines in that last argument. before that value comes back to you, the current MPI error handler gets called. by default, that handler aborts the MPI job π (dramatic but true).
the error handler can be swapped out 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 also be used, but its use is deprecated β like, don't, bestie. the predefined error handler MPI_ERRORS_RETURN can be used to make error values actually get returned to you instead.
ngl MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. soβ¦ vibes, but not promises π
here's the whole error cast, no one left out:
MPI_SUCCESSβ no error, the MPI routine completed successfully. slay πMPI_ERR_ARGβ invalid argument. some argument is invalid and it's not identified by a specific error class (e.g.,MPI_ERR_RANK).MPI_ERR_BUFFERβ invalid buffer pointer. usually a null buffer where one is not valid.MPI_ERR_COMMβ invalid communicator. a super common one is using a null communicator in a call (not even allowed inMPI_Comm_rank).MPI_ERR_COUNTβ invalid count argument. count arguments must be non-negative; a count of zero is often valid.MPI_ERR_INFOβ invalid InfoMPI_ERR_RANKβ invalid source or destination rank. ranks must be between zero and the size of the communicator minus one; ranks in a receive (MPI_Recv,MPI_Irecv,MPI_Sendrecv, etc.) may also beMPI_ANY_SOURCE.MPI_ERR_TAGβ invalid tag argument. tags must be non-negative; tags in a receive (MPI_Recv,MPI_Irecv,MPI_Sendrecv, etc.) may also beMPI_ANY_TAG. the largest tag value is available through the the attributeMPI_TAG_UB.MPI_ERR_TYPEβ invalid datatype argument. additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code.
π SEE ALSO π
MPI_PreadyMPI_Pready_rangeMPI_Pready_listMPI_StartMPI_StartallMPI_Request_free
and that's the whole page, bestie!! π§ββοΈ this lil masterpiece is from the MPI manual, dated 4/10/2026 β go forth and partition your sends responsibly πβ¨π
π¦ 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