MPI_COMM_GROUP(3)

πŸ’… MPI_Comm_group β€” the Open MPI glow-up 🫢

okay so bestie, welcome to the Open MPI manual page for MPI_Comm_group, and no cap this one is a little icon. it literally just hands you the group that lives inside a communicator. that's it. that's the whole vibe. ✨


✨ SYNTAX ✨

🌸 C Syntax

#include <mpi.h>

int MPI_Comm_group(MPI_Comm comm, MPI_Group *group)

πŸŽ€ Fortran Syntax

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

πŸ¦‹ Fortran 2008 Syntax

USE mpi_f08
MPI_Comm_group(comm, group, ierror)
     TYPE(MPI_Comm), INTENT(IN) :: comm
     TYPE(MPI_Group), INTENT(OUT) :: group
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ’– INPUT PARAMETER πŸ’–

  • comm β€” the communicator. yes, that one. hand it over. 🫴

🌟 OUTPUT PARAMETERS 🌟

  • group β€” the group chilling inside that communicator (handle). it's giving "here's your friend group, bestie". πŸ‘‘
  • ierror β€” Fortran only, bb: the error status, and it's an integer. 😌

πŸ’… DESCRIPTION πŸ’…

so if your communicator is an intercommunicator (that's the kind that lets two whole groups of processes talk to each other), this function gives you back the local group. that's it. the local one. 🫢

and if you're sitting there like "okay but what about the other group tho 😭" β€” that's a whole different function, bestie. use MPI_Comm_remote_group for the remote group. iykyk. ✨


πŸ”₯ ERRORS πŸ”₯

okay so almost every MPI routine returns an error value, lowkey. in C routines it's the return result of the function, and in Fortran routines it's that last argument. classic. 😌

before the error value even comes back to you, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. and if there's no communication object tied to the MPI call, then the call counts as attached to MPI_COMM_SELF and it'll 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. and 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 with 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, and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. periodt. πŸ’€

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. yes, all of them. dramatic but valid. πŸ’€
  • 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. and if it's called on a session, it aborts only the local process. slay, know your scope. ✨
  • MPI_ERRORS_RETURN β€” returns an error code to the application. polite. respectful. we love her. πŸŽ€

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
⚠️ okay important caveat bestie, don't skip this one: note that MPI does not guarantee that an MPI program can continue past an error. fr fr. 😭

see the MPI man page for a full list of MPI error codes. and see the Error Handling section of the MPI-3.1 standard for more information. πŸ“š


2003-2026, The Open MPI Community


and that's the whole page, bestie!! πŸŽ€ source/version teaser: this is Open MPI, dated Sep 11, 2026 β€” go forth and group responsibly πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from