MPI_Send(3)
π MPI_Send(3) β the manual page, but make it make sense
okay bestie, welcome to MPI_Send from the MPI manual, section 3 π«Ά this is the one where you literally just... send a message. blocking style. main character energy fr fr.
β¨ NAME β¨
MPI_Send β Performs a blocking send
like. it sends. and it blocks. that's the whole vibe. π
πΈ SYNOPSIS πΈ
int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm)
int MPI_Send_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)
two flavors, same energy: the classic one with int count, and the _c one with MPI_Count count for when your counts are β¨bigβ¨.
π INPUT PARAMETERS π
bufβ initial address of send buffer (choice). it's giving "here's my stuff, take it" πcountβ number of elements in send buffer (non-negative integer). no negatives, we don't do that here πdatatypeβ datatype of each send buffer element (handle)destβ rank of destination (integer). who's receiving this masterpiece πtagβ message tag (integer). your little label so the receiver knows what's upcommβ communicator (handle). the group chat this message lives in
π¦ NOTES π¦
This routine may block until the message is received by the destination process.
so yeah, it can just sit there waiting. patiently. like you waiting for a text back π not necessarily forever, but it may block, that's the deal.
π THREAD AND INTERRUPT SAFETY π
This routine is thread-safe. that means the routine may be safely used by multiple threads without the need for any user-provided thread locks. slay. no extra lock work needed from you, bestie β¨
However, the routine is not interrupt safe. typically this is due to the use of memory allocation routines such as malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so thread-safe: yes. interrupt-safe: absolutely not, and that's on malloc π
π 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 get invoked with the call statement. old school, but iconic π
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. no cap.
π₯ 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. π
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 β οΈ (we don't do deprecated around here, lowkey).
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... it might recover. it might not. vibe check at your own risk π
MPI_SUCCESSβ No error; MPI routine completed successfully. we love a clean win β¨MPI_ERR_BUFFERβ Invalid buffer pointer. Usually a null buffer where one is not valid.MPI_ERR_COMMβ Invalid communicator. A common error is to use 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_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_IsendMPI_Bsend
ok so that's the whole page, no skips, no cuts, every single flag and code accounted for π if you're gonna copy anything, copy the parameter order, not my attitude.
and that's a wrap, bestie π«Ά this was the MPI version, page MPI_Send(3), dated 4/10/2026. go forth and block 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