MPI_FILE_GET_ATOMICITY(3)

πŸ’… MPI_FILE_GET_ATOMICITY β€” the Open MPI girlies' guide

okay bestie, so this whole thing lives in the Open MPI manual, section 3, page MPI_FILE_GET_ATOMICITY. And what does it do? It returns the current consistency semantics for data-access operations. That's the whole vibe. Let's get into it πŸ’–


✨ SYNTAX ✨

C Syntax πŸŽ€

#include <mpi.h>

int MPI_File_get_atomicity(MPI_File fh, int *flag)

Fortran Syntax πŸ¦‹

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_GET_ATOMICITY(FH, FLAG, IERROR)
     INTEGER FH, IERROR
     LOGICAL FLAG

Fortran 2008 Syntax 🌸

USE mpi_f08
MPI_File_get_atomicity(fh, flag, ierror)
     TYPE(MPI_File), INTENT(IN) :: fh
     LOGICAL, INTENT(OUT) :: flag
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🌈 INPUT PARAMETER

  • fh β€” the file handle, bestie. It's a handle (that's the type, not me being vague, I promise).

🫢 OUTPUT PARAMETER

  • flag β€” true if atomic mode is enabled, false if nonatomic mode is enabled. It's a boolean, so it's literally just yes-or-no energy.
  • ierror β€” Fortran only, babes: the error status (an integer).

πŸ’– DESCRIPTION πŸ’–

MPI_File_get_atomicity hands you back the current consistency semantics for data access operations on the whole set of file handles that got created by one collective MPI_File_open. One open, one shared vibe, one answer.

If flag is true, atomic mode is currently enabled. If flag is false, nonatomic mode is currently enabled. That's it, that's the whole tea β˜•βœ¨


πŸ’€ ERRORS πŸ’€

okay so almost every MPI routine gives you back an error value. In C routines it's the return result of the function, and in Fortran routines it lives in the last argument. two different homes, same drama.

Before that error value even gets returned, the current MPI error handler associated with the communication object (like, a communicator, a window, a file) gets called. And if there's no communication object attached to the MPI call at all? Then the call is considered attached to MPI_COMM_SELF and it'll call the associated MPI error handler. 🫠

When MPI_COMM_SELF is not initialized β€” which is to say, 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. And you can change that initial error handler:

  • by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or
  • via the mpi_initial_errhandler CLI argument to mpiexec, or
  • via 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.


πŸ‘‘ the three predefined error handlers Open MPI ships with

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. everyone's going down, together.
  • 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. (yes, only local, read it twice πŸ’…)
  • MPI_ERRORS_RETURN β€” returns an error code to the application. polite. respectful. iconic.

🧚 DIY error handlers, for the crafty besties

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, genuinely. it's not being dramatic, that's just the rule. 🚨

See the MPI man page for a full list of MPI error codes. And see the Error Handling section of the MPI-3.1 standard for more information. iykyk πŸ“š


2003-2026, The Open MPI Community


aaaand that's the page, bestie πŸŽ€ this was MPI_FILE_GET_ATOMICITY(3) from the Open MPI manual, dated Sep 10, 2026, and the copyright belongs to The Open MPI Community, 2003-2026. slay, go read your files atomically (or don't, that's literally what this function is for) πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from