MPI_File_iread_shared(3)
π MPI_File_iread_shared π
okay so bestie, welcome to the MPI manual page for MPI_File_iread_shared(3) β yes it's a whole mouthful, yes it slays, and yes I'm gonna walk you through every single crumb of it. grab a strawberry π and let's go.
β¨ NAME β¨
MPI_File_iread_shared β nonblocking read using shared file pointer π¦
like⦠it reads, but it does NOT wait around for you. main character energy fr. and it does it using the shared file pointer, iykyk.
β¨ SYNOPSIS β¨
int MPI_File_iread_shared(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Request *request)
int MPI_File_iread_shared_c(MPI_File fh, void *buf, MPI_Count count,
MPI_Datatype datatype, MPI_Request *request)
two flavors, no cap. the _c one is the same vibe, it just takes an MPI_Count for count instead of an int. π
β¨ INPUT PARAMETERS β¨
fhβ the file handle (type: handle). your lil ticket to the file, basically.countβ how many elements are in your buffer (integer). the population of your buffer, if you will πdatatypeβ the datatype of each buffer element (handle). every element gets a lil glow-up label.
β¨ OUTPUT PARAMETERS β¨
bufβ initial address of the buffer (choice). where the read data lands, periodt.requestβ the request object (handle). this is the lil thing you hold onto so you can check on your nonblocking read later. keep it safe bestie π«Ά
β¨ THREAD AND INTERRUPT SAFETY β¨
okay this part matters, so listen up:
this routine is thread-safe π₯. that means multiple threads can use it at the same time with zero user-provided thread locks β you don't have to do anything, it's just built like that. iconic.
BUT. it is not interrupt safe. and like, the reason is usually kind of mundane: it comes from using memory allocation routines such as malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so yeah π«
β¨ NOTES FOR FORTRAN β¨
for the Fortran girlies πΈ:
- every MPI routine in Fortran (except
MPI_WTIMEandMPI_WTICK) has an extra argumentierrtacked onto the end of the argument list. ierris an integer and it means exactly the same thing as the return value of the routine in C.- in Fortran, MPI routines are subroutines, and you invoke them with the
callstatement. - all MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran. no cap.
β¨ ERRORS β¨
all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β C routines hand it back as the value of the function, and Fortran routines stick it 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, do not play games.
you can swap the error handler 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 β so, retire her π. there's also a predefined error handler, MPI_ERRORS_RETURN, that you can use to make error values get returned instead.
heads up: MPI does not guarantee that an MPI program can continue past an error. that said, MPI implementations will attempt to continue whenever possible. so likeβ¦ fingers crossed π€
here's the full error roster:
MPI_SUCCESSβ no error; the routine completed successfully. slay β¨MPI_ERR_ARGβ invalid argument. some argument is invalid and it's 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β invalidcountargument. count arguments must be non-negative; a count of zero is often valid.MPI_ERR_TYPEβ invaliddatatypeargument. 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 mysterious one π
and that's the whole page babes π go forth and nonblocking-read responsibly.
this page is from the MPI manual, MPI_File_iread_shared(3), dated 4/10/2026 β mwah, bye bestie π
π¦ 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