MPI_FILE_IREAD_AT(3)

πŸ’– MPI_FILE_IREAD_AT πŸ’–

okay so bestie, this is a page from the Open MPI manual, and we're talking about MPI_FILE_IREAD_AT(3) β€” like, the whole squad of MPI file-reading routines but make it async. sit down, grab a strawberry, we're doing this. πŸ“

✨ NAME ✨

MPI_File_iread_at β€” reads a file at an explicitly specified offset, nonblocking, noncollective. that's it, that's the whole name, and honestly it ate. πŸ’…


πŸŽ€ SYNTAX πŸŽ€

C Syntax

#include <mpi.h>

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

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_IREAD_AT(FH, OFFSET, BUF, COUNT, DATATYPE, REQUEST, IERROR)
     <type>  BUF(*)
     INTEGER FH, COUNT, DATATYPE, REQUEST, IERROR
     INTEGER(KIND=MPI_OFFSET_KIND)   OFFSET

Fortran 2008 Syntax

USE mpi_f08
MPI_File_iread_at(fh, offset, buf, count, datatype, request, ierror)
     TYPE(MPI_File), INTENT(IN) :: fh
     INTEGER(KIND=MPI_OFFSET_KIND), INTENT(IN) :: offset
     TYPE(*), DIMENSION(..), ASYNCHRONOUS :: buf
     INTEGER, INTENT(IN) :: count
     TYPE(MPI_Datatype), INTENT(IN) :: datatype
     TYPE(MPI_Request), INTENT(OUT) :: request
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

three whole flavours, no cap. pick your language, we move. 🌈


πŸ“₯ INPUT PARAMETERS πŸ“₯

  • fh β€” file handle, it's a handle. your little passport to the file, basically. πŸ›‚
  • offset β€” file offset, an integer. where in the file we're looking, bestie.
  • count β€” number of elements in the buffer, an integer. how many lil things we're grabbing.
  • datatype β€” data type of each buffer element, a handle. yes, every single element, no shortcuts.

πŸ“€ OUTPUT PARAMETERS πŸ“€

  • buf β€” initial address of the buffer (choice). this is where the reading lands, bestie, it's the whole point. 🫢
  • request β€” request object, a handle. you hold onto this, it's literally the main character of the next chapter (spoiler: you'll be waiting on it). πŸ‘‘
  • ierror β€” Fortran only: error status, an integer. Fortran girlies, this one's for you. ✨

πŸ’… DESCRIPTION πŸ’…

MPI_File_iread_at is the nonblocking version of MPI_File_read_at. so like, same energy, but it does not make you stand there waiting. iconic behaviour honestly.

MPI_File_iread_at is a nonblocking routine that attempts to read from the file associated with fh at the offset position, a total number of count data items having datatype type, into the user's buffer buf. read that again if you need to, it's giving very precise. πŸ’€

the offset is in etype units relative to the current view. that is, holes are not counted when locating an offset β€” okay so the file is like a group chat with deleted messages, and this offset ignores the gaps, it only counts the actual stuff. the data is taken out of those parts of the file specified by the current view.

MPI_File_iread_at stores the number of datatype elements actually read in status. all other fields of status are undefined. so like, do not go poking at the other fields expecting lore, they are truly not giving anything. πŸ™ˆ


πŸ’€ ERRORS πŸ’€

almost every MPI routine returns an error value, fr fr β€” C routines as the return result of the function, and Fortran routines in the last argument.

before the error value is returned, the current MPI error handler associated with the communication object (like, a communicator, window, or file) gets called. if no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler.

when MPI_COMM_SELF is not initialized (i.e., before MPI_Init / MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively), the error raises the initial error handler. and you can change that initial error handler:

  • by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or
  • the mpi_initial_errhandler CLI argument to mpiexec, or
  • the info key to MPI_Comm_spawn / MPI_Comm_spawn_multiple.

if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions, and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. noted. periodt.

Open MPI includes three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. yeah. everyone. the whole group chat is going down. 😭
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. when called on a communicator, it acts as if MPI_Abort was called on that communicator. if called on a window or file, it acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. if called on a session, it aborts only the local process.
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one, lowkey. 🌸

MPI applications can also implement their own error handlers by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler
note that MPI does not guarantee that an MPI program can continue past an error. like, this is not a "it'll be fine" situation, bestie. it might genuinely not be fine. πŸ’€

see the MPI man page for a full list of MPI error codes.

see the Error Handling section of the MPI-3.1 standard for more information. iykyk. πŸ“š


2003-2026, The Open MPI Community


and that's the whole page, you're so welcome. this was rendered on Sep 10, 2026, straight from the Open MPI docs, and yes the page header and footer both say MPI_FILE_IREAD_AT(3) because we stay consistent in this house. go read your files nonblockingly, queen. βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from