|
Peano
|
Statistics helper routine for load balancing. More...
#include <Statistics.h>

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() | |
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.
| toolbox::loadbalancing::Statistics::Statistics | ( | ) |
| int toolbox::loadbalancing::Statistics::getGlobalNumberOfRanksWithEnabledLoadBalancing | ( | ) | const |
| int toolbox::loadbalancing::Statistics::getGlobalNumberOfTrees | ( | ) | const |
| 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.
| int toolbox::loadbalancing::Statistics::getMaximumTreesPerRank | ( | ) | const |
| 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.
| void toolbox::loadbalancing::Statistics::incLocalNumberOfSplits | ( | int | delta = 1 | ) |
Rank-local: Bookmark that this rank has triggered a split.
| void toolbox::loadbalancing::Statistics::notifyOfStateChange | ( | State | state | ) |
Rank-local: Memorise whether the load balancing on this rank is switched on.
| std::string toolbox::loadbalancing::Statistics::toString | ( | ) | const |
| 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.
|
private |
Definition at line 121 of file Statistics.h.
|
private |
Sum of all ranks' local number of splits at the last updateGlobalView()
Definition at line 127 of file Statistics.h.
|
private |
Definition at line 119 of file Statistics.h.
|
private |
Rank-local: Is the load balancing on this rank switched on.
Definition at line 111 of file Statistics.h.
|
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.
|
staticprivate |
Definition at line 101 of file Statistics.h.
|
private |
Definition at line 131 of file Statistics.h.
|
private |
Definition at line 129 of file Statistics.h.
|
staticconstexprprivate |
Saturation value of getNumberOfStateUpdatesWithoutAnySplit()
Definition at line 106 of file Statistics.h.