MPI_COMM_GET_INFO(3)

πŸ’– MPI_COMM_GET_INFO(3) β€” the Open MPI glow-up πŸ’–

okay bestie, we're in section 3 of the Open MPI manuals and today's main character is MPI_Comm_get_info. it's giving "let me peek at what hints you're actually running with" and honestly? iconic. let's get into it ✨


🌸 NAME 🌸

MPI_Comm_get_info β€” pulls up the active communicator info hints. like, the real ones. not the ones you wished for.


πŸŽ€ SYNTAX πŸŽ€

C Syntax

#include <mpi.h>

int MPI_Comm_get_info(MPI_Comm comm, MPI_Info *info_used)

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_COMM_GET_INFO(COMM, INFO_USED, IERROR)
     INTEGER COMM, INFO_USED, IERROR

Fortran 2008 Syntax

USE mpi_f08
MPI_Comm_get_info(comm, info_used, ierror)
     TYPE(MPI_Comm), INTENT(IN) :: comm
     TYPE(MPI_Info), INTENT(OUT) :: info_used
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🫢 INPUT PARAMETERS 🫢

  • comm β€” the communicator you're asking for active info hints from. yes, that one. hand it over πŸ’…

✨ OUTPUT PARAMETERS ✨

  • info_used β€” a brand-new info object, returned packed with every active hint chillin' on this communicator. fresh out the box, bestie 🎁
  • ierror β€” Fortran only, bestie: error status, and it's an integer.

πŸ¦‹ DESCRIPTION πŸ¦‹

so MPI_Comm_get_info hands you back a new info object stuffed with the hints of the communicator that's tied to comm. what you get in info_used is the current setting of all the hints that the system is actually using for this communicator β€” not the ones you offered, the ones that made the cut ✨

and if there are literally no such hints? no stress. you still get a handle to a freshly created info object, it just contains no key/value pair. empty. a lil void. still valid though πŸ’€

⚠️ important bestie, do not forget this one: you are the one responsible for freeing info_used, and you do it with MPI_Info_free. it's your info now. your responsibility. your problem. periodt πŸ‘‘

πŸ’€ ERRORS πŸ’€

almost all MPI routines return an error value, okay? in C it comes back as the return result of the function. in Fortran it shows up in that last argument. classic.

before that error value gets returned, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. and if there's no communication object associated with the MPI call at all? then the call is considered attached to MPI_COMM_SELF, and it calls the associated MPI error handler. iykyk.

when MPI_COMM_SELF is not initialized β€” meaning before MPI_Init / MPI_Init_thread, or 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, bestie:

  • call MPI_Comm_set_errhandler on MPI_COMM_SELF, if you're using the World model, or
  • use the mpi_initial_errhandler CLI argument to mpiexec, or
  • use 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 gets called for MPI I/O functions, and the MPI_ERRORS_ABORT error handler gets called for all other MPI functions. that's the rule πŸ“

Open MPI ships with three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. yeah. everybody. gone. πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. when it's called on a communicator, it acts as if MPI_Abort was called on that communicator. if it's called on a window or file, it acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. if it's called on a session, it aborts only the local process. cute and local πŸŽ€
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one. the lowkey 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. like, no cap. do not assume you can just keep going πŸ’…

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.

also see:

  • MPI_Comm_get_info
  • MPI_Info_free

2003-2026, The Open MPI Community


okay that's the whole thing, you ate it, slay πŸ’– this page was served up by the Open MPI crew, section 3, dated Sep 10, 2026 β€” go forth and free your info objects, bestie πŸŒˆπŸ¦‹β­

πŸ“¦ where this page comes from