MPI_Rput(3)
π 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 beMPI_ANY_SOURCE.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_WINβ Invalid MPI window objectMPI_ERR_OTHERβ Other error; useMPI_Error_stringto 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
- 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