MPI_Rput(3)

πŸ“¦
version 5.0.1 Β· 5 versions
, in nixos 26.05, ubuntu stonking

πŸ’– MPI_Rput β€” bestie edition πŸ’–

okay so this is a page from the MPI manual, section 3, and it's literally all about MPI_Rput ✨

🌸 NAME 🌸

MPI_Rput β€” put data into a memory window on a remote process and return a request 🫢

like. you're yeeting data INTO someone else's memory window and you get a lil request handle back so you can check on it later. main character energy fr.


πŸŽ€ SYNOPSIS πŸŽ€

int MPI_Rput(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Win win, MPI_Request *request)

int MPI_Rput_c(const void *origin_addr, MPI_Count origin_count,
MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, MPI_Count target_count,
MPI_Datatype target_datatype, MPI_Win win, MPI_Request *request)

two versions, no cap: the regular one and the _c one (that's the big-count girlie, she takes MPI_Count instead of int for the counts πŸ’…).


✨ INPUT PARAMETERS ✨

  • origin_addr β€” initial address of origin buffer (choice). yes babe, it's a choice type apparently, iconic πŸ’…
  • origin_count β€” number of entries in origin buffer (non-negative integer). keep it non-negative or it's giving error 🚫
  • origin_datatype β€” datatype of each entry in origin buffer (handle)
  • target_rank β€” rank of target (non-negative integer). who we sending this to bestie πŸ‘€
  • target_disp β€” displacement from start of window to target buffer (non-negative integer)
  • target_count β€” number of entries in target buffer (non-negative integer)
  • target_datatype β€” datatype of each entry in target buffer (handle)
  • win β€” window object used for communication (handle). the whole vibe depends on this one 🌈

πŸ¦‹ OUTPUT PARAMETERS πŸ¦‹

  • request β€” RMA request (handle). this is your lil receipt, hold onto it πŸ’–

πŸ’œ THREAD AND INTERRUPT SAFETY πŸ’œ

okay so good news first: this routine is thread-safe. that means it can be safely used by multiple threads without you needing to provide any thread locks of your own. slay ✨

BUT. it is not interrupt safe. and the reason is lowkey always the same vibe: it uses memory allocation routines like malloc, or other non-MPICH runtime routines, and those things are themselves not interrupt-safe. so like, not her fault, it's the friends she hangs with 😭


🧚 NOTES FOR FORTRAN 🧚

all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an extra argument ierr tacked onto the end of the argument list. ierr is an integer and it means the exact same thing as the return value of the routine in C. in Fortran, MPI routines are subroutines, and you call them with the call statement. periodt.

also: all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. so don't come at them with anything else πŸ™ˆ


πŸ”₯ ERRORS πŸ”₯

every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines give it back as the value of the function, Fortran routines put it in the last argument. before that value ever gets returned, the current MPI error handler gets called. and by default? that error handler aborts the MPI job. no warning shot. πŸ’€

you can swap the error handler out 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 too, but bestie... its use is deprecated. we don't do that anymore 🚫

you can use the predefined error handler MPI_ERRORS_RETURN to make error values actually get returned instead. note that MPI does not guarantee your program can continue past an error; however, MPI implementations will attempt to continue whenever possible. she tries her best 🫢

here's the error code menu:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. ate. πŸ’…
  • 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_BUFFER β€” Invalid buffer pointer. Usually a null buffer where one is not valid.
  • MPI_ERR_COUNT β€” Invalid count argument. Count arguments must be non-negative; a count of zero is often valid.
  • MPI_ERR_DISP β€” (that's it, that's the whole description, she's mysterious like that 😭)
  • 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_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_WIN β€” Invalid MPI window object
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.
⚠️ reminder that the default error handler aborts the whole job, so if you're out here passing invalid args, that's not a vibe check, that's a whole catastrophe 😭

πŸ‘‘ SEE ALSO πŸ‘‘

MPI_Put


that's the whole page bestie, go be iconic with it πŸ’–βœ¨πŸŒΈ

this was MPI_Rput(3) from the MPI manual, dated 4/10/2026 β€” so like, remember which version you read, iykyk πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from