MPI_File_write_ordered(3)
π MPI_File_write_ordered β bestie edition
okay so this is a manual page for MPI_File_write_ordered, and it lives in the MPI manual section, so you already know this is β¨parallel I/Oβ¨ territory. Buckle up, we're doing a collective write using the shared file pointer. It's giving "everyone writes, but the file pointer is doing the coordinating" energy. π
πΈ NAME πΈ
MPI_File_write_ordered β collective write using shared file pointer π«Ά
β¨ SYNOPSIS β¨
int MPI_File_write_ordered(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPI_Status *status)
int MPI_File_write_ordered_c(MPI_File fh, const void *buf, MPI_Count count,
MPI_Datatype datatype, MPI_Status *status)
two flavours, bestie: the classic one and the _c one that takes an MPI_Count. same vibe, bigger numbers. π
π INPUT PARAMETERS π
fhβ the file handle (it's a handle, iykyk)bufβ the initial address of the buffer (that's a choice type parameter)countβ how many elements are chillin' in that buffer (an integer)datatypeβ the datatype of each buffer element (a handle)
π¦ OUTPUT PARAMETERS π¦
statusβ the status object (a Status, obviously)
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe. what does that mean fr? it means you can safely use it from multiple threads without needing any user-provided thread locks. no mutex gatekeeping required, we love that for us. π«Ά
BUT β and this is the part where we get serious π β 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 things are themselves not interrupt-safe. so yeah, thread-safe β interrupt-safe, don't get it twisted. π
π NOTES FOR FORTRAN π
all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an extra argument, ierr, glued onto the end of the argument list. ierr is an integer and it means the exact same thing as the return value of the routine in C. mind the gap between languages bestie π
in Fortran, MPI routines are subroutines, and you invoke them with the call statement. periodt.
all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, even the fancy ones. π
β ERRORS β
all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β C routines give it back as the value of the function, and Fortran routines put it in that last argument. before the value is returned, the current MPI error handler gets called. by default, that error handler aborts the MPI job. π¨ like, the whole thing. gone.
you can change the error handler:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows
the MPI-1 routine MPI_Errhandler_set may still be used, but its use is deprecated β so pls don't, it's giving 1994. π
the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.
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 likeβ¦ attempt. no promises tho. π
here's the full error code lineup:
MPI_SUCCESSβ no error; the MPI routine completed successfully. 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).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.
and that's the whole page bestie, no notes. this one came from the MPI manual, dated 4/10/2026, and it's the MPI_File_write_ordered(3) page itself. go forth and write collectively, in order, with your shared file pointer. slay πβ¨π
π¦ 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