Peano
|
ExaHyPE 2-specific load balancing configuration. More...
#include <LoadBalancingConfiguration.h>
Public Member Functions | |
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. | |
virtual | ~LoadBalancingConfiguration ()=default |
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 | getMaxLocalTreesPerRank (toolbox::loadbalancing::State state) override |
Constraint on the number of trees per rank. | |
virtual double | getWorstCaseBalancingRatio (toolbox::loadbalancing::State state) override |
Control when to balance between ranks. | |
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 size. | |
virtual std::string | toString () const override |
virtual peano4::SplitInstruction::Mode | getMode (toolbox::loadbalancing::State state) override |
Public Member Functions inherited from toolbox::loadbalancing::Configuration | |
virtual | ~Configuration ()=default |
Static Public Attributes | |
static constexpr int | UseNumberOfThreads = -1 |
static constexpr int | UseTwiceTheNumberOfThreads = -2 |
Private Member Functions | |
int | translateSetMaxNumberOfTreesIntoRealNumberOfTrees (int value) const |
Return how many trees to use if value is picked by user. | |
Private Attributes | |
const double | _loadBalancingQuality |
const int | _minSizeOfTree |
const bool | _assumePeriodicBoundaryConditions |
const int | _maxNumberOfTreesThroughoutInitialDistribution |
const int | _maxNumberOfTrees |
const peano4::SplitInstruction::Mode | _mode |
Static Private Attributes | |
static tarch::logging::Log | _log |
ExaHyPE 2-specific load balancing configuration.
Definition at line 19 of file LoadBalancingConfiguration.h.
exahype2::LoadBalancingConfiguration::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.
minSizeOfTree | If a partition (tree) is smaller than the given number of cells, we do not split it up further. If you set this argument to 0, you effectively set no threshold - Peano will try to split any tree if it thinks it would improve the load balancing. |
This value is not taken into account for the initial distribution. Here, you have to use maxNumberOfTreesThroughoutInitialDistribution to constrain over-ambitious domain splitting.
maxNumberOfTreesThroughoutInitialDistribution | Set the maximum number of trees (per rank) that we use when we split up the domain no a rank for the first time. By default, I try to give each thread per rank exactly one subpartition to work on. You might want to reduce this value. |
maxNumberOfTrees | This value is used after the initial decomposition. If you pick it higher than maxNumberOfTreesThroughoutInitialDistribution, then you give the load balancing the opportunity to split up the domain further even if all threads have already one subpartition. I recommend to to pick it higher than maxNumberOfTreesThroughoutInitialDistribution, as the load balancer kicks in throughout the grid construction. By the time is uses maxNumberOfTreesThroughoutInitialDistribution threads, local adaptivity might not yet be established, i.e. subsequent grid refinements will yield imbalances that only further splits can compensate. |
Definition at line 11 of file LoadBalancingConfiguration.cpp.
References _maxNumberOfTrees, _maxNumberOfTreesThroughoutInitialDistribution, and assertion2.
|
virtualdefault |
|
overridevirtual |
Constraint on the number of trees per rank.
The number is always constrained by peano4::parallel::Node::MaxSpacetreesPerRank, but you can cut it down further.
You can use an arbitary large value if you don't care bout a maximum number of subpartitions per rank. I however do recommend that you return peano4::parallel::Node::MaxSpacetreesPerRank.
Implements toolbox::loadbalancing::Configuration.
Definition at line 57 of file LoadBalancingConfiguration.cpp.
References toolbox::loadbalancing::InterRankDistribution, toolbox::loadbalancing::IntraRankDistribution, and state.
|
overridevirtual |
If we do the initial distribution in-between ranks, then there should be no such thing as a min tree size.
Implements toolbox::loadbalancing::Configuration.
Definition at line 75 of file LoadBalancingConfiguration.cpp.
References tarch::mpi::Rank::getInstance(), tarch::mpi::Rank::getNumberOfRanks(), toolbox::loadbalancing::InterRankDistribution, toolbox::loadbalancing::IntraRankDistribution, state, and ThreePowerD.
|
overridevirtual |
Implements toolbox::loadbalancing::Configuration.
Definition at line 102 of file LoadBalancingConfiguration.cpp.
|
overridevirtual |
Control when to balance between ranks.
Implements toolbox::loadbalancing::Configuration.
Definition at line 70 of file LoadBalancingConfiguration.cpp.
|
overridevirtual |
Use the operating system's memory queries to get the memory out and to veto too many local splits.
Each split creates some overhead, so it can happen that we run out of memory.
Implements toolbox::loadbalancing::Configuration.
Definition at line 36 of file LoadBalancingConfiguration.cpp.
|
overridevirtual |
Reimplemented from toolbox::loadbalancing::Configuration.
Definition at line 90 of file LoadBalancingConfiguration.cpp.
|
private |
Return how many trees to use if value is picked by user.
If the users sets a real number >0 for the upper number of trees, then we pick this value. However, if the users picks a magic constant, then we have to read out the real system configuration and translate it into a real number, i.e. if the user has picked UseNumberOfThreads for example, then we have to ask the core how many threads we really have and return that value.
Definition at line 41 of file LoadBalancingConfiguration.cpp.
References assertion, tarch::multicore::Core::getInstance(), and tarch::multicore::Core::getNumberOfThreads().
|
private |
Definition at line 25 of file LoadBalancingConfiguration.h.
|
private |
Definition at line 23 of file LoadBalancingConfiguration.h.
|
staticprivate |
Definition at line 21 of file LoadBalancingConfiguration.h.
|
private |
Definition at line 27 of file LoadBalancingConfiguration.h.
Referenced by LoadBalancingConfiguration().
|
private |
Definition at line 26 of file LoadBalancingConfiguration.h.
Referenced by LoadBalancingConfiguration().
|
private |
Definition at line 24 of file LoadBalancingConfiguration.h.
|
private |
Definition at line 28 of file LoadBalancingConfiguration.h.
Referenced by peano4.toolbox.particles.postprocessing.ParticleVTUReader.ParticleVTUReader::load().
|
staticconstexpr |
Definition at line 43 of file LoadBalancingConfiguration.h.
|
staticconstexpr |
Definition at line 44 of file LoadBalancingConfiguration.h.