Peano
Loading...
Searching...
No Matches
toolbox::loadbalancing::Statistics Class Reference

Statistics helper routine for load balancing. More...

#include <Statistics.h>

Collaboration diagram for toolbox::loadbalancing::Statistics:

Public Member Functions

 Statistics ()
 
std::string toString () const
 
void updateGlobalView ()
 Update the global statistics view on all ranks.
 
int getGlobalNumberOfRanksWithEnabledLoadBalancing () const
 
int getGlobalNumberOfTrees () const
 
int getNumberOfStateUpdatesWithoutAnySplit () const
 Number of updateGlobalView() calls without any split on any rank.
 
int getMaximumTreesPerRank () const
 
void incLocalNumberOfSplits (int delta=1)
 Rank-local: Bookmark that this rank has triggered a split.
 
int getLocalNumberOfSplits () const
 Number of splits this rank has triggered since the last updateGlobalView()
 
void notifyOfStateChange (State state)
 Rank-local: Memorise whether the load balancing on this rank is switched on.
 

Private Attributes

bool _localLoadBalancingEnabled
 Rank-local: Is the load balancing on this rank switched on.
 
int _localNumberOfSplits
 Rank-local accumulator where I keep track of how often I did split since the last updateGlobalView().
 
int _globalNumberOfTrees
 
int _globalNumberOfRanksWithEnabledLoadBalancing
 
int _globalNumberOfSplits
 Sum of all ranks' local number of splits at the last updateGlobalView()
 
int _numberOfStateUpdatesWithoutAnySplit
 
int _maximumTreesPerRank
 

Static Private Attributes

static tarch::logging::Log _log
 
static constexpr int MaxNumberOfStateUpdatesWithoutAnySplit = 65536
 Saturation value of getNumberOfStateUpdatesWithoutAnySplit()
 

Detailed Description

Statistics helper routine for load balancing.

Please note that we assume a SPMD paradigm, i.e. if one rank uses statistics, the other ranks all have to use such an object, too. The individual objects communicate with each other.

The class mirrors peano4::parallel::SpacetreeSet::getGridStatistics(): updateGlobalView() all-reduces the statistics over all ranks, so all ranks hold the same values afterwards. Only the attributes and getters which are explicitly labelled as local are rank-local, even if they have a global counterpart.

The class does not provide any cell counts. Use the grid statistics directly: peano4::parallel::SpacetreeSet::getGridStatistics() yields the global number of cells, and peano4::parallel::SpacetreeSet::getGridStatistics(int) the cells of an individual local tree.

Definition at line 39 of file Statistics.h.

Constructor & Destructor Documentation

◆ Statistics()

toolbox::loadbalancing::Statistics::Statistics ( )

Member Function Documentation

◆ getGlobalNumberOfRanksWithEnabledLoadBalancing()

int toolbox::loadbalancing::Statistics::getGlobalNumberOfRanksWithEnabledLoadBalancing ( ) const

◆ getGlobalNumberOfTrees()

int toolbox::loadbalancing::Statistics::getGlobalNumberOfTrees ( ) const

◆ getLocalNumberOfSplits()

int toolbox::loadbalancing::Statistics::getLocalNumberOfSplits ( ) const

Number of splits this rank has triggered since the last updateGlobalView()

Rank-local. updateGlobalView() takes these splits into account and then resets the counter to zero.

◆ getMaximumTreesPerRank()

int toolbox::loadbalancing::Statistics::getMaximumTreesPerRank ( ) const

◆ getNumberOfStateUpdatesWithoutAnySplit()

int toolbox::loadbalancing::Statistics::getNumberOfStateUpdatesWithoutAnySplit ( ) const

Number of updateGlobalView() calls without any split on any rank.

Counts the calls of updateGlobalView() in a row in which the global number of splits has been zero. As the global number of splits is reduced over all ranks, the counter is the same on all ranks. The counter saturates at MaxNumberOfStateUpdatesWithoutAnySplit. It also starts with this value, as no split has happened before the first update.

◆ incLocalNumberOfSplits()

void toolbox::loadbalancing::Statistics::incLocalNumberOfSplits ( int  delta = 1)

Rank-local: Bookmark that this rank has triggered a split.

◆ notifyOfStateChange()

void toolbox::loadbalancing::Statistics::notifyOfStateChange ( State  state)

Rank-local: Memorise whether the load balancing on this rank is switched on.

◆ toString()

std::string toolbox::loadbalancing::Statistics::toString ( ) const

◆ updateGlobalView()

void toolbox::loadbalancing::Statistics::updateGlobalView ( )

Update the global statistics view on all ranks.

Per contract, this function has to be called by any implementation of toolbox::loadbalancing::AbstractLoadBalancing::finishStep().

The routine all-reduces the number of trees, the number of ranks with enabled load balancing, the number of splits and the maximum number of trees per rank over all ranks through tarch::mpi::Rank::allReduce(). The reduction is blocking, i.e. all ranks hold the same statistics once the routine has terminated. The routine hence has to be called by all ranks at the same time, and only by one thread per rank.

The routine also updates getNumberOfStateUpdatesWithoutAnySplit() and resets the local number of splits to zero.

Field Documentation

◆ _globalNumberOfRanksWithEnabledLoadBalancing

int toolbox::loadbalancing::Statistics::_globalNumberOfRanksWithEnabledLoadBalancing
private

Definition at line 121 of file Statistics.h.

◆ _globalNumberOfSplits

int toolbox::loadbalancing::Statistics::_globalNumberOfSplits
private

Sum of all ranks' local number of splits at the last updateGlobalView()

Definition at line 127 of file Statistics.h.

◆ _globalNumberOfTrees

int toolbox::loadbalancing::Statistics::_globalNumberOfTrees
private

Definition at line 119 of file Statistics.h.

◆ _localLoadBalancingEnabled

bool toolbox::loadbalancing::Statistics::_localLoadBalancingEnabled
private

Rank-local: Is the load balancing on this rank switched on.

Definition at line 111 of file Statistics.h.

◆ _localNumberOfSplits

int toolbox::loadbalancing::Statistics::_localNumberOfSplits
private

Rank-local accumulator where I keep track of how often I did split since the last updateGlobalView().

Definition at line 117 of file Statistics.h.

◆ _log

tarch::logging::Log toolbox::loadbalancing::Statistics::_log
staticprivate

Definition at line 101 of file Statistics.h.

◆ _maximumTreesPerRank

int toolbox::loadbalancing::Statistics::_maximumTreesPerRank
private

Definition at line 131 of file Statistics.h.

◆ _numberOfStateUpdatesWithoutAnySplit

int toolbox::loadbalancing::Statistics::_numberOfStateUpdatesWithoutAnySplit
private

Definition at line 129 of file Statistics.h.

◆ MaxNumberOfStateUpdatesWithoutAnySplit

constexpr int toolbox::loadbalancing::Statistics::MaxNumberOfStateUpdatesWithoutAnySplit = 65536
staticconstexprprivate

Saturation value of getNumberOfStateUpdatesWithoutAnySplit()

Definition at line 106 of file Statistics.h.


The documentation for this class was generated from the following file: