Group#

Overview#

A group is an ordered set of process identifiers. Each process in a group is associated with an integer rank. Ranks are contiguous and start from zero. Groups are represented by mpl::group objects. A group is used within a communicator to describe the participants in a communication “universe” and to rank such participants.

Class documentation#

class group#

Represents a group of processes.

Public Types

enum class equality_type#

Group equality types.

Values:

enumerator identical#

groups are identical, i.e., groups have same the members in same rank order

enumerator similar#

groups are similar, i.e., groups have same tha members in different rank order

enumerator unequal#

groups are unequal, i.e., groups have different sets of members

Public Functions

group() = default#

Creates an empty process group.

inline group(const group &other)#

Creates a new process group by copying an existing one.

Note

Process groups should not be copied unless a new independent group is wanted. Process groups should be passed via references to functions to avoid unnecessary copying.

Parameters:

other – the other group to copy from

inline group(group &&other) noexcept#

Move-constructs a process group.

Parameters:

other – the other group to move from

inline explicit group(const communicator &comm)#

Creates a new group that consists of all processes of the given communicator.

Parameters:

comm – the communicator

inline explicit group(const inter_communicator &comm)#

Creates a new group that consists of all processes of the local group of the given inter-communicator.

Parameters:

comm – the inter-communicator

inline explicit group(const file &f)#

Creates a new group that consists of all processes of the local group of the given file.

Parameters:

f – the file

inline explicit group(Union_tag tag, const group &other_1, const group &other_2)#

Creates a new group that consists of the union of two existing process groups.

Parameters:
  • tag – indicates the unification of two existing process groups

  • other_1 – first existing process group

  • other_2 – second existing process group

inline explicit group(intersection_tag tag, const group &other_1, const group &other_2)#

Creates a new group that consists of the intersection of two existing process groups.

Parameters:
  • tag – indicates the intersection of two existing process groups

  • other_1 – first existing process group

  • other_2 – second existing process group

inline explicit group(difference_tag tag, const group &other_1, const group &other_2)#

Creates a new group that consists of the difference of two existing process groups.

Parameters:
  • tag – indicates the difference of two existing process groups

  • other_1 – first existing process group

  • other_2 – second existing process group

inline explicit group(include_tag tag, const group &other, const ranks &rank)#

Creates a new group by including members of an existing process group.

Parameters:
  • tag – indicates inclusion from an existing process group

  • other – existing process group

  • rank – set of ranks to include

inline explicit group(exclude_tag tag, const group &other, const ranks &rank)#

Creates a new group by excluding members of an existing process group.

Parameters:
  • tag – indicates exclusion from an existing process group

  • other – existing process group

  • rank – set of ranks to exclude

inline ~group()#

Destructs a process group.

inline group &operator=(const group &other)#

Copy-assigns a process group.

Note

Process groups should not be copied unless a new independent group is wanted. Process groups should be passed via references to functions to avoid unnecessary copying.

Parameters:

other – the other group to move from

Returns:

this group

inline group &operator=(group &&other) noexcept#

Move-assigns a process group.

Parameters:

other – the other group to move from

Returns:

this group

inline MPI_Group native_handle() const#

Get the underlying MPI handle of the group.

Note

This function returns a non-owning handle to the underlying MPI group, which may be useful when refactoring legacy MPI applications to MPL.

Warning

The handle must not be used to modify the MPI group that the handle points to. This method will be removed in a future version.

Returns:

MPI handle of the group

inline int size() const#

Determines the total number of processes in a process group.

Returns:

number of processes

inline int rank() const#

Determines the rank within a process group.

Returns:

the rank of the calling process in the group

inline int translate(int rank, const group &other) const#

Determines the relative numbering of the same process in two different groups.

Parameters:
  • rank – a valid rank in the given process group

  • other – process group

Returns:

corresponding rank in this process group

inline ranks translate(const ranks &rank, const group &other) const#

Determines the relative numbering of the same process in two different groups.

Parameters:
  • rank – a set valid ranks in the given process group

  • other – process group

Returns:

corresponding ranks in this process group

inline bool operator==(const group &other) const#

Tests for identity of process groups.

Parameters:

other – process group to compare with

Returns:

true if identical

inline bool operator!=(const group &other) const#

Tests for identity of process groups.

Parameters:

other – process group to compare with

Returns:

true if not identical

inline equality_type compare(const group &other) const#

Compares to another process group.

Parameters:

other – process group to compare with

Returns:

equality type

Public Static Attributes

static constexpr equality_type identical = equality_type::identical#

Indicates that groups are identical, i.e., groups have same the members in same rank order.

static constexpr equality_type similar = equality_type::similar#

Indicates that groups are similar, i.e., groups have same tha members in different rank order.

static constexpr equality_type unequal = equality_type::unequal#

Indicates that groups are unequal, i.e., groups have different sets of members.

static constexpr Union_tag Union = {}#

Indicates the creation of a union of two groups.

static constexpr intersection_tag intersection = {}#

Indicates the creation of an intersection of two groups.

static constexpr difference_tag difference = {}#

Indicates the creation of a difference of two groups.

static constexpr include_tag include = {}#

Indicates the creation of a subgroup by including members of an existing group.

static constexpr exclude_tag exclude = {}#

Indicates the creation of a subgroup by excluding members of an existing group.

Friends

friend class communicator
class difference_tag#

Indicates the creation of a difference of two groups.

class exclude_tag#

Indicates the creation of a subgroup by excluding members of an existing group.

class include_tag#

Indicates the creation of a subgroup by including members of an existing group.

class intersection_tag#

Indicates the creation of an intersection of two groups.

class Union_tag#

Indicates the creation of a union of two groups.