MPI_SESSION_INIT(3)
๐ MPI_SESSION_INIT(3) โ Open MPI edition, bestie ๐
okay so picture this: it's giving MPI_SESSION_INIT(3), from your friends at Open MPI, and it is literally the glow-up your MPI program has been waiting for. let's get into it ๐ซถ
โจ NAME โจ
MPI_Session_init โ creates a new session handle. that's it, that's the whole vibe. brand new session, fresh out the box ๐
๐ SYNOPSIS ๐
C Syntax
#include <mpi.h>
int MPI_Session_init(MPI_Info info, MPI_Errhandler errhandler, MPI_Session *session)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_SESSION_INIT(INFO, ERRHANDLER, SESSION, IERROR)
INTEGER INFO, ERRHANDLER, SESSION, IERROR
Fortran 2008 Syntax
USE mpi_f08
MPI_Session_init(info, errhandler, session, ierror)
TYPE(MPI_Info), INTENT(IN) :: info
TYPE(MPI_Errhandler), INTENT(IN) :: errhandler
TYPE(MPI_Session), INTENT(OUT) :: session
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
๐ INPUT PARAMETERS ๐
info: an info object (handle). this is where you slide in with your requests, no cap ๐ธerrhandler(error handler to be attached to the returned session) (handle) : the whole "if this goes wrong, who do we call" situation. the handler gets attached to the session that comes back ๐ฆ
๐ OUTPUT PARAMETERS ๐
session: the new session (handle). your brand new baby, go off ๐ierror: Fortran only โ error status (integer). it's the last-argument girlie, she reports back ๐
๐ฆ DESCRIPTION ๐ฆ
MPI_Session_init is how you instantiate an MPI Session. like, the returned session handle is the key to the whole party โ you can use it to query the runtime system about characteristics of the job your process is running inside of, plus other system resources too. and that's not all bestie, other MPI communications can also be initiated in the context of an MPI session handle. โจ
but listen โ every single session has to be finalized via MPI_Session_finalize before the MPI process terminates. no leaving sessions un-finalized, that's not the vibe, that's a mess ๐ญ
Here's the thing that actually makes this iconic: you can create and destroy multiple sessions during the lifetime of one MPI process. that is different from the MPI world model, which can be initialized at most exactly once (and then subsequently finalized) during the lifetime of an MPI process. so likeโฆ world model = one and done, sessions = the whole rotating roster ๐
๐ NOTES ๐
The info argument is used to request MPI functionality requirements and possible MPI implementation specific capabilities. so it's the wishlist channel, basically ๐
The errhandler argument specifies an error handler to invoke in the event that the Session instantiation call encounters an error. insurance policy, but make it MPI ๐ง
๐ฅ ERRORS ๐ฅ
Almost all MPI routines return an error value โ C routines as the return result of the function, and Fortran routines in the last argument. classic. ๐
Before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. If no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. When MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when 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 the mpi_initial_errhandler CLI argument to mpiexec or info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. If no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. phew, say that five times fast ๐ฎโ๐จ
Open MPI includes three predefined error handlers that can be used:
MPI_ERRORS_ARE_FATALโ Causes the program to abort all connected MPI processes. absolutely nuclear, zero chill ๐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, acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. If called on a session, aborts only the local process. so it's the scalable dramatic exit ๐ชMPI_ERRORS_RETURNโ Returns an error code to the application. the chill one, the "here's your receipt bestie" one ๐งพ
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. fr fr, don't build your whole life on it ๐ซ
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 ๐
okay so the whole friend group, in order:
MPI_InitMPI_InitializedMPI_Init_threadMPI_FinalizeMPI_FinalizedMPI_Group_from_session_psetMPI_Session_c2fMPI_Session_call_errhandlerMPI_Session_create_errhandlerMPI_Session_f2cMPI_Session_finalizeMPI_Session_get_errhandlerMPI_Session_get_infoMPI_Session_get_nth_psetMPI_Session_get_num_psetsMPI_Session_get_pset_infoMPI_Session_initMPI_Session_set_errhandlerMPI_T_pvar_session_createMPI_T_pvar_session_free
๐ COPYRIGHT ๐
2003-2026, The Open MPI Community
and that's the whole page bestie, you ate it up ๐๐ this was MPI_SESSION_INIT(3) from Open MPI, datestamped Sep 10, 2026 โ go make some sessions, finalize them responsibly, and remember: MPI_Session_init now, MPI_Session_finalize later, periodt โจ๐
๐ฆ 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