MPI_FILE_IWRITE_ALL(3)

πŸ’– MPI_FILE_IWRITE_ALL(3) πŸ’–

okay bestie, gather round, because today we're talking about MPI_FILE_IWRITE_ALL from Open MPI β€” yes, the manual page, the whole thing, no skimming, no cap. 🫢

✨ NAME ✨

MPI_File_iwrite_all β€” writes a file starting at the location specified by the individual file pointer (nonblocking, collective). it's giving "I'll get to it, but I'm not gonna stand here waiting." πŸ’…


🌸 SYNTAX 🌸

πŸŽ€ C Syntax

#include <mpi.h>

int MPI_File_iwrite_all(MPI_File fh, const void *buf, int count,
     MPI_Datatype datatype, MPI_Request *request)

πŸŽ€ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_IWRITE_ALL(FH, BUF, COUNT, DATATYPE, REQUEST, IERROR)
     <type>  BUF(*)
     INTEGER FH, COUNT, DATATYPE, REQUEST, IERROR

πŸŽ€ Fortran 2008 Syntax

USE mpi_f08
MPI_File_iwrite_all(fh, buf, count, datatype, request, ierror)
     TYPE(MPI_File), INTENT(IN) :: fh
     TYPE(*), DIMENSION(..) :: buf
     INTEGER, INTENT(IN) :: count
     TYPE(MPI_Datatype), INTENT(IN) :: datatype
     TYPE(MPI_Request), INTENT(OUT) :: request
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ¦‹ INPUT/OUTPUT PARAMETER πŸ¦‹

  • fh β€” File handle (handle). it's the lil ID card for your file, periodt. πŸ‘‘

πŸ¦‹ INPUT PARAMETERS πŸ¦‹

  • buf β€” Initial address of buffer (choice). this is where your data is chillin' before it goes anywhere. πŸ“
  • count β€” Number of elements in buffer (integer). yes bestie, we're counting. 🧚
  • datatype β€” Data type of each buffer element (handle). ⭐

πŸ¦‹ OUTPUT PARAMETER πŸ¦‹

  • request β€” Request object (handle). this is your receipt, your little ticket, your "come back later and check on me" token. πŸ”₯
  • ierror β€” Fortran only: Error status (integer). πŸ’œ

πŸ’– DESCRIPTION πŸ’–

MPI_File_iwrite_all is the nonblocking version of the MPI_File_write_all interface. so like, same energy, but it does not wait around for you. it's the "seen 9:41 PM" of file I/O. 😌

It attempts to write into the file associated with fh β€” at the current individual file pointer position maintained by the system β€” a total number of count data items having datatype type from the user's buffer buf. the data gets written into those parts of the file specified by the current view. 🌈

and here's the tea: MPI_File_iwrite_all stores the number of datatype elements actually written in status. All other fields of status are undefined. πŸ™ˆ

lowkey important warning coming up: it is erroneous to call this function if MPI_MODE_SEQUENTIAL mode was specified when the file was open. so like, don't. seriously don't. πŸ’€


😭 ERRORS 😭

Almost all MPI routines return an error value β€” in C that's the return result of the function, and in Fortran it's the last argument. fr fr.

Before that error value comes back to you, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. If no communication object is associated with the MPI call, then that call counts as attached to MPI_COMM_SELF and it'll call the associated MPI error handler. When MPI_COMM_SELF is not initialized β€” that means 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. ✨

That 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. 🫢

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 other MPI functions. no cap.

Open MPI includes three predefined error handlers that can be used:

  • MPI_ERRORS_ARE_FATAL β€” Causes the program to abort all connected MPI processes. dramatic much? πŸ’€
  • 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, it 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, it aborts only the local process. πŸ‘‘
  • MPI_ERRORS_RETURN β€” Returns an error code to the application. the chill one. πŸ¦‹

MPI applications can also implement their own error handlers 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 🌸
Note that MPI does not guarantee that an MPI program can continue past an error. like, it might just be over. 😭

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 πŸ’œ


and that's the whole page bestie, we ate and left no crumbs πŸ’…βœ¨ this absolute icon of a manpage comes to you from Open MPI, dated Sep 10, 2026 β€” MPI_FILE_IWRITE_ALL(3), copyright 2003-2026, The Open MPI Community. slay, go write some files (asynchronously, collectively, respectfully). πŸ¦‹πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from