MPI_File_iread_all(3)
๐ MPI_File_iread_all โ bestie, let's do a collective read โจ
okay so this is a page from the MPI manual, and today's main character is MPI_File_iread_all. basically: a nonblocking collective read using the individual file pointer. no cap. ๐ฆ
๐ธ NAME ๐ธ
MPI_File_iread_all โ Nonblocking collective read using individual file pointer ๐
๐ SYNOPSIS ๐
int MPI_File_iread_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Request *request)
int MPI_File_iread_all_c(MPI_File fh, void *buf, MPI_Count count,
MPI_Datatype datatype, MPI_Request *request)
two versions, bestie โ the classic one and the big-count one with MPI_Count. pick your fighter โจ
๐ฅ INPUT PARAMETERS ๐ฅ
girlies, these are the things you hand to the function:
fhโ file handle (handle). it's givingโฆ the file, obviously ๐countโ number of elements in buffer (integer). literally how many elements.datatypeโ datatype of each buffer element (handle). each element's type, go off ๐
๐ค OUTPUT PARAMETERS ๐ค
and these are the things you get back:
bufโ initial address of buffer (choice). yes bestie, it said "output" up top, we're not questioning the manual's choices ๐requestโ request object (handle). hold onto this, you'll need it to check on the read later ๐ซถ
๐งต THREAD AND INTERRUPT SAFETY ๐งต
okay so this routine is thread-safe. that means you can literally use it from multiple threads at the same time, and you do not need to bring your own thread locks. slay.
BUT. (there's always a but ๐ญ) it is not interrupt safe. the usual reason: 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, absolutely not. periodt.
๐ฎ NOTES FOR FORTRAN ๐ฎ
- every MPI routine in Fortran (except for
MPI_WTIMEandMPI_WTICK) has one extra argument at the end:ierr.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 the
callstatement. iconic. - all MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran.
โ ๏ธ ERRORS โ ๏ธ
okay so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value โ C routines hand it back as the function's value, Fortran routines put it in that last argument.
before the value comes back, the current MPI error handler gets called. by default, this error handler aborts the MPI job. yeah. no chill. ๐
you can change the handler 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 โ so like, maybe don't, bestie.
you can also use the predefined error handler MPI_ERRORS_RETURN to make error values get returned instead.
and like, heads up: MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. soโฆ best effort ๐ซถ
here's the full error squad:
MPI_SUCCESSโ No error; MPI routine completed successfully. we love to see it โจ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.
reminder bestie: that default error handler aborts the whole job. if you want the error value handed back to you instead of everything exploding, set MPI_ERRORS_RETURN. iykyk ๐
and that's the whole page, babe ๐ that was MPI_File_iread_all(3) from the MPI manual, dated 4/10/2026 โ thanks for reading, you ate that fr fr ๐๐
๐ฆ 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