MPI_FILE_READ_SHARED(3)
π MPI_FILE_READ_SHARED π
okay so bestie, you just landed on the MPI_FILE_READ_SHARED page of the Open MPI manual (section 3, the library-call girlies π«Ά). Grab a strawberry π, we're reading files with a shared file pointer and it's lowkey iconic.
β¨ NAME β¨
MPI_File_read_shared β reads a file using the shared file pointer (blocking, noncollective). π
πΈ SYNTAX πΈ
π C Syntax π
#include <mpi.h>
int MPI_File_read_shared(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status)
π Fortran Syntax π
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_READ_SHARED(FH, BUF, COUNT, DATATYPE, STATUS,
IERROR)
<type> BUF(*)
INTEGER FH, COUNT, DATATYPE,STATUS(MPI_STATUS_SIZE), IERROR
π Fortran 2008 Syntax π
USE mpi_f08
MPI_File_read_shared(fh, buf, count, datatype, status, ierror)
TYPE(MPI_File), INTENT(IN) :: fh
TYPE(*), DIMENSION(..) :: buf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Status) :: status
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT/OUTPUT PARAMETER π
fhβ file handle (handle). yeah she's both an input AND an output situation, main character energy honestly π
π₯ INPUT PARAMETERS π₯
countβ number of elements in the buffer (integer). like, how many lil guys you want π§datatypeβ the data type of each buffer element (handle).
π€ OUTPUT PARAMETERS π€
bufβ initial address of the buffer (choice).statusβ status object (status).ierrorβ Fortran only: error status (integer).
π¦ DESCRIPTION π¦
MPI_File_read_shared is a blocking routine that uses the shared file pointer to read files. The way it does thatβ¦
and okay, important part, no cap: the order of serialization is not deterministic for this noncollective routine. So don't come for her when the ordering is a little chaotic β that's just the vibe. π
π 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 tuck it into the last argument.
Before that error value gets returned, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. And if there's no communication object attached to the MPI call? Then the call is considered attached to MPI_COMM_SELF and it'll call the associated MPI error handler. When MPI_COMM_SELF isn't initialized (i.e., before MPI_Init / MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively), the error raises the initial error handler instead.
You can change that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or the info key to MPI_Comm_spawn / MPI_Comm_spawn_multiple. And if no other appropriate error handler has been set, then MPI_ERRORS_RETURN gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all other MPI functions.
Open MPI ships three predefined error handlers you can use, periodt:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. π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, it acts as ifMPI_Abortwas 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.
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
β οΈ note that MPI does not guarantee that an MPI program can continue past an error. like, she might just not recover, bestie, that's the tea β
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. π
π Copyright π
2003-2026, The Open MPI Community
and that's the whole page, pookie π«Ά this was MPI_FILE_READ_SHARED(3) from Open MPI, dated Sep 10, 2026 β slay, you're officially a shared-file-pointer girly now. go read some files. π
β¨π
π¦ 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