MPI_GROUP_FREE(3)

πŸ’– MPI_GROUP_FREE πŸ’–

okay bestie, welcome to the Open MPI manual, page MPI_GROUP_FREE(3) β€” yes that's the manual name, we're saying it out loud because it's literally the whole vibe of this page 🫢

✨ NAME ✨

MPI_Group_free β€” frees a group.

Like, releases it. Lets it go. Sets it free. πŸ¦‹


πŸ“œ SYNTAX πŸ“œ

C Syntax

#include <mpi.h>

int MPI_Group_free(MPI_Group *group)

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'

MPI_GROUP_FREE(GROUP, IERROR)
    INTEGER GROUP, IERROR

Fortran 2008 Syntax

USE mpi_f08

MPI_Group_free(group, ierror)
    TYPE(MPI_Group), INTENT(INOUT) :: group
    INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🌸 INPUT/OUTPUT PARAMETER 🌸

  • group β€” the Group (handle). It goes in, it comes back changed. main character energy, honestly.

🌈 OUTPUT PARAMETER 🌈

  • ierror β€” Fortran only: the error status (integer).

πŸ’… DESCRIPTION πŸ’…

So here's the tea: this operation marks a group object for deallocation. Not instant-gone, just ✨marked✨. And the group handle gets set to MPI_GROUP_NULL by the call. Slay.

Any ongoing operation that's using this group? It'll complete normally. No chaos, no drama, it finishes what it started. πŸ’–


πŸ“Œ NOTE πŸ“Œ

On return, group is set to MPI_GROUP_NULL. That's it. That's the note. fr fr.


😭 ERRORS 😭

ngl this section is the longest one and it's giving important.

Almost all MPI routines return an error value β€” C routines hand it back as the return result of the function, and Fortran routines put it in the last argument.

Before that error value 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 attached to the MPI call? Then the call is considered attached to MPI_COMM_SELF, and it'll call the associated MPI error handler. πŸ‘‘

But wait β€” when MPI_COMM_SELF isn't 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 instead. 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
  • via the mpi_initial_errhandler CLI argument to mpiexec, or
  • via the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple.

And if no other appropriate error handler has been set? Then MPI_ERRORS_RETURN gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all other MPI functions. periodt.

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

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler you can invoke 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.
  • MPI_ERRORS_RETURN β€” returns an error code to the application.

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
⚠️ Real talk: note that MPI does not guarantee that an MPI program can continue past an error. Like, at all. Don't assume you can just keep going. 😭

For the full list of MPI error codes, go see the MPI man page. And for more info, check the Error Handling section of the MPI-3.1 standard. iykyk. πŸ“š


2003-2026, The Open MPI Community


and that's the whole page babes 🌟 this was MPI_GROUP_FREE(3) from Open MPI, dated Sep 10, 2026 β€” go free those groups, you got this πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from