MPI_File_read_shared(3)
π MPI_File_read_shared β the shared-file-pointer read glow-up π
okay bestie, so this one lives in the MPI manual, section 3 (MPI_File_read_shared(3)), and it's literally just: read stuff using the shared file pointer. that's the whole vibe. no cap.
β¨ NAME β¨
MPI_File_read_shared β read using the shared file pointer π¦
π SYNOPSIS π
int MPI_File_read_shared(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status)
int MPI_File_read_shared_c(MPI_File fh, void *buf, MPI_Count count,
MPI_Datatype datatype, MPI_Status *status)
two flavours, same energy. pick your count type and go π
πΈ INPUT PARAMETERS πΈ
fhβ the file handle, fr fr. type: handle.countβ how many elements are chillin' in the buffer. type: integer.datatypeβ the datatype of each buffer element. type: handle. yes it's a handle, not a type-type, don't @ me.
π OUTPUT PARAMETERS π
bufβ the initial address of the buffer. type: choice.statusβ the status object, holding the receipts. type: Status.
π«Ά THREAD AND INTERRUPT SAFETY π«Ά
this routine is thread-safe. meaning: multiple threads can use it and you do not need to bring your own thread locks, bestie, it handles itself. main character energy.
but π¨ it is not interrupt safe. typically that's because it calls memory allocation routines like malloc, or other non-MPICH runtime routines, and those are themselves not interrupt-safe. so like, respect the boundary, ok?
π§ NOTES FOR FORTRAN π§
- every MPI routine in Fortran (except for
MPI_WTIMEandMPI_WTICK) has an extra argumentierrtacked onto the end of the argument list.ierris an integer and means the exact same thing as the return value of the routine in C. in Fortran, MPI routines are subroutines, and you invoke them with thecallstatement. - every MPI object (e.g.,
MPI_Datatype,MPI_Comm) is of type INTEGER in Fortran. iconic honestly.
π 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 that last argument. before the value comes back, the current MPI error handler gets called. by default, that error handler aborts the MPI job π (dramatic? yes. accurate? also yes.)
the error handler can be swapped out 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 β retired, past its era, we don't do that anymore. 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. so likeβ¦ try, bestie. but don't count on it π
the error codes, one by one, no skipping:
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).MPI_ERR_BUFFERβ invalid buffer pointer. usually a null buffer where one is not valid.MPI_ERR_COUNTβ invalid count argument. count arguments must be non-negative; a count of zero is often valid.MPI_ERR_TYPEβ invalid datatype argument. additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code.
that's the whole page, no notes π go read some files with your shared pointer and be iconic about it ππβ
this was MPI manual, MPI_File_read_shared(3), dated 4/10/2026. periodt. π¦π
π¦ where this page comes from
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms