MPI_File_read_ordered(3)
π NAME π
MPI_File_read_ordered β it's giving collective read using shared file pointer, bestie. Everyone in the group reads together, in order, and the file pointer is shared. Periodt.
β¨ SYNOPSIS β¨
int MPI_File_read_ordered(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status)
int MPI_File_read_ordered_c(MPI_File fh, void *buf, MPI_Count count,
MPI_Datatype datatype, MPI_Status *status)
Two of them! One with int count, one with MPI_Count count (the _c one, obviously, main character energy). Same vibe, bigger count. π«Ά
πΈ INPUT PARAMETERS πΈ
fhβ the file handle, bestie. It's a handle. You gotta have the file open before you can read from it, iykyk.countβ how many elements are chillin' in your buffer. It's an integer.datatypeβ the datatype of each element in your buffer. It's a handle, so like, an actualMPI_Datatype, not vibes.
π OUTPUT PARAMETERS π
bufβ initial address of the buffer. It's a choice (which is MPI-speak for "it's whatever type you want, queen, we're not picky").statusβ the status object. Type: Status. She holds receipts. π
π¦ THREAD AND INTERRUPT SAFETY π¦
Okay so the good news first: this routine is thread-safe. That means multiple threads can use it at the same time and you do not need to bring your own thread locks. No gatekeeping, no drama. Slay. β¨
But the bad news? She is not interrupt safe. π And typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines, that are themselves not interrupt-safe. So like β not her fault, it's the company she keeps.
Not interrupt safe, bestie. Don't @ me, it's the malloc of it all.
π NOTES FOR FORTRAN π
Fortran girlies, listen up, this part is for you:
- All MPI routines in Fortran (except
MPI_WTIMEandMPI_WTICKβ those two are the exception, don't come for me) have an additional argumentierrtacked onto the end of the argument list. Theierris an integer and it means the exact same thing as the return value of the routine in C. Same energy, different font. - In Fortran, MPI routines are subroutines, and you invoke them with the
callstatement. That's just how it is over there. - All MPI objects β like
MPI_DatatypeandMPI_Commβ are of typeINTEGERin Fortran. Yes, really.INTEGER. π§
π₯ ERRORS π₯
Every MPI routine (except MPI_Wtime and MPI_Wtick, the forever exceptions) returns an error value β in C it's the return value of the function, and in Fortran it's that last argument we just talked about.
Before that value comes back to you, the current MPI error handler gets called. And by default? That error handler aborts the whole MPI job. Like, everything. Gone. π
You can switch the error handler out though:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows- The MPI-1 routine
MPI_Errhandler_setmay be used, but its use is deprecated. We don't do that anymore, it's not the vibe.
The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead. Helpful!
And note (this matters): MPI does not guarantee that an MPI program can continue past an error. However, MPI implementations will attempt to continue whenever possible. So like, sometimes you get to keep going. Sometimes. Fingers crossed. π€
Here's the error roster:
MPI_SUCCESSβ No error; MPI routine completed successfully. The dream. The moment. We ate. πMPI_ERR_ARGβ Invalid argument. Some argument is invalid and is not identified by a specific error class (e.g.,MPI_ERR_RANK). Very "something's wrong but I'm not telling you what" of it.MPI_ERR_BUFFERβ Invalid buffer pointer. Usually a null buffer where one is not valid. Babygirl, you passedNULL. πMPI_ERR_COUNTβ Invalid count argument. Count arguments must be non-negative; a count of zero is often valid. Negative counts? Not the vibe.MPI_ERR_TYPEβ Invalid datatype argument. Additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call. Commit your types, bestie, fr fr.MPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code. The catch-all. The "miscellaneous" of errors.
π SEE ALSO π
(nothing extra here, so go forth and read, ordered and collective, like the icon you are)
Okay that's literally the whole page, bestie β go read something collectively and in order. Stay iconic. π
Sign-off tea: this page comes from the MPI manual, and the footer date on it is 4/10/2026, filed under MPI_File_read_ordered(3). K bye! πβ¨
π¦ 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