MPI_SESSION_INIT(3)

๐Ÿ“ฆ
version 5.0.10 ยท 4 versions
, in ubuntu stonking

๐Ÿ‘‘ 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 if MPI_Abort was called on that communicator. If called on a window or file, 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, 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_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. 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_Init
  • MPI_Initialized
  • MPI_Init_thread
  • MPI_Finalize
  • MPI_Finalized
  • MPI_Group_from_session_pset
  • MPI_Session_c2f
  • MPI_Session_call_errhandler
  • MPI_Session_create_errhandler
  • MPI_Session_f2c
  • MPI_Session_finalize
  • MPI_Session_get_errhandler
  • MPI_Session_get_info
  • MPI_Session_get_nth_pset
  • MPI_Session_get_num_psets
  • MPI_Session_get_pset_info
  • MPI_Session_init
  • MPI_Session_set_errhandler
  • MPI_T_pvar_session_create
  • MPI_T_pvar_session_free

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