|
Peano
|
Hardcoded domain decomposition strategy. More...
#include <Hardcoded.h>


Data Structures | |
| struct | Split |
Public Member Functions | |
| Hardcoded (std::initializer_list< int > gridSweeps, std::initializer_list< int > splittingTrees, std::initializer_list< int > numberOfCells, std::initializer_list< int > destinationRanks, std::initializer_list< peano4::SplitInstruction::Mode > modes) | |
| Construct hard-coded load balancing strategy. | |
| Hardcoded (std::initializer_list< int > gridSweeps, std::initializer_list< int > splittingTrees, std::initializer_list< int > numberOfCells, std::initializer_list< int > destinationRanks, peano4::SplitInstruction::Mode mode=peano4::SplitInstruction::Mode::BottomUp) | |
| Shortcut around other constructor. | |
| virtual void | finishStep () override |
| Finish the step. | |
| virtual void | finishSimulation () override |
| Public Member Functions inherited from toolbox::loadbalancing::AbstractLoadBalancing | |
| AbstractLoadBalancing (Configuration *configuration, CostMetrics *costMetrics) | |
| Constructor. | |
| virtual | ~AbstractLoadBalancing () |
| Destructor. | |
| virtual std::string | toString () const |
| Generic string serialisation. | |
| virtual void | enable (bool) |
| Switch on/off. | |
| virtual bool | hasSplitRecently () const |
| bool | isEnabled (bool globally) const |
| Clarifies whether load balancing is, in principle, enabled. | |
| virtual int | getGlobalNumberOfTrees () const |
| Delegate to stats. | |
| virtual bool | hasStagnated () const |
| A load balancing can either be stagnating or be switched off for this predicate to hold. | |
| void | setConfigurationAndMetricsNullWithoutDelete () |
| This is only used when you concatenate balancing rules and you want to disable any deletion. | |
Private Attributes | |
| std::queue< Split > | _splits |
| int | _currentGridSweep |
| Grid sweep represents the iteration number or finishStep() call count. | |
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. | |
| 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 |
Hardcoded domain decomposition strategy.
Hardcoded load balancing is useful if you know exactly which domain decomposition you want to build up at which time, or if you have to debug a particular (deterministic) setup. It also comes in handy whenever you can transform your dynamic load balancing challenge into an offline problem. The loadbalancing's Python API contains all the tools to derive good balancing strategies for offline problems.
Please consult the constructor Hardcoded::Hardcoded() for details on how to pipe a certain load balancing setup into the load balancing decision.
I originally thought it would be nice to have support for hard-coded load-balancing being encoded in a file. However, this contradicts Peano's philosophy that everything should be in the Python script. Therefore, this strategy does not support file I/O but the load balancing's Python interface does.
There's also a hardcoded orchestration strategy in tarch::multicore::orchestration::Hardcoded. This is a totally different notion of being hardcoded: There's the decision-making is hardcoded whereas here the actual decisions are. In this sense, the present name might be chosen inappropriately.
Definition at line 54 of file Hardcoded.h.
| toolbox::loadbalancing::strategies::Hardcoded::Hardcoded | ( | std::initializer_list< int > | gridSweeps, |
| std::initializer_list< int > | splittingTrees, | ||
| std::initializer_list< int > | numberOfCells, | ||
| std::initializer_list< int > | destinationRanks, | ||
| std::initializer_list< peano4::SplitInstruction::Mode > | modes ) |
Construct hard-coded load balancing strategy.
The splits that are to be triggered are passed here as three initialiser lists. So if you pass
then tree 2 will split in the grid sweeps 4, 5 and 8. It will try to deploy 11, 12 or 13 cells to the ranks 22, 23 or 24, respectively.
We do not work with initialiser lists internally. Instead, the constructor takes the list and transforms it into a sequence of Split objects which are then held internally.
I originally wanted the constructor to dumb some info on what type of load balancing exactly had been constructed. However, some codes use the load balancing object as static variable, so it might come up before the logging infrastructure is properly configured. This means that the logInfo will crash. So better stay silent and avoid logInfo() calls here.
Definition at line 15 of file Hardcoded.cpp.
References _currentGridSweep, _splits, toolbox::loadbalancing::AbstractLoadBalancing::AbstractLoadBalancing(), and assertionEquals4.

| toolbox::loadbalancing::strategies::Hardcoded::Hardcoded | ( | std::initializer_list< int > | gridSweeps, |
| std::initializer_list< int > | splittingTrees, | ||
| std::initializer_list< int > | numberOfCells, | ||
| std::initializer_list< int > | destinationRanks, | ||
| peano4::SplitInstruction::Mode | mode = peano4::SplitInstruction::Mode::BottomUp ) |
Shortcut around other constructor.
In this variant, all split modes are of the same type and there's a default.
Definition at line 46 of file Hardcoded.cpp.
References _currentGridSweep, _splits, toolbox::loadbalancing::AbstractLoadBalancing::AbstractLoadBalancing(), and assertionEquals4.

|
overridevirtual |
Reimplemented from toolbox::loadbalancing::AbstractLoadBalancing.
Definition at line 141 of file Hardcoded.cpp.
|
overridevirtual |
Finish the step.
No matter what you do here, you have to invoke
_statistics.updateGlobalView();
_blacklist.update();
in this routine.
Implements toolbox::loadbalancing::AbstractLoadBalancing.
Definition at line 97 of file Hardcoded.cpp.
References _currentGridSweep, _splits, toolbox::loadbalancing::AbstractLoadBalancing::_state, toolbox::loadbalancing::strategies::Hardcoded::Split::destinationRank, toolbox::loadbalancing::dumpStatistics(), peano4::parallel::SpacetreeSet::getInstance(), logError, logWarning, toolbox::loadbalancing::strategies::Hardcoded::Split::numberOfCells, toolbox::loadbalancing::strategies::Hardcoded::Split::splittingTree, and toolbox::loadbalancing::SwitchedOff.

|
private |
Grid sweep represents the iteration number or finishStep() call count.
This better reflects that splits occur during specific grid traversals rather than at specific points in time.
Definition at line 129 of file Hardcoded.h.
Referenced by finishStep(), Hardcoded(), and Hardcoded().
|
staticprivate |
Definition at line 110 of file Hardcoded.h.
|
private |
Definition at line 122 of file Hardcoded.h.
Referenced by finishStep(), Hardcoded(), and Hardcoded().