MPI_FILE_GET_AMODE(3)
π MPI_FILE_GET_AMODE(3) β Open MPI π
okay bestie, welcome to the MPI_FILE_GET_AMODE(3) page, brought to you by your friends at Open MPI β¨
πΈ NAME πΈ
MPI_File_get_amode β literally just returns the access mode associated with an open file. that's it. that's the whole job. and she eats every time π
π¦ SYNTAX π¦
β¨ C Syntax
#include <mpi.h>
int MPI_File_get_amode(MPI_File fh, int *amode)
β¨ Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FILE_GET_AMODE(FH, AMODE, IERROR)
INTEGER FH, AMODE, IERROR
β¨ Fortran 2008 Syntax
USE mpi_f08
MPI_File_get_amode(fh, amode, ierror)
TYPE(MPI_File), INTENT(IN) :: fh
INTEGER, INTENT(OUT) :: amode
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT PARAMETER π
fhβ bestie, this is the file handle (handle). the lil key you pass in so she knows which file we're talking about π
π«Ά OUTPUT PARAMETERS π«Ά
amodeβ the file access mode that was used to open the file (integer). she's gonna drop it right in there for you β¨ierrorβ Fortran only: error status (integer). no cap, that's just for the Fortran girlies.
π DESCRIPTION π
MPI_File_get_amode returns, in amode, the access mode associated with the open file fh. periodt. she tells you how that file was opened, and she tells you with zero drama π
π ERRORS π
ngl, almost all MPI routines return an error value β C routines hand it back as the return result of the function, and Fortran routines put it in that last argument. iconic behavior tbh.
Before the error value is even returned, the current MPI error handler associated with the communication object (like a communicator, window, or file β iykyk) gets called. And listen: if there's no communication object associated with the MPI call, then the call counts as being attached to MPI_COMM_SELF and it'll call the MPI error handler associated with that. When MPI_COMM_SELF isn't initialized β like before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're running the Sessions Model exclusively β the error raises the initial error handler. 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 the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. And if literally 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 the other MPI functions. yes really. π
Open MPI ships three predefined error handlers you can use, and they are:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. soβ¦ nuclear. πMPI_ERRORS_ABORTβ an error handler you can invoke on a communicator, window, file, or session. When it's called on a communicator, it acts as ifMPI_Abortwas called on that communicator. If it's 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. And if it's called on a session, it aborts only the local process. she's selective, okay? πMPI_ERRORS_RETURNβ returns an error code to the application. the chill one. the lowkey one. π«Ά
MPI applications can also go full DIY and 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_errhandler, or atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
β οΈ heads up bestie: MPI does not guarantee that an MPI program can continue past an error. fr fr, plan accordingly.
See the MPI man page for a full list of MPI error codes.
See the Error Handling section of the MPI-3.1 standard for more information. π
π Copyright
2003-2026, The Open MPI Community
and that's the whole vibe check, bestie π¦ this page came from the Open MPI crew and it's dated Sep 10, 2026 β go forth, read your access modes, and slay πβ¨πππ
π¦ 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