MPI_Get(3)
π MPI_Get(3) β the "gimme that data, bestie" page π
okay so first things first: this is a MPI manual page. Yes, that MPI. The big parallel-computing one. Welcome to the group chat π«Ά
β¨ NAME β¨
MPI_Get β Get data from a memory window on a remote process
like. you're reaching into somebody else's memory window and pulling data out. iconic behavior tbh π
β¨ SYNOPSIS β¨
int MPI_Get(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)
int MPI_Get_c(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)
two flavors, bestie β the classic one and the _c one with the big MPI_Count energy. β¨
β¨ INPUT PARAMETERS β¨
origin_countβ how many entries are chillin' in your origin buffer. non-negative integer, so don't come in here with a negative number, that's not the vibe. πorigin_datatypeβ the datatype of each entry in the origin buffer. it's a handle. πtarget_rankβ the rank of the target. non-negative integer. who are we getting this from? that one. πtarget_dispβ displacement from the start of the window to the beginning of the target buffer. non-negative integer. it's giving "directions to the data". π§target_countβ number of entries in the target buffer. non-negative integer. πΈtarget_datatypeβ datatype of each entry in the target buffer. handle. πwinβ the window object used for communication. handle. this is the whole portal, lowkey. π
β¨ OUTPUT PARAMETERS β¨
origin_addrβ initial address of the origin buffer (choice). yeah it's an output param but also a "choice" which is MPI-speak for "it's a pointer-ish thing, we're being flexible". π«
β¨ THREAD AND INTERRUPT SAFETY β¨
okay so good news: this routine is thread-safe. that means multiple threads can safely use it and you do not need to bring your own thread locks. periodt. π
but β and this is the important part β it is not interrupt safe. π typically that's because it uses memory allocation routines like malloc, or other non-MPICH runtime routines, and those are themselves not interrupt-safe.
so: threads? yes bestie. interrupts? absolutely not. π
β¨ NOTES FOR FORTRAN β¨
- every MPI routine in Fortran (except
MPI_WTIMEandMPI_WTICK) gets an extra argument calledierrtacked onto 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. yes, the wholecallthing. very retro, very slay. π - every MPI object β like
MPI_Datatype,MPI_Commβ is of typeINTEGERin Fortran. no cap. β
β¨ ERRORS β¨
okay so literally every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value. in C it's the value of the function, in Fortran it's the last argument. before that value comes back to you, the current MPI error handler gets called. π
by default, that error handler aborts the MPI job. like, whole thing, gone, bye. π
you can swap the error handler out with:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows
the MPI-1 routine MPI_Errhandler_set may be used, but its use is deprecated. that's not a vibe, don't do it if you can help it. π
there's also the predefined error handler MPI_ERRORS_RETURN, which you can use to make error values get returned to you instead of the whole thing exploding. π
β οΈ note that MPI does not guarantee your program can keep going past an error. however, MPI implementations will attempt to continue whenever possible. so likeβ¦ maybe. fingers crossed. π€
the error codes themselves π
MPI_SUCCESSβ no error, the MPI routine completed successfully. we love this one. πΈMPI_ERR_BUFFERβ invalid buffer pointer. usually it's a null buffer where a null buffer is not valid. nope nope nope. π«MPI_ERR_COUNTβ invalid count argument. counts must be non-negative; a count of zero is often valid though, so don't panic. πMPI_ERR_DISPβ (the page literally lists this one with no description. blank. empty. we don't make the rules bestie π)MPI_ERR_RANKβ invalid source or destination rank. ranks have to 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. also, this error can happen if you use an uncommittedMPI_Datatype(seeMPI_Type_commit) in a communication call. commit ur types bestie it's the law. πMPI_ERR_WINβ invalid MPI window object. πMPI_ERR_OTHERβ other error. useMPI_Error_stringto get more info about this error code. the catch-all of catch-alls. π«
β¨ SEE ALSO β¨
MPI_Rgetβ the request-flavored sibling, go say hi π
okay that's the whole page, and honestly? ate. π β¨
this was MPI_Get(3) from MPI, dated 4/10/2026 β mwah, go get that remote data bestie, you got this ππ¦π
π¦ 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