A group
is a representation of a subset of the processes within a communicator
.
More...
#include <group.hpp>
Classes | |
struct | group_free |
INTERNAL ONLY. More... | |
Public Member Functions | |
group () | |
Constructs an empty group. More... | |
group (const MPI_Group &in_group, bool adopt) | |
Constructs a group from an MPI_Group . More... | |
optional< int > | rank () const |
Determine the rank of the calling process in the group. More... | |
int | size () const |
Determine the number of processes in the group. More... | |
template<typename InputIterator , typename OutputIterator > | |
OutputIterator | translate_ranks (InputIterator first, InputIterator last, const group &to_group, OutputIterator out) |
Translates the ranks from one group into the ranks of the same processes in another group. More... | |
operator bool () const | |
Determines whether the group is non-empty. More... | |
operator MPI_Group () const | |
Retrieves the underlying MPI_Group associated with this group. More... | |
template<typename InputIterator > | |
group | include (InputIterator first, InputIterator last) |
Creates a new group including a subset of the processes in the current group. More... | |
template<typename InputIterator > | |
group | exclude (InputIterator first, InputIterator last) |
Creates a new group from all of the processes in the current group, exluding a specific subset of the processes. More... | |
template<> | |
BOOST_MPI_DECL int * | translate_ranks (int *first, int *last, const group &to_group, int *out) |
INTERNAL ONLY. More... | |
template<> | |
BOOST_MPI_DECL group | include (int *first, int *last) |
INTERNAL ONLY. More... | |
template<> | |
BOOST_MPI_DECL group | exclude (int *first, int *last) |
INTERNAL ONLY. More... | |
Protected Attributes | |
shared_ptr< MPI_Group > | group_ptr |
The underlying MPI group. More... | |
A group
is a representation of a subset of the processes within a communicator
.
The group
class allows one to create arbitrary subsets of the processes within a communicator. One can compute the union, intersection, or difference of two groups, or create new groups by specifically including or excluding certain processes. Given a group, one can create a new communicator containing only the processes in that group.
|
inline |
boost::mpi::group::group | ( | const MPI_Group & | in_group, |
bool | adopt | ||
) |
Constructs a group from an MPI_Group
.
This routine allows one to construct a Boost.MPI group
from a C MPI_Group
. The group
object can (optionally) adopt the MPI_Group
, after which point the group
object becomes responsible for freeing the MPI_Group
when the last copy of group
disappears.
in_group | The MPI_Group used to construct this group . |
adopt | Whether the group should adopt the MPI_Group . When true, the group object (or one of its copies) will free the group (via MPI_Comm_free ) when the last copy is destroyed. Otherwise, the user is responsible for calling MPI_Group_free . |
group boost::mpi::group::exclude | ( | InputIterator | first, |
InputIterator | last | ||
) |
Creates a new group from all of the processes in the current group, exluding a specific subset of the processes.
This routine creates a new group
which includes all of the processes in the current group except those whose ranks are listed in the integer iterator range [first, last). Equivalent to
MPI_Group_excl
.
first
The beginning of the iterator range of ranks to exclude.
last
Past the end of the iterator range of ranks to exclude.
[first, last) in the current group. References BOOST_MPI_CHECK_RESULT, and group().
BOOST_MPI_DECL group boost::mpi::group::exclude | ( | int * | first, |
int * | last | ||
) |
INTERNAL ONLY.
Specialization of group::exclude that handles the one case where we can avoid any memory allocation or copying before creating the group.
group boost::mpi::group::include | ( | InputIterator | first, |
InputIterator | last | ||
) |
Creates a new group including a subset of the processes in the current group.
This routine creates a new group
which includes only those processes in the current group that are listed in the integer iterator range [first, last). Equivalent to
MPI_Group_incl
.
first
The beginning of the iterator range of ranks to include.
last
Past the end of the iterator range of ranks to include.
[first, last) in the current group. References BOOST_MPI_CHECK_RESULT, and group().
BOOST_MPI_DECL group boost::mpi::group::include | ( | int * | first, |
int * | last | ||
) |
INTERNAL ONLY.
Specialization of group::include that handles the one case where we can avoid any memory allocation or copying before creating the group.
|
inline |
Determines whether the group is non-empty.
|
inline |
Retrieves the underlying MPI_Group
associated with this group.
MPI_Group
handle manipulated by this object. If this object represents the empty group, returns MPI_GROUP_EMPTY
. optional<int> boost::mpi::group::rank | ( | ) | const |
Determine the rank of the calling process in the group.
This routine is equivalent to MPI_Group_rank
.
int boost::mpi::group::size | ( | ) | const |
Determine the number of processes in the group.
This routine is equivalent to MPI_Group_size
.
OutputIterator boost::mpi::group::translate_ranks | ( | InputIterator | first, |
InputIterator | last, | ||
const group & | to_group, | ||
OutputIterator | out | ||
) |
Translates the ranks from one group into the ranks of the same processes in another group.
This routine translates each of the integer rank values in the iterator range [first, last) from the current group into rank values of the corresponding processes in
to_group
. The corresponding rank values are written via the output iterator out
. When there is no correspondence between a rank in the current group and a rank in to_group
, the value MPI_UNDEFINED
is written to the output iterator.
first | Beginning of the iterator range of ranks in the current group. |
last | Past the end of the iterator range of ranks in the current group. |
to_group | The group that we are translating ranks to. |
out | The output iterator to which the translated ranks will be written. |
References BOOST_MPI_CHECK_RESULT, boost::multiprecision::backends::i, boost::n, and boost::out.
BOOST_MPI_DECL int* boost::mpi::group::translate_ranks | ( | int * | first, |
int * | last, | ||
const group & | to_group, | ||
int * | out | ||
) |
INTERNAL ONLY.
Specialization of translate_ranks that handles the one case where we can avoid any memory allocation or copying.
|
protected |
The underlying MPI group.
This is a shared pointer, so the actual MPI group which will be shared among all related instances of the group
class. When there are no more such instances, the group will be automatically freed.