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_WTIME and MPI_WTICK) have an extra argument ierr chillin' at the end of the argument list. ierr is 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 call statement.
  • All MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in 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 in MPI_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 Info
  • 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 be MPI_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 be MPI_ANY_TAG. the largest tag value is available through the the attribute MPI_TAG_UB.
  • 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.
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more information about this error code.

πŸ‘‘ SEE ALSO πŸ‘‘

  • MPI_Pready
  • MPI_Pready_range
  • MPI_Pready_list
  • MPI_Start
  • MPI_Startall
  • MPI_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