MPI_File_iread_at_all(3)

πŸ’– MPI_File_iread_at_all(3) β€” the MPI manual, bestie edition πŸ’–

okay so this is MPI_File_iread_at_all(3) from the MPI manual and I am so excited to tell you about it because this little function is lowkey a whole baddie πŸ¦‹


✨ NAME ✨

MPI_File_iread_at_all β€” Nonblocking collective read using explicit offset

like... it reads your file, it's collective, it's nonblocking, and you get to say exactly where in the file to start. main character energy fr fr πŸ‘‘


✨ SYNOPSIS ✨

int MPI_File_iread_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count,
MPI_Datatype datatype, MPI_Request *request)

int MPI_File_iread_at_all_c(MPI_File fh, MPI_Offset offset, void *buf,
MPI_Count count, MPI_Datatype datatype,
MPI_Request *request)

two flavors, both slay πŸ’… the second one is the _c version and it takes an MPI_Count for count instead of an int, iykyk.


✨ INPUT PARAMETERS ✨

these are the things you gotta hand over, no cap:

  • fh β€” file handle (handle). it's your file, your boo, your connection 🫢
  • offset β€” file offset (integer). this is the explicit "start reading from here" energy ✨
  • count β€” number of elements in buffer (integer). how many you want, bestie, count them out πŸ“
  • datatype β€” datatype of each buffer element (handle)

✨ OUTPUT PARAMETERS ✨

stuff you get back: πŸ’–

  • buf β€” initial address of buffer (choice). where the reading magic lands 🌸
  • request β€” request object (handle). hold onto this one, you'll need it later to check on your read πŸ’…

✨ THREAD AND INTERRUPT SAFETY ✨

This routine is thread-safe. that means this routine may be safely used by multiple threads without the need for any user-provided thread locks. so go off, multi-threaded queen πŸ‘‘

BUT β€” the routine is not interrupt safe. and why, you ask? typically this is due to the use of memory allocation routines such as malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like... thread-safe yes, interrupt-safe no, and that's just the tea 😭


✨ NOTES FOR FORTRAN ✨

fortran besties, this one's for you πŸŽ€

All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. In Fortran, MPI routines are subroutines, and they are invoked with the call statement.

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran.

okay and that's just how fortran do πŸ’œ


✨ ERRORS ✨

All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function and Fortran routines in the last argument. Before the value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job. 😭

that's not a vibe check you want to fail, bestie. the default handler will literally end your whole program. no cap.

The error handler may be changed 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 be used but its use is deprecated. The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible.

here's the error code menu, take your pick πŸ“:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. (the slay outcome ✨)
  • MPI_ERR_ARG β€” Invalid argument. Some argument is invalid and is not identified by a specific error class (e.g., MPI_ERR_RANK). (mystery argument, rude πŸ’€)
  • MPI_ERR_BUFFER β€” Invalid buffer pointer. Usually a null buffer where one is not valid. (buffer said "i'm not here" πŸ™ˆ)
  • MPI_ERR_COUNT β€” Invalid count argument. Count arguments must be non-negative; a count of zero is often valid. (negative count = not the move 😀)
  • 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. (commit your types, periodt! πŸ‘‘)
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code. (the catch-all, go ask MPI_Error_string for the details πŸ”₯)

okay that's the whole page, you ate that 🫢 this was the MPI_File_iread_at_all(3) manpage from the MPI manual, dated 4/10/2026, and that's the footer, so consider yourself signed off on with a little kiss πŸ’–βœ¨πŸ§šπŸŒˆβ­πŸ’œ

πŸ“¦ where this page comes from