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βtrueif atomic mode is enabled,falseif 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_errhandleronMPI_COMM_SELFwhen you're using the World model, or - via the
mpi_initial_errhandlerCLI argument tompiexec, 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 ifMPI_Abortwas called on that communicator. If called on a window or file, it acts as ifMPI_Abortwas 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_errhandlerthenMPI_Comm_set_errhandlerMPI_File_create_errhandlerthenMPI_File_set_errhandlerMPI_Session_create_errhandlerthenMPI_Session_set_errhandleror atMPI_Session_initMPI_Win_create_errhandlerthenMPI_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 π
π Copyright
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
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms