MPI_File_write_at_all(3)

πŸ’Ύ MPI_File_write_at_all(3) β€” the MPI girlies' edition πŸ’Ύ

okay so bestie, welcome to the MPI manual, page MPI_File_write_at_all(3). this is a collective write with an explicit offset and it's lowkey iconic. let's get into it 🫢


✨ NAME ✨

MPI_File_write_at_all β€” collective write using explicit offset

like, it writes, and everybody in the group does it together, and you tell it exactly where to go. no cap. πŸ’…


πŸ“– SYNOPSIS πŸ“–

int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, const void *buf,
int count, MPI_Datatype datatype, MPI_Status *status)
int MPI_File_write_at_all_c(MPI_File fh, MPI_Offset offset, const void *buf,
MPI_Count count, MPI_Datatype datatype,
MPI_Status *status)

two flavors, same vibe, different count type. pick your fighter πŸ’–


πŸ“₯ INPUT PARAMETERS πŸ“₯

  • fh β€” the file handle (handle). your lil ticket to the file, keep it safe πŸŽ€
  • offset β€” file offset (integer). where in the file we're writing, explicitly, bestie
  • buf β€” initial address of buffer (choice). the starting address of your data
  • count β€” number of elements in buffer (integer). how many of them
  • datatype β€” datatype of each buffer element (handle). what kind of thing each element is

πŸ“€ OUTPUT PARAMETERS πŸ“€

  • status β€” status object (Status). the receipts, the lore, the aftermath ✨

🧡 THREAD AND INTERRUPT SAFETY 🧡

this routine is thread-safe. meaning: multiple threads can use it at the same time and you do NOT need to bring your own thread locks. she handles it. main character energy fr fr πŸ’…

BUT β€” and this is the important part β€” she is not interrupt safe. typically that's because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, don't come for her about interrupts, that's not her department 😭


🏰 NOTES FOR FORTRAN 🏰

all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an extra argument ierr at the end of the argument list. ierr is an integer and it means the same thing as the return value of the routine in C. bestie, it's just the C return value wearing a little Fortran outfit πŸŽ€

in Fortran, MPI routines are subroutines and you invoke them with the call statement.

also! all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. no MPI_Datatype structs here, we're going full integer mode πŸ¦‹


πŸ’€ ERRORS πŸ’€

all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value. C routines return it as the value of the function, and Fortran routines put it in the last argument. before that value comes back to you, the current MPI error handler gets called. by default, this error handler aborts the MPI job β€” like, she will end the whole thing, no hesitation πŸ’€

you can change the error handler with MPI_Comm_set_errhandler (for communicators), MPI_File_set_errhandler (for files), and MPI_Win_set_errhandler (for RMA windows). the MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated, so like, maybe don't πŸ™ˆ

the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.

note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. so like, she'll try, but no promises bestie 😭

here's the error roster:

  • MPI_SUCCESS β€” no error; MPI routine completed successfully. we love a win πŸ‘‘
  • 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. the audacity πŸ’€
  • MPI_ERR_COUNT β€” invalid count argument. count arguments must be non-negative; a count of zero is often valid. so zero is fine, negative is NOT 🌸
  • 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, that's the whole thing 🧚
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more information about this error code. the mystery box of errors 🎁

πŸ¦‹ SEE ALSO πŸ¦‹

(no SEE ALSO section on this page, bestie β€” that's it, that's the whole page 🫢)


and that's the tea, babes ✨ this page came to you from the MPI manual, dated 4/10/2026, and it's filed under MPI_File_write_at_all(3) β€” go forth and write collectively, explicitly, and iconically πŸ’–πŸŒˆ

πŸ“¦ where this page comes from