MPI_File_iwrite_at_all(3)

πŸ’– MPI_File_iwrite_at_all(3) πŸ’–

okay bestie, welcome to the MPI manual page for MPI_File_iwrite_at_all β€” yes it's a whole mouthful, yes it's iconic, and yes we're gonna get through it together 🫢


✨ NAME ✨

MPI_File_iwrite_at_all β€” nonblocking collective write using an explicit offset. that's it, that's the girl πŸ’…


🌸 SYNOPSIS 🌸

int MPI_File_iwrite_at_all(MPI_File fh, MPI_Offset offset, const void *buf,
int count, MPI_Datatype datatype,
MPI_Request *request)

int MPI_File_iwrite_at_all_c(MPI_File fh, MPI_Offset offset, const void *buf,
MPI_Count count, MPI_Datatype datatype,
MPI_Request *request)

look at her. two whole flavours. the OG and the _c version. we love range πŸ’–


πŸŽ€ INPUT PARAMETERS πŸŽ€

  • fh β€” the file handle (handle). it's giving "which file are we doing this to" energy.
  • offset β€” the file offset (integer). where in the file the chaos begins, bestie.
  • buf β€” initial address of the buffer (choice). your data lives here fr fr.
  • count β€” number of elements in the buffer (integer). how many of them.
  • datatype β€” datatype of each buffer element (handle). what kind of element they are.

πŸ’œ OUTPUT PARAMETERS πŸ’œ

  • request β€” the request object (handle). you get a lil ticket back so you can check on it later, no cap.

πŸ”₯ THREAD AND INTERRUPT SAFETY πŸ”₯

this routine is thread-safe, and that's lowkey a big deal. what it means: multiple threads can call it at the same time with zero user-provided thread locks required. you don't have to babysit it, she's independent πŸ’…

⚠️ BUT β€” and this is the important part β€” the routine is not interrupt safe. typically this is because of memory allocation routines like malloc, or other non-MPICH runtime routines, which are themselves not interrupt-safe. so like, don't go interrupting her mid-slay, okay? 😭

🌈 NOTES FOR FORTRAN 🌈

every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) has an extra argument called ierr tacked onto the end of the argument list. ierr is an integer and means exactly the same thing as the return value of the routine in C. bestie, it's the same vibe, just a different outfit ✨

also: in Fortran, MPI routines are subroutines, and you invoke them with the call statement. and all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. periodt.


πŸ’€ ERRORS πŸ’€

okay so every single MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines hand it back as the value of the function, Fortran routines put it in that last argument. before the value comes back to you, the current MPI error handler gets called. and by default? that error handler aborts the MPI job. yeah. dramatic. πŸ’€

the error handler can be changed with:

  • MPI_Comm_set_errhandler β€” for communicators
  • MPI_File_set_errhandler β€” for files
  • MPI_Win_set_errhandler β€” for RMA windows

the MPI-1 routine MPI_Errhandler_set may also be used, but its use is deprecated (ngl, don't do it).

there's also a predefined error handler, MPI_ERRORS_RETURN, which you can use to make error values get returned instead of the whole thing going up in flames.

πŸ“Œ note that MPI does not guarantee an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. so like… maybe? no promises. πŸ™ˆ

here's the roster of error codes, bestie:

  • MPI_SUCCESS β€” no error; the MPI routine completed successfully. the dream. the goal. she ate. πŸ‘‘
  • MPI_ERR_ARG β€” invalid argument. some argument is invalid and isn't identified by a specific error class (e.g., MPI_ERR_RANK). vague queen.
  • 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 uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call. commit your types bestie!!
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more information about this error code. the "idk, something" of error codes 🫢

πŸ¦‹ SEE ALSO πŸ¦‹

okay technically this page didn't hand me a SEE ALSO section, so nothing to link here β€” but you already know I'd send you straight to the rest of the MPI file I/O girlies if I could πŸ’–


and that's the whole page, bestie!! written by the MPI crew, page rendered 4/10/2026, and the footer says it's MPI_File_iwrite_at_all(3) β€” so go forth, write collectively, nonblocking, no cap. you're the main character of your own parallel program now πŸ’…βœ¨πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from