Peano
Loading...
Searching...
No Matches
AbstractLoadBalancing.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5
6#include <map>
7
8#include "Blacklist.h"
9#include "Configuration.h"
10#include "CostMetrics.h"
11#include "Statistics.h"
13#include "tarch/logging/Log.h"
14#include "tarch/mpi/mpi.h"
15
16
17namespace toolbox {
18 namespace loadbalancing {
20 } // namespace loadbalancing
21} // namespace toolbox
22
23
25public:
31 static constexpr int NoHeaviestTreeAvailable = -1;
32
59 AbstractLoadBalancing(Configuration* configuration, CostMetrics* costMetrics);
60
68 virtual ~AbstractLoadBalancing();
69
70
75 virtual std::string toString() const;
76
77
81 virtual void enable(bool);
82
83
84 virtual bool hasSplitRecently() const;
85
86
92 bool isEnabled(bool globally) const;
93
94
98 virtual int getGlobalNumberOfTrees() const;
99
100
105 virtual bool hasStagnated() const;
106
107
108 virtual void finishSimulation();
109
110
121 virtual void finishStep() = 0;
122
129
130protected:
132
134
136
138
140
150
154 bool fitsIntoMemory(State state) const;
155
156
173 bool isInterRankBalancingBad() const;
174
175
190 bool isIntraRankBalancingBad() const;
191
192
193 bool areRanksUnemployed() const;
194
199
226
227
243 int getIdOfHeaviestLocalSpacetree(double tolerance) const;
244};
245
246std::ostream& operator<<(std::ostream& out, const toolbox::loadbalancing::AbstractLoadBalancing& balancing);
std::ostream & operator<<(std::ostream &out, const toolbox::loadbalancing::AbstractLoadBalancing &balancing)
AutomatonState state
Log Device.
Definition Log.h:516
virtual void finishStep()=0
Finish the step.
static constexpr int NoHeaviestTreeAvailable
Is used by tree identification and either indicates that there are no trees at all or means that the ...
AbstractLoadBalancing(Configuration *configuration, CostMetrics *costMetrics)
Constructor.
virtual std::string toString() const
Generic string serialisation.
bool isEnabled(bool globally) const
Clarifies whether load balancing is, in principle, enabled.
virtual bool hasStagnated() const
A load balancing can either be stagnating or be switched off for this predicate to hold.
bool isIntraRankBalancingBad() const
Is the balancing on the rank ok.
bool fitsIntoMemory(State state) const
Ensure enough memory is left-over.
virtual int getGlobalNumberOfTrees() const
Delegate to stats.
int getIdOfHeaviestLocalSpacetree() const
Determines the maximum spacetree size a tree should have in the optimal case.
bool isInterRankBalancingBad() const
Is the balancing between the ranks ok.
void setConfigurationAndMetricsNullWithoutDelete()
This is only used when you concatenate balancing rules and you want to disable any deletion.
Abstract interface to tweak the behaviour of the recursive subdivision.
Statistics helper routine for load balancing.
Definition Statistics.h:30
State
State descriptor of load balancing.
Definition State.h:22