MPI_FILE_READ_AT_ALL(3)
π MPI_FILE_READ_AT_ALL(3) π
okay bestie, you found a page from the Open MPI manual β it's the MPI_FILE_READ_AT_ALL(3) one β and honestly? it's giving "collective file reading, but make it explicit offsets." let's get into it π«Ά
β¨ NAME β¨
MPI_File_read_at_all β Reads a file at explicitly specified offsets (blocking, collective).
πΈ SYNTAX πΈ
π C Syntax
#include <mpi.h>
int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset,
void *buf, int count, MPI_Datatype datatype,
MPI_Status *status)
π Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_READ_AT_ALL(FH, OFFSET, BUF, COUNT,
DATATYPE, STATUS, IERROR)
<type> BUF(*)
INTEGER FH, COUNT, DATATYPE, STATUS(MPI_STATUS_SIZE), IERROR
INTEGER(KIND=MPI_OFFSET_KIND) OFFSET
π Fortran 2008 Syntax
USE mpi_f08
MPI_File_read_at_all(fh, offset, buf, count, datatype, status, ierror)
TYPE(MPI_File), INTENT(IN) :: fh
INTEGER(KIND=MPI_OFFSET_KIND), INTENT(IN) :: offset
TYPE(*), DIMENSION(..) :: buf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Status) :: status
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT PARAMETERS π
fhβ File handle (handle). it's the lil pass you need to get into the file, no cap πoffsetβ File offset (integer). this is you telling it exactly where to go, main character energy fr β¨countβ Number of elements in buffer (integer). how many lil guys you want back πdatatypeβ Data type of each buffer element (handle). the vibe/genre of each element π
π OUTPUT PARAMETERS π
bufβ Initial address of buffer (choice). this is where the goods land, periodt πstatusβ Status object (status). receipts, basically π§Ύierrorβ Fortran only: Error status (integer). fortran girlies get the error report in the last arg, ikyk π
β¨ DESCRIPTION β¨
so MPI_File_read_at_all is a collective routine (meaning the whole crew has to show up, no ghosting π«Ά) that attempts to read from the file associated with fh β at the offset position β a total number of count data items having datatype type, right into your buffer buf. iconic behavior honestly.
the offset is in etype units relative to the current view. translation bestie: holes are not counted when locating an offset. like, they're just not part of the math, we ignore them π. the data is taken out of those parts of the file specified by the current view.
MPI_File_read_at_all stores the number of datatype elements actually read in status. all other fields of status are undefined β so don't go poking around in there expecting answers, it's not the vibe π.
β οΈ It is erroneous to call this function if MPI_MODE_SEQUENTIAL mode was specified when the file was opened. like, that's a hard no. do not. fr fr π«
π ERRORS π
almost all MPI routines return an error value, bestie. C routines hand it back as the return result of the function, and Fortran routines put it in the last argument. that's just how it is.
before that error value comes back, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. and if no communication object is associated with the MPI call? then the call is considered attached to MPI_COMM_SELF and it'll call the associated MPI error handler. so it's never just floating, it's always got a home π
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 that initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or by the mpi_initial_errhandler CLI argument to mpiexec, or by info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. noted, screenshot taken πΈ
and 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. spicy distinction, don't forget it π
π the three predefined error handlers π
Open MPI includes three predefined error handlers that can be used:
MPI_ERRORS_ARE_FATALβ Causes the program to abort all connected MPI processes. everyone goes down together, dramatic af π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 ifMPI_Abortwas called on that communicator. If called on a window or file, acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. If called on a session, aborts only the local process. versatile queen πMPI_ERRORS_RETURNβ Returns an error code to the application. the chill one. hands you the L politely π«Ά
π¦ roll your own error handler π¦
MPI applications can also implement their own error handlers by calling:
MPI_Comm_create_errhandlerthenMPI_Comm_set_errhandlerMPI_File_create_errhandlerthenMPI_File_set_errhandlerMPI_Session_create_errhandlerthenMPI_Session_set_errhandleror atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
basically: create it, then set it. two-step. you got this π
β οΈ Note that MPI does not guarantee that an MPI program can continue past an error. so likeβ¦ plan accordingly bestie, no cap π
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. if you want the deep lore, it's all there π
π Copyright π
2003-2026, The Open MPI Community
and that's the whole page, bestie β you ate ππ it's from the Open MPI manual (it lives in section 3, hence the (3)), and this version is dated Sep 10, 2026. go read some files at explicit offsets, you iconic collective queen πβ¨ mwah! π
π
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms