MPI_FILE_WRITE_ORDERED_END(3)

✨ MPI_FILE_WRITE_ORDERED_END ✨

okay bestie, so this is the Open MPI manual page for MPI_File_write_ordered_end β€” yes the whole entire name, we're not abbreviating, we're not being cute about it (well, we ARE being cute, but the name stays). It's a file-writing thing. It's a collective thing. And it's the second half of a split routine, so buckle up πŸŽ€


🌸 NAME 🌸

MPI_File_write_ordered_end β€” writes to a file at a location given by a shared file pointer, and it's the ending part of a split collective routine. Also: it's blocking. no cap.


✨ SYNTAX ✨

C Syntax

#include <mpi.h>

int MPI_File_write_ordered_end(MPI_File fh, const void *buf,
    MPI_Status *status)

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'

MPI_FILE_WRITE_ORDERED_END(FH, BUF, STATUS, IERROR)
    <type>  BUF(*)
    INTEGER FH, STATUS(MPI_STATUS_SIZE), IERROR

Fortran 2008 Syntax

USE mpi_f08

MPI_File_write_ordered_end(fh, buf, status, ierror)
    TYPE(MPI_File), INTENT(IN) :: fh
    TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: buf
    TYPE(MPI_Status) :: status
    INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ’« INPUT/OUTPUT PARAMETER πŸ’«

  • fh β€” the file handle (a handle). it's giving "which file tho" and this is the answer πŸ’…

πŸ¦‹ INPUT PARAMETER πŸ¦‹

  • buf β€” initial address of the buffer (a choice). your data lives here, bestie.

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • status β€” the status object (a status). it catches the tea after the call ✨
  • ierror β€” Fortran only: the error status (an integer).

πŸ‘‘ DESCRIPTION πŸ‘‘

So MPI_File_write_ordered_end is the ending part of a split collective routine. It must be called by all processes in the communicator group that's associated with the file handle fh. Not some of them. Not most of them. All of them. teamwork makes the dream work fr fr 🫢

And here's the lil bonus: MPI_File_write_ordered_end returns the number of elements written into the file associated with fh β€” and it hands you that number inside status. slay.


πŸ’… NOTES πŸ’…

Every single nonblocking collective routine for data access is "split" into two routines, each one rocking a _begin or _end suffix. Iconic structure, honestly. These split collective routines follow the semantic rules spelled out in Section 9.4.5 of the MPI-2 standard β€” so if you wanna go deeper, that's where the lore lives πŸ“–


😭 ERRORS 😭

okay so almost every MPI routine returns an error value: C routines hand it back as the return result of the function, and Fortran routines put it in the last argument. classic.

Before that error value comes back to you, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. And if no communication object is associated with the MPI call? Then the call counts as attached to MPI_COMM_SELF and it'll call the MPI error handler associated with that. When MPI_COMM_SELF isn't initialized (meaning: before MPI_Init / MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively) the error raises the initial error handler. You can swap that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're in the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or via the info key to MPI_Comm_spawn / MPI_Comm_spawn_multiple. And if no other appropriate error handler has been set? Then MPI_ERRORS_RETURN gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all the other MPI functions. periodt.

Open MPI ships three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. dramatic but that's the job πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler you can invoke on a communicator, window, file, or session. Called on a communicator? It acts as if MPI_Abort was called on that communicator. Called on a window or file? It acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. Called on a session? It aborts only the local process.
  • MPI_ERRORS_RETURN β€” returns an error code to the application. simple, honest, does what it says πŸ’–

You can also build your own error handlers, bestie, by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler
⚠️ heads up: MPI does not guarantee that an MPI program can continue past an error. so like… don't count on it 🫣

For the full list of MPI error codes, go see the MPI man page. And for more info, check out the Error Handling section of the MPI-3.1 standard.


2003-2026, The Open MPI Community


and that's the whole page, no crumbs left πŸ“ thanks for reading all the way to the bottom, you're literally the main character. this lil drop of wisdom is from the Open MPI crew, stamped Sep 10, 2026 β€” go write to some files, ordered-ly πŸ’…βœ¨

πŸ“¦ where this page comes from