Peano
Loading...
Searching...
No Matches
LoadBalancingConfiguration.cpp
Go to the documentation of this file.
2
3
4#include "tarch/Assertions.h"
6
7
8tarch::logging::Log exahype2::LoadBalancingConfiguration::_log( "exahype2::LoadBalancingConfiguration" );
9
10
12 double loadBalancingQuality,
13 int minSizeOfTree,
14 bool assumePeriodicBoundaryConditions,
15 int maxNumberOfTreesThroughoutInitialDistribution,
16 int maxNumberOfTrees,
18):
19 _loadBalancingQuality(loadBalancingQuality),
20 _minSizeOfTree(minSizeOfTree),
21 _assumePeriodicBoundaryConditions(assumePeriodicBoundaryConditions),
22 _maxNumberOfTreesThroughoutInitialDistribution( maxNumberOfTreesThroughoutInitialDistribution ),
23 _maxNumberOfTrees( maxNumberOfTrees ),
24 _mode( mode ) {
27 or
29 or
32 );
33}
34
35
39
40
42 int result = -1;
43 if (value==UseNumberOfThreads) {
45 } else if (value==UseTwiceTheNumberOfThreads) {
47 } else {
48 assertion(value>0);
49 result = value;
50 }
51
52 assertion(result>=0);
53 return result;
54}
55
56
58 if (
60 or
62 ) {
63 return translateSetMaxNumberOfTreesIntoRealNumberOfTrees(_maxNumberOfTreesThroughoutInitialDistribution);
64 } else {
65 return translateSetMaxNumberOfTreesIntoRealNumberOfTrees(_maxNumberOfTrees);
66 }
67}
68
69
73
74
88
89
91 std::ostringstream msg;
92 msg << "("
93 << "lb-quality=" << _loadBalancingQuality
94 << ",min-size-of-tree=" << _minSizeOfTree
95 << ",max-no-of-trees-throughout-distribution=" << _maxNumberOfTreesThroughoutInitialDistribution
96 << ",max-no-of-trees=" << _maxNumberOfTrees
97 << ")";
98 return msg.str();
99}
100
101
#define assertion2(expr, param0, param1)
#define assertion(expr)
#define ThreePowerD
Definition Globals.h:24
AutomatonState state
virtual bool makeSplitDependOnMemory(toolbox::loadbalancing::State state) override
Use the operating system's memory queries to get the memory out and to veto too many local splits.
virtual int getMinTreeSize(toolbox::loadbalancing::State state) override
If we do the initial distribution in-between ranks, then there should be no such thing as a min tree ...
int translateSetMaxNumberOfTreesIntoRealNumberOfTrees(int value) const
Return how many trees to use if value is picked by user.
virtual std::string toString() const override
virtual int getMaxLocalTreesPerRank(toolbox::loadbalancing::State state) override
Constraint on the number of trees per rank.
virtual peano4::SplitInstruction::Mode getMode(toolbox::loadbalancing::State state) override
virtual double getWorstCaseBalancingRatio(toolbox::loadbalancing::State state) override
Control when to balance between ranks.
LoadBalancingConfiguration(double loadBalancingQuality=0.9, int minSizeOfTree=0, bool assumePeriodicBoundaryConditions=false, int maxNumberOfTreesThroughoutInitialDistribution=UseNumberOfThreads, int maxNumberOfTrees=UseTwiceTheNumberOfThreads, peano4::SplitInstruction::Mode mode=peano4::SplitInstruction::Mode::BottomUp)
Configure load balancing.
Log Device.
Definition Log.h:516
int getNumberOfRanks() const
Definition Rank.cpp:552
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:539
static Core & getInstance()
Definition Core.cpp:56
int getNumberOfThreads() const
Returns the number of threads that is used.
Definition Core.cpp:67
State
State descriptor of load balancing.
Definition State.h:22
@ InterRankDistribution
Code has not yet spread out over all ranks but would like to do so now.
@ IntraRankDistribution
Code has spread over all ranks, but it has not spread over all cores yet, i.e.