MPI_FINALIZED(3)
π MPI_FINALIZED π
okay bestie, gather round, because we are looking at MPI_FINALIZED(3) from the Open MPI manual set, and it's lowkey one of the most useful little gossip-checkers in all of MPI β¨
πΈ SYNOPSIS πΈ
here's the vibe, in every dialect you might be speaking π
π C Syntax
#include <mpi.h>
int MPI_Finalized(int *flag)
π¦ Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_FINALIZED(FLAG, IERROR)
LOGICAL FLAG
INTEGER IERROR
π Fortran 2008 Syntax
USE mpi_f08
MPI_Finalized(flag, ierror)
LOGICAL, INTENT(OUT) :: flag
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π OUTPUT PARAMETER π
flagβ true if the MPI world model was finalized, and false otherwise (logical). it's literally just a yes/no, bestie, no nuance πierrorβ Fortran only: error status (integer).
β¨ DESCRIPTION β¨
so this routine is the one you call to figure out whether the MPI world model has been finalized. that's it, that's the job π«Ά
and ngl, there's a different routine for the other direction β MPI_Initialized β and that one is what tells you whether the MPI world model has been initialized. two besties, two questions, don't mix them up π
if you want the receipts on which MPI functionality is still available to you (like, stuff that works even when the MPI world model hasn't initialized yet, or has already been finalized), go look at MPI-5.0:11.4.1 over at <https://www.mpi-forum.org/> π
π ERRORS π
almost all MPI routines return an error value. for C routines it comes back as the return result of the function, and for Fortran routines it shows up in the last argument. classic.
before that error value gets returned, the current MPI error handler associated with the communication object (so like, communicator, window, file) gets called. if there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and it will call the associated MPI error handler. and when MPI_COMM_SELF is not initialized β meaning 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. the initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when 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 no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions, while the MPI_ERRORS_ABORT error handler gets called for all other MPI functions. π
Open MPI ships with three predefined error handlers you can use, and they are:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. π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.MPI_ERRORS_RETURNβ returns an error code to the application.
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
β οΈ important, bestie: note that MPI does not guarantee that an MPI program can continue past an error. so don't be out here assuming things will just keep vibing after a failure, because they might not, fr fr.
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. π
see also:
MPI_InitMPI_Init_threadMPI_FinalizeMPI_FinalizedMPI_Session_initMPI_Session_finalize
π Copyright π
2003-2026, The Open MPI Community
and that's the whole page, no crumbs left behind π
Open MPI Β· Sep 10, 2026 Β· MPI_FINALIZED(3) β slay, go finalize responsibly, mwah π
β¨π«Ά
π¦ 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