Peano
Loading...
Searching...
No Matches
exahype2::LoadBalancingConfiguration Class Reference

ExaHyPE 2-specific load balancing configuration. More...

#include <LoadBalancingConfiguration.h>

Inheritance diagram for exahype2::LoadBalancingConfiguration:
Collaboration diagram for exahype2::LoadBalancingConfiguration:

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
 

Detailed Description

ExaHyPE 2-specific load balancing configuration.

Definition at line 19 of file LoadBalancingConfiguration.h.

Constructor & Destructor Documentation

◆ LoadBalancingConfiguration()

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.

Parameters
minSizeOfTreeIf 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.

Parameters
maxNumberOfTreesThroughoutInitialDistributionSet 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.
maxNumberOfTreesThis 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.

◆ ~LoadBalancingConfiguration()

virtual exahype2::LoadBalancingConfiguration::~LoadBalancingConfiguration ( )
virtualdefault

Member Function Documentation

◆ getMaxLocalTreesPerRank()

int exahype2::LoadBalancingConfiguration::getMaxLocalTreesPerRank ( toolbox::loadbalancing::State state)
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.

◆ getMinTreeSize()

int exahype2::LoadBalancingConfiguration::getMinTreeSize ( toolbox::loadbalancing::State 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.

Here is the call graph for this function:

◆ getMode()

peano4::SplitInstruction::Mode exahype2::LoadBalancingConfiguration::getMode ( toolbox::loadbalancing::State state)
overridevirtual

◆ getWorstCaseBalancingRatio()

double exahype2::LoadBalancingConfiguration::getWorstCaseBalancingRatio ( toolbox::loadbalancing::State state)
overridevirtual

Control when to balance between ranks.

Implements toolbox::loadbalancing::Configuration.

Definition at line 70 of file LoadBalancingConfiguration.cpp.

◆ makeSplitDependOnMemory()

bool exahype2::LoadBalancingConfiguration::makeSplitDependOnMemory ( toolbox::loadbalancing::State state)
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.

◆ toString()

std::string exahype2::LoadBalancingConfiguration::toString ( ) const
overridevirtual

Reimplemented from toolbox::loadbalancing::Configuration.

Definition at line 90 of file LoadBalancingConfiguration.cpp.

◆ translateSetMaxNumberOfTreesIntoRealNumberOfTrees()

int exahype2::LoadBalancingConfiguration::translateSetMaxNumberOfTreesIntoRealNumberOfTrees ( int value) const
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().

Here is the call graph for this function:

Field Documentation

◆ _assumePeriodicBoundaryConditions

const bool exahype2::LoadBalancingConfiguration::_assumePeriodicBoundaryConditions
private

Definition at line 25 of file LoadBalancingConfiguration.h.

◆ _loadBalancingQuality

const double exahype2::LoadBalancingConfiguration::_loadBalancingQuality
private

Definition at line 23 of file LoadBalancingConfiguration.h.

◆ _log

tarch::logging::Log exahype2::LoadBalancingConfiguration::_log
staticprivate

Definition at line 21 of file LoadBalancingConfiguration.h.

◆ _maxNumberOfTrees

const int exahype2::LoadBalancingConfiguration::_maxNumberOfTrees
private

Definition at line 27 of file LoadBalancingConfiguration.h.

Referenced by LoadBalancingConfiguration().

◆ _maxNumberOfTreesThroughoutInitialDistribution

const int exahype2::LoadBalancingConfiguration::_maxNumberOfTreesThroughoutInitialDistribution
private

Definition at line 26 of file LoadBalancingConfiguration.h.

Referenced by LoadBalancingConfiguration().

◆ _minSizeOfTree

const int exahype2::LoadBalancingConfiguration::_minSizeOfTree
private

Definition at line 24 of file LoadBalancingConfiguration.h.

◆ _mode

const peano4::SplitInstruction::Mode exahype2::LoadBalancingConfiguration::_mode
private

◆ UseNumberOfThreads

constexpr int exahype2::LoadBalancingConfiguration::UseNumberOfThreads = -1
staticconstexpr

Definition at line 43 of file LoadBalancingConfiguration.h.

◆ UseTwiceTheNumberOfThreads

constexpr int exahype2::LoadBalancingConfiguration::UseTwiceTheNumberOfThreads = -2
staticconstexpr

Definition at line 44 of file LoadBalancingConfiguration.h.


The documentation for this class was generated from the following files: