PEARL
Parallel Event Access and Replay Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Attributes | Friends | Related Functions
pearl::ProcessGroup Class Reference

Defines a group of processes by means of global process identifiers. More...

#include <pearl/ProcessGroup.h>

Inheritance diagram for pearl::ProcessGroup:
pearl::MpiGroup

List of all members.

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 StringgetName () 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.

Detailed Description

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].


Member Typedef Documentation

typedef uint32_t pearl::ProcessGroup::IdType
typedef std::vector<int> pearl::ProcessGroup::RankContainer

Constructor & Destructor Documentation

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.

Parameters:
idGlobal process group identifier
nameProcess group name
ranksOrdered list of global process identifiers defining the group
isSelfIndicates whether this group refers to 'SELF'
isWorldIndicates whether this group refers to 'WORLD'
virtual pearl::ProcessGroup::~ProcessGroup ( ) [virtual]

Releases all allocated resources and destroys the instance.


Member Function Documentation

int pearl::ProcessGroup::getGlobalRank ( int  localRank) const

Returns the global process identifier of the process with the given localRank with respect to this group.

Parameters:
localRankLocal rank within this group
Returns:
Global process identifier
Exceptions:
RuntimeErrorif an invalid localRank is given ("Rank out of range")

Returns the global identifier of the process group definition.

Returns:
Global identifier
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.

Parameters:
globalRankGlobal process identifier
Returns:
Local rank within this group
Exceptions:
RuntimeErrorif the process with globalRank is not part of this group ("Unknown identifier")

Returns the string definition storing the process group's name. If this information is not available, String::UNDEFINED is returned.

Returns:
Process group name

Returns whether this group is a 'SELF' group.

Returns:
Flag indicating 'SELF' status.

Returns whether this group is a 'WORLD' group.

Returns:
Flag indicating 'WORLD' status.
uint32_t pearl::ProcessGroup::numRanks ( ) const

Returns the number of associated processes in this group.

Returns:
Number of processes

Friends And Related Function Documentation

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.

Parameters:
lhsLeft-hand operand
rhsRight-hand operand
Returns:
True if the process group definitions differ, false otherwise.
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.

Parameters:
streamOutput stream
itemProcess group definition object
Returns:
Output stream
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.

Parameters:
lhsLeft-hand operand
rhsRight-hand operand
Returns:
True if the process group definitions are equal, false otherwise.

Member Data Documentation

const IdType pearl::ProcessGroup::NO_ID = (~static_cast<IdType>(0)) [static]

Static instance of class ProcessGroup representing undefined process group entries in other definitions.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Scalasca    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