MPI_FILE_WRITE_AT_ALL_BEGIN(3)

πŸ’… MPI_File_write_at_all_begin πŸ’…

hiii bestie, welcome to another Open MPI man page (section 3, the I/O girlies' section, iykyk). Buckle up because this one is a nonblocking split collective and she's lowkey iconic.

MPI_File_write_at_all_begin β€” Writes a file at explicitly specified offsets; beginning part of a split collective routine (nonblocking).


✨ SYNTAX ✨

okay so like, pick your language era:

🌸 C Syntax

#include <mpi.h>

int MPI_File_write_at_all_begin(MPI_File fh, MPI_Offset offset,
     const void *buf, int count, MPI_Datatype datatype)

πŸ¦‹ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_WRITE_AT_ALL_BEGIN(FH, OFFSET, BUF, COUNT, DATATYPE, IERROR)
     <type>  BUF(*)
     INTEGER FH, COUNT, DATATYPE, IERROR
     INTEGER(KIND=MPI_OFFSET_KIND)   OFFSET

πŸŽ€ Fortran 2008 Syntax

USE mpi_f08
MPI_File_write_at_all_begin(fh, offset, buf, count, datatype, ierror)
     TYPE(MPI_File), INTENT(IN) :: fh
     INTEGER(KIND=MPI_OFFSET_KIND), INTENT(IN) :: offset
     TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: buf
     INTEGER, INTENT(IN) :: count
     TYPE(MPI_Datatype), INTENT(IN) :: datatype
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ”„ INPUT/OUTPUT PARAMETER πŸ”„

  • fh β€” File handle (handle). she's the whole personality, the file you're talking to.

πŸ“₯ INPUT PARAMETERS πŸ“₯

  • offset β€” File offset (handle). where in the file you're aiming, bestie. the original really does label it a handle here, so we're keeping that exactly as it is, no notes πŸ’€
  • buf β€” Initial address of buffer (choice). the address where your data starts chilling.
  • count β€” Number of elements in buffer (integer). how many of your lil guys are coming along.
  • datatype β€” Data type of each buffer element (handle). the shape/vibe of each element.

πŸ“€ OUTPUT PARAMETER πŸ“€

  • ierror β€” Fortran only: Error status (integer). Fortran girlies only, sorry C stans.

🌈 DESCRIPTION 🌈

MPI_File_write_at_all_begin is the beginning part of a split collective β€” which is just a fancy way of saying it's a nonblocking routine. It attempts to write into the file associated with fh (at the offset position) a total number of count data items, having datatype type, from the user's buffer buf.

The offset is in etype units relative to the current view. So like β€” holes are not counted when locating an offset. The data gets written into those parts of the file that the current view specifies. periodt.


πŸ“ NOTES πŸ“

All the nonblocking collective routines for data access are "split" into two routines, each with _begin or _end as a suffix. These split collective routines are subject to the semantic rules described in Section 9.4.5 of the MPI-2 standard. yes, the actual standard, go read it, she's worth it 🫢


😭 ERRORS 😭

Almost every MPI routine returns an error value. C routines hand it back as the return result of the function, and Fortran routines stash it in the last argument. (Not all of them β€” "almost all," okay? read the words.)

Before that error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. If there's no communication object associated with the MPI call, then the call counts as attached to MPI_COMM_SELF and it'll call the associated MPI error handler. But when MPI_COMM_SELF is not initialized (i.e., 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 instead.

The initial error handler can be changed by:

  • calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or
  • the mpi_initial_errhandler CLI argument to mpiexec, or
  • the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple.

If no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions, and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. the favoritism is real πŸ’€

Open MPI ships with three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” Causes the program to abort all connected MPI processes.
  • MPI_ERRORS_ABORT β€” An error handler that can be invoked on a communicator, window, file, or session. When called on a communicator, it acts as if MPI_Abort was called on that communicator. If called on a window or file, acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. If called on a session, aborts only the local process.
  • MPI_ERRORS_RETURN β€” Returns an error code to the application.

You can also implement 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
Real talk: MPI does not guarantee that an MPI program can continue past an error. like, she might just ✨end✨. plan accordingly.

See the MPI man page for a full list of MPI error codes.

See the Error Handling section of the MPI-3.1 standard for more information.


2003-2026, The Open MPI Community


aaaand that's the whole thing, bestie πŸ’– you just read an entire MPI man page, main character energy fr fr. this was MPI_FILE_WRITE_AT_ALL_BEGIN(3) from the Open MPI girlies, dated Sep 10, 2026 β€” go forth and write at explicitly specified offsets, no cap πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from