![]() |
PEARL
Parallel Event Access and Replay Library
|
Defines a group of processes by means of global process identifiers. More...
#include <pearl/ProcessGroup.h>
Public Types | |
typedef uint32_t | IdType |
ProcessGroup definition identifier type. | |
typedef std::vector< int > | RankContainer |
Container type for process identifiers (i.e., MPI ranks). | |
Public Member Functions | |
IdType | getId () const |
Get global identifier. | |
const String & | getName () const |
Get process group name. | |
uint32_t | numRanks () const |
Get number of processes. | |
int | getLocalRank (int globalRank) const |
Convert global to local rank. | |
int | getGlobalRank (int localRank) const |
Convert local to global rank. | |
bool | isSelf () const |
bool | isWorld () const |
Constructors & destructor | |
ProcessGroup (IdType id, const String &name, const RankContainer &ranks, bool isSelf, bool isWorld) | |
Constructor. | |
virtual | ~ProcessGroup () |
Destructor. | |
Static Public Attributes | |
static const IdType | NO_ID = (~static_cast<IdType>(0)) |
Numerical identifier used for undefined process group definitions. | |
static const ProcessGroup | UNDEFINED |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const ProcessGroup &item) |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const ProcessGroup &lhs, const ProcessGroup &rhs) |
Equality operator. | |
bool | operator!= (const ProcessGroup &lhs, const ProcessGroup &rhs) |
Inequality operator. | |
Stream I/O functions | |
std::ostream & | operator<< (std::ostream &stream, const ProcessGroup &item) |
Stream output operator. |
The class ProcessGroup provides a way to group multiple processes (e.g., MPI ranks) and to identify such groups using an unique identifier. This is accomplished by storing an ordered set of global process identifiers (i.e., global ranks). Due to the ordering, each process in the group is implicitly assigned a local identifier (local rank) in the range [0,#members-1] with respect to this group. ProcessGroup objects are used to define MPI groups (see MpiGroup) and are referenced by MPI communicator objects (see Comm and MpiComm). The numerical identifiers of the individual groups are globally defined and continuously enumerated, i.e., the ID is element of [0,#process_groups-1].
typedef uint32_t pearl::ProcessGroup::IdType |
typedef std::vector<int> pearl::ProcessGroup::RankContainer |
pearl::ProcessGroup::ProcessGroup | ( | IdType | id, |
const String & | name, | ||
const RankContainer & | ranks, | ||
bool | isSelf, | ||
bool | isWorld | ||
) |
Creates a process group definition instance and initializes it with the given values. The flags isSelf and isWorld are mutually exclusive, except for single-process experiments.
id | Global process group identifier |
name | Process group name |
ranks | Ordered list of global process identifiers defining the group |
isSelf | Indicates whether this group refers to 'SELF' |
isWorld | Indicates whether this group refers to 'WORLD' |
virtual pearl::ProcessGroup::~ProcessGroup | ( | ) | [virtual] |
Releases all allocated resources and destroys the instance.
int pearl::ProcessGroup::getGlobalRank | ( | int | localRank | ) | const |
Returns the global process identifier of the process with the given localRank with respect to this group.
localRank | Local rank within this group |
RuntimeError | if an invalid localRank is given ("Rank out of range") |
IdType pearl::ProcessGroup::getId | ( | ) | const |
Returns the global identifier of the process group definition.
int pearl::ProcessGroup::getLocalRank | ( | int | globalRank | ) | const |
Returns the local rank with respect to this group of the process with the given global process identifier globalRank.
globalRank | Global process identifier |
RuntimeError | if the process with globalRank is not part of this group ("Unknown identifier") |
const String& pearl::ProcessGroup::getName | ( | ) | const |
Returns the string definition storing the process group's name. If this information is not available, String::UNDEFINED is returned.
bool pearl::ProcessGroup::isSelf | ( | ) | const |
Returns whether this group is a 'SELF' group.
bool pearl::ProcessGroup::isWorld | ( | ) | const |
Returns whether this group is a 'WORLD' group.
uint32_t pearl::ProcessGroup::numRanks | ( | ) | const |
Returns the number of associated processes in this group.
bool operator!= | ( | const ProcessGroup & | lhs, |
const ProcessGroup & | rhs | ||
) | [related] |
Compares two process group definition objects lhs and rhs for inequality. Two process groups are considered unequal if either their IDs, names, or the size of the rank lists differ.
lhs | Left-hand operand |
rhs | Right-hand operand |
std::ostream& operator<< | ( | std::ostream & | stream, |
const ProcessGroup & | item | ||
) | [friend] |
std::ostream & operator<< | ( | std::ostream & | stream, |
const ProcessGroup & | item | ||
) | [related] |
Prints the contents of the given process group definition object item to an output stream in a human-readable form.
stream | Output stream |
item | Process group definition object |
bool operator== | ( | const ProcessGroup & | lhs, |
const ProcessGroup & | rhs | ||
) | [related] |
Compares two process group definition objects lhs and rhs for equality. Two process groups are considered equal if their identifiers, names, and the size of the rank lists are identical.
lhs | Left-hand operand |
rhs | Right-hand operand |
const IdType pearl::ProcessGroup::NO_ID = (~static_cast<IdType>(0)) [static] |
const ProcessGroup pearl::ProcessGroup::UNDEFINED [static] |
Static instance of class ProcessGroup representing undefined process group entries in other definitions.
![]() |
Copyright © 1998–2014 Forschungszentrum Jülich GmbH,
Jülich Supercomputing Centre
Copyright © 2009–2014 German Research School for Simulation Sciences GmbH, Laboratory for Parallel Programming |