MPI_File_iread(3)
๐ MPI_File_iread โ nonblocking read using individual file pointer ๐
okay bestie, welcome to the MPI manual page for MPI_File_iread(3) ๐ฆ and yes this whole glow-up is happening under the MPI manual name, we're just saying hi to it up here instead of making you read a boring header line. iykyk โจ
โจ NAME โจ
MPI_File_iread โ nonblocking read using individual file pointer ๐
๐ธ SYNOPSIS ๐ธ
int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Request *request)
int MPI_File_iread_c(MPI_File fh, void *buf, MPI_Count count,
MPI_Datatype datatype, MPI_Request *request)
two whole flavors, one classic and one _c version, and the _c one is giving bigger count energy because its count is an MPI_Count instead of an int, periodt ๐
๐ INPUT PARAMETERS ๐
fhโ file handle (handle). it's literally the lil ID card for your file ๐ชชcountโ number of elements in buffer (integer). how many lil guys we're reading fr fr ๐ขdatatypeโ datatype of each buffer element (handle). tells MPI what shape each element is ๐ง
๐ซถ OUTPUT PARAMETERS ๐ซถ
bufโ initial address of buffer (choice). where the read data lands, bestie ๐requestโ request object (handle). your lil ticket to check on this nonblocking read later, no cap ๐๏ธ
๐ THREAD AND INTERRUPT SAFETY ๐
okay so the tea: this routine is thread-safe โ which means you can absolutely use it from multiple threads at the same time without bringing your own user-provided thread locks. slay, it handles itself ๐
BUT. and this is the important part, so pay attention ๐ โ the routine is not interrupt safe. typically that's because it uses memory allocation routines like malloc (or other non-MPICH runtime routines) and those are themselves not interrupt-safe. so like, thread-safe: yes. interrupt-safe: not giving that. ๐
๐ NOTES FOR FORTRAN ๐
- All MPI routines in Fortran (except for
MPI_WTIMEandMPI_WTICK) have an additional argumentierrat the end of the argument list.ierris 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
callstatement. so it's a whole different vibe over there ๐ - All MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran. yep, even the fancy ones ๐
๐ฅ 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 that value comes back, the current MPI error handler gets called. by default, that error handler aborts the MPI job ๐ญ so like, dramatic much.
The error handler may be changed with:
MPI_Comm_set_errhandler(for communicators)MPI_File_set_errhandler(for files)MPI_Win_set_errhandler(for RMA windows)
The MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated ๐ (old and you should probably not). The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead. Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. good luck bestie ๐ซถ
here's the error roster, all iconic in their own way:
MPI_SUCCESSโ No error; MPI routine completed successfully. ate and left no crumbs โ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. the mystery box ๐ฆ
๐ reminder: nonblocking means it kicks off the read and hands you arequest, so don't touchbuflike it's finished until you've actually waited on that thing. main character patience, bestie ๐
okay that's the whole page, and a lil sign-off because you deserve one: this was brought to you by the MPI manual, dated 4/10/2026 (yes, that's the version/date on the MPI_File_iread(3) footer, and we're folding it in right here like the header, cute right?). go read something, queen ๐๐โจ
๐ฆ 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