MPI_Comm_group

MPI_Comm_group determines the group handle of a communicator.

Fortran Syntax

Subroutine MPI_Comm_group(comm, group, ierr)

C Syntax

int MPI_Comm_group(MPI_Comm comm, MPI_Group *group)


Example in Fortran


     include "mpif.h"
     integer comm_world, ierr, group_world

     comm_world = MPI_COMM_WORLD
     call MPI_Comm_group(comm_world, group_world, ierr)


Example in C


     #include "mpi.h";
     MPI_Comm  comm_world;
     MPI_Group group_world;

     comm_world = MPI_COMM_WORLD;
     MPI_Comm_group(comm_world, &group_world);

Associated with a communicator is its group identity, or handle. In the above example, we used MPI_Comm_group to obtain the group handle of the communicator MPI_COMM_WORLD. This handle can then be used as input to the routine

  • MPI_Group_incl to select among the processes of one group to form another (new) group.
  • MPI_Comm_create to create a new communicator whose members are those of the new group.
  • MPI_Group_rank to find the current process rank’s equivalent process rank in a group.