Peano
Loading...
Searching...
No Matches
toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 > Class Template Reference

Cascade of load balancing schemes. More...

#include <Cascade.h>

Inheritance diagram for toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >:
Collaboration diagram for toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >:

Public Member Functions

 Cascade (Configuration *configuration=new DefaultConfiguration(), CostMetrics *costMetrics=new toolbox::loadbalancing::metrics::CellCount())
virtual ~Cascade ()
 We have piped through any pointers to a configuration and the cost metrics.
virtual void finishStep () override
 Inform the active aggregate about finishStep() and then check afterwards if the active load balancing has stagnated.
virtual bool hasSplitRecently () const override
 Has mesh split recently.
virtual int getGlobalNumberOfTrees () const override
 Delegate to stats.
virtual bool hasStagnated () const override
 A load balancing can either be stagnating or be switched off for this predicate to hold.
virtual void finishSimulation () override
virtual void enable (bool value) override
 Switch on/off.
Public Member Functions inherited from toolbox::loadbalancing::AbstractLoadBalancing
 AbstractLoadBalancing (Configuration *configuration, CostMetrics *costMetrics)
 Constructor.
virtual ~AbstractLoadBalancing ()
 Destructor.
virtual std::string toString () const
 Create a string representation of load balancing object.
bool isEnabled (bool globally) const
 Is load balancing enabled.
void setConfigurationAndMetricsNullWithoutDelete ()
 This is only used when you concatenate balancing rules and you want to disable any deletion.

Private Attributes

HostedLoadBalancing0 _hostedLoadBalancing0
HostedLoadBalancing1 _hostedLoadBalancing1
int _activeLoadBalancing
 Pick the active load balancing.

Static Private Attributes

static tarch::logging::Log _log

Additional Inherited Members

Static Public Attributes inherited from toolbox::loadbalancing::AbstractLoadBalancing
static constexpr int NoHeaviestTreeAvailable = -1
 Is used by tree identification and either indicates that there are no trees at all or means that the heaviest tree is on the blacklist.
static constexpr int NumberOfMeshSweepsAfterSplitToMakeMeshConsistentAgain = 3
 Number of mesh sweeps a split needs until the mesh is consistent again.
Protected Member Functions inherited from toolbox::loadbalancing::AbstractLoadBalancing
bool fitsIntoMemory (State state) const
 Ensure enough memory is left-over.
bool isInterRankBalancingBad () const
 Is the balancing between the ranks ok.
bool isIntraRankBalancingBad () const
 Is the balancing on the rank ok.
bool areRanksUnemployed () const
double getWeightOfHeaviestLocalSpacetree () const
int getIdOfHeaviestLocalSpacetree () const
 Determines the maximum spacetree size a tree should have in the optimal case.
int getIdOfHeaviestLocalSpacetree (double tolerance) const
 Similar to getIdOfHeaviestLocalSpacetree() but you might get one of the trees back that is close to the heaviest one up to tolerance.
Protected Attributes inherited from toolbox::loadbalancing::AbstractLoadBalancing
Blacklist _blacklist
Statistics _statistics
Configuration * _configuration
CostMetrics * _costMetrics
State _state
 Ensure that you invoke.
Static Protected Attributes inherited from toolbox::loadbalancing::AbstractLoadBalancing
static tarch::logging::Log _log

Detailed Description

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
class toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >

Cascade of load balancing schemes.

We run through a series of load balancing schemes. If one is stagnating or switching off, we switch to the next one.

I tried to play around with variadic templates, but that did not work for multiple reasons, so I went down the manual way.

Definition at line 31 of file Cascade.h.

Constructor & Destructor Documentation

◆ Cascade()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::Cascade ( Configuration * configuration = new DefaultConfiguration(),
CostMetrics * costMetrics = new toolbox::loadbalancing::metrics::CellCount() )

Definition at line 33 of file Cascade.h.

◆ ~Cascade()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
virtual toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::~Cascade ( )
virtual

We have piped through any pointers to a configuration and the cost metrics.

Now we set these pointers manually to nullptr, so no piped through attribute is actually deleted. Instead, we trust on the current class' supertype to actually destroy object.

Definition at line 50 of file Cascade.h.

Member Function Documentation

◆ enable()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
virtual void toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::enable ( bool )
overridevirtual

Switch on/off.

Reimplemented from toolbox::loadbalancing::AbstractLoadBalancing.

Definition at line 137 of file Cascade.h.

◆ finishSimulation()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
virtual void toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::finishSimulation ( )
overridevirtual

Reimplemented from toolbox::loadbalancing::AbstractLoadBalancing.

Definition at line 122 of file Cascade.h.

◆ finishStep()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
virtual void toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::finishStep ( )
overridevirtual

Inform the active aggregate about finishStep() and then check afterwards if the active load balancing has stagnated.

If so, switch to the next one in the cascade.

Implements toolbox::loadbalancing::AbstractLoadBalancing.

Definition at line 61 of file Cascade.h.

◆ getGlobalNumberOfTrees()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
virtual int toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::getGlobalNumberOfTrees ( ) const
overridevirtual

Delegate to stats.

Reimplemented from toolbox::loadbalancing::AbstractLoadBalancing.

Definition at line 98 of file Cascade.h.

◆ hasSplitRecently()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
virtual bool toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::hasSplitRecently ( ) const
overridevirtual

Has mesh split recently.

Means that mesh has split over the past NumberOfMeshSweepsAfterSplitToMakeMeshConsistentAgain iterations, i.e. the iterations a proper split needs until the mesh is consistent again.

If we have then not come to the conclusion that we should immediately split again, then we haven't split recently.

Splits which this rank has triggered since the last state update count, too. Most strategies trigger their splits in finishStep() after they have updated their statistics. Without this check, the predicate would hence not hold right after a strategy has triggered a split, but only once the subsequent finishStep() has updated the statistics. Code which decides right after finishStep() whether to run another grid sweep, such as the repeat condition of a mesh construction, would then stop before the split has been carried out.

Reimplemented from toolbox::loadbalancing::AbstractLoadBalancing.

Definition at line 84 of file Cascade.h.

◆ hasStagnated()

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
virtual bool toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::hasStagnated ( ) const
overridevirtual

A load balancing can either be stagnating or be switched off for this predicate to hold.

Reimplemented from toolbox::loadbalancing::AbstractLoadBalancing.

Definition at line 112 of file Cascade.h.

Field Documentation

◆ _activeLoadBalancing

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
int toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::_activeLoadBalancing
private

Pick the active load balancing.

Definition at line 158 of file Cascade.h.

◆ _hostedLoadBalancing0

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
HostedLoadBalancing0 toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::_hostedLoadBalancing0
private

Definition at line 152 of file Cascade.h.

◆ _hostedLoadBalancing1

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
HostedLoadBalancing1 toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::_hostedLoadBalancing1
private

Definition at line 153 of file Cascade.h.

◆ _log

template<typename HostedLoadBalancing0, typename HostedLoadBalancing1>
tarch::logging::Log toolbox::loadbalancing::strategies::cascade::Cascade< HostedLoadBalancing0, HostedLoadBalancing1 >::_log
staticprivate

Definition at line 150 of file Cascade.h.


The documentation for this class was generated from the following file:
  • src/toolbox/loadbalancing/strategies/cascade/Cascade.h