PEARL
Parallel Event Access and Replay Library
Public Types | Static Public Attributes | Friends | List of all members
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

Public Types

typedef uint32_t IdType
 ProcessGroup definition identifier type. More...
 
typedef std::vector< int > RankContainer
 Container type for process identifiers (i.e., MPI ranks). More...
 

Public Member Functions

Constructors & destructor
 ProcessGroup (IdType id, const String &name, const RankContainer &ranks, bool isSelf, bool isWorld)
 Constructor. More...
 
virtual ~ProcessGroup ()
 Destructor. More...
 
Access definition data
IdType getId () const
 Get global identifier. More...
 
const StringgetName () const
 Get process group name. More...
 
uint32_t numRanks () const
 Get number of processes. More...
 
int getLocalRank (int globalRank) const
 Convert global to local rank. More...
 
int getGlobalRank (int localRank) const
 Convert local to global rank. More...
 
bool isSelf () const
 
bool isWorld () const
 

Static Public Attributes

static const IdType NO_ID = (~static_cast<IdType>(0))
 Numerical identifier used for undefined process group definitions. More...
 
static const ProcessGroup UNDEFINED
 

Friends

std::ostream & operator<< (std::ostream &stream, const ProcessGroup &item)
 

Related Functions

(Note that these are not member functions.)

Stream I/O functions
std::ostream & operator<< (std::ostream &stream, const ProcessGroup &item)
 Stream output operator. More...
 
Comparison operators
bool operator== (const ProcessGroup &lhs, const ProcessGroup &rhs)
 Equality operator. More...
 
bool operator!= (const ProcessGroup &lhs, const ProcessGroup &rhs)
 Inequality operator. More...
 

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

◆ IdType

typedef uint32_t pearl::ProcessGroup::IdType

◆ RankContainer

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

Constructor & Destructor Documentation

◆ ProcessGroup()

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'

◆ ~ProcessGroup()

virtual pearl::ProcessGroup::~ProcessGroup ( )
virtual

Releases all allocated resources and destroys the instance.

Member Function Documentation

◆ getGlobalRank()

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")

◆ getId()

IdType pearl::ProcessGroup::getId ( ) const

Returns the global identifier of the process group definition.

Returns
Global identifier

◆ getLocalRank()

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")

◆ getName()

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.

Returns
Process group name

◆ isSelf()

bool pearl::ProcessGroup::isSelf ( ) const

Returns whether this group is a 'SELF' group.

Returns
Flag indicating 'SELF' status.

◆ isWorld()

bool pearl::ProcessGroup::isWorld ( ) const

Returns whether this group is a 'WORLD' group.

Returns
Flag indicating 'WORLD' status.

◆ numRanks()

uint32_t pearl::ProcessGroup::numRanks ( ) const

Returns the number of associated processes in this group.

Returns
Number of processes

Friends And Related Function Documentation

◆ operator!=()

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.

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  stream,
const ProcessGroup item 
)
friend

◆ operator<<() [2/2]

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

◆ operator==()

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

◆ NO_ID

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

◆ UNDEFINED

const ProcessGroup pearl::ProcessGroup::UNDEFINED
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:

Scalasca    Copyright © 1998–2016 Forschungszentrum Jülich GmbH, Jülich Supercomputing Centre
Copyright © 2009–2015 German Research School for Simulation Sciences GmbH, Laboratory for Parallel Programming