MPI_GROUP_RANGE_EXCL(3)

MPI_GROUP_RANGE_EXCL πŸ’…

okay bestie, so this is a page from the Open MPI manual, and we're about to make a whole new group by ✨excluding✨ a bunch of process ranges from a group you already have. it's giving "block list but for ranks." let's go πŸŽ€

NAME 🌸

MPI_Group_range_excl β€” produces a group by excluding ranges of processes from an existing group.


SYNTAX ✨

C Syntax

#include <mpi.h>

int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
     MPI_Group *newgroup)

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_GROUP_RANGE_EXCL(GROUP, N, RANGES, NEWGROUP, IERROR)
     INTEGER GROUP, N, RANGES(3,*), NEWGROUP, IERROR

Fortran 2008 Syntax

USE mpi_f08
MPI_Group_range_excl(group, n, ranges, newgroup, ierror)
     TYPE(MPI_Group), INTENT(IN) :: group
     INTEGER, INTENT(IN) :: n, ranges(3,n)
     TYPE(MPI_Group), INTENT(OUT) :: newgroup
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

INPUT PARAMETERS 🫢

  • group β€” the group, as a handle. like, the friend group we're editing. πŸ«‚
  • n β€” number of triplets in the array ranges (integer). yes, triplets, plural, so n of them.
  • ranges β€” a one-dimensional array of integer triplets shaped like (first rank, last rank, stride), telling you which ranks in group get kicked out of the output group newgroup. note it says excluded from β€” these are the ones leaving the chat πŸšͺ

OUTPUT PARAMETERS πŸ’–

  • newgroup β€” the new group derived from the above, and crucially it preserves the order in group (handle). no shuffling, the order stays iconic πŸ’…
  • ierror β€” Fortran only: error status (integer).

DESCRIPTION πŸ”₯

so, each computed rank must be a valid rank in group, and all computed ranks must be distinct, or else the program is erroneous. like, no duplicates and no imaginary friends. periodt. 😭

the functionality of this routine is specified to be equivalent to expanding the array of ranges into an array of the excluded ranks and passing that resulting array of ranks β€” plus the other arguments β€” to MPI_Group_excl. and a call to MPI_Group_excl is equivalent to a call to MPI_Group_range_excl with each rank i in ranks replaced by the triplet (i,i,1) in the argument ranges. it's the same vibe, different packaging 🎁


ERRORS πŸ’€

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, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. if there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and it will call the associated MPI error handler. and 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. that initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or via 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. πŸ˜΅β€πŸ’«

Open MPI includes three predefined error handlers you can use:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. it's giving no 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, it 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, it aborts only the local process.
  • MPI_ERRORS_RETURN β€” returns an error code to the application. polite king πŸ‘‘

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, it might just not come back 😭

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: πŸ¦‹

  • MPI_Group_excl
  • MPI_Group_free

2003-2026, The Open MPI Community


and that's the whole page bestie, we ate and left no crumbs πŸ’…βœ¨ this was written by the Open MPI community, dated Sep 10, 2026, and it's page MPI_GROUP_RANGE_EXCL(3) of the Open MPI manual β€” now go exclude those ranks, mwah πŸ«ΆπŸ’–πŸŽ€

πŸ“¦ where this page comes from