MPI_File_iwrite_shared(3)

πŸ’– MPI_File_iwrite_shared(3) πŸ’–

okay bestie, welcome to the MPI manual, and welcome to MPI_File_iwrite_shared β€” the nonblocking write that uses the shared file pointer. yes, the whole crew shares one pointer. it's giving group project, but the good kind. 🫢


✨ NAME ✨

MPI_File_iwrite_shared β€” nonblocking write using shared file pointer. lowkey iconic, highkey asynchronous. πŸ’…


🌸 SYNOPSIS 🌸

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

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

πŸŽ€ INPUT PARAMETERS πŸŽ€

  • fh β€” file handle (handle). it's your lil key to the file, your VIP pass fr.
  • buf β€” initial address of buffer (choice). this is where the goods live that you're about to write out.
  • count β€” number of elements in buffer (integer). how many of them, exactly.
  • datatype β€” datatype of each buffer element (handle). tells MPI what each lil element actually is.

πŸ¦‹ OUTPUT PARAMETERS πŸ¦‹

  • request β€” request object (handle). hold onto this one, bestie β€” it's your receipt for the operation. πŸ™ˆ

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

this routine is thread-safe. what that means for you: multiple threads can use it at the same time, and you do not need to bring your own thread locks. no cap, she handles it.

but β€” and this is the part where we hold hands β€” the routine is not interrupt safe. typically that's because it uses memory allocation routines like malloc or other non-MPICH runtime routines, and those are themselves not interrupt-safe. so don't @ her with interrupts, she was not built for that. 😭


🌈 NOTES FOR FORTRAN 🌈

all MPI routines in Fortran (except MPI_WTIME and MPI_WTICK) have an extra little guy at the end of the argument list named ierr. ierr is an integer and it means exactly the same thing as the return value of the routine in C. iykyk.

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

also: all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. every single one. slay.


πŸ’œ ERRORS πŸ’œ

every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines as the value of the function, Fortran routines 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. πŸ’€

you can swap 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 (we don't do that anymore, babe). and the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead of the whole job getting yeeted.

heads up: MPI does not guarantee that an MPI program can continue past an error. the implementations will attempt to continue whenever possible, but no promises. 🫠

here's the error code lineup:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. ate. ✨
  • MPI_ERR_ARG β€” Invalid argument. some argument is invalid and it's 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. bestie where is the buffer 😭
  • 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, girl.
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

⭐ SEE ALSO ⭐

literally the entire MPI manual, go read it, it's your moment. πŸ‘‘


and that's the page, bestie!! πŸŽ€ this was MPI_File_iwrite_shared(3) from the MPI manual, dated 4/10/2026 β€” go forth and iwrite_shared your little heart out. πŸ’–πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from