MPI_Get(3)

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

πŸ’– 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_WTIME and MPI_WTICK) gets an extra argument called ierr tacked onto 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. yes, the whole call thing. very retro, very slay. πŸ’œ
  • every MPI object β€” like MPI_Datatype, MPI_Comm β€” is of type INTEGER in 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 communicators
  • MPI_File_set_errhandler β€” for files
  • MPI_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 be MPI_ANY_SOURCE. ✨
  • MPI_ERR_TYPE β€” invalid datatype argument. also, this error can happen if you use an uncommitted MPI_Datatype (see MPI_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. use MPI_Error_string to 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