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
28public:
34 static constexpr int NoHeaviestTreeAvailable = -1;
35
48
75 AbstractLoadBalancing(Configuration* configuration, CostMetrics* costMetrics);
76
85
86
98 virtual std::string toString() const;
99
100
104 virtual void enable(bool);
105
106
126 virtual bool hasSplitRecently() const;
127
128
136 bool isEnabled(bool globally) const;
137
138
142 virtual int getGlobalNumberOfTrees() const;
143
144
149 virtual bool hasStagnated() const;
150
151
152 virtual void finishSimulation();
153
154
169 virtual void finishStep() = 0;
170
177
178protected:
180
182
184
186
188
198
202 bool fitsIntoMemory(State state) const;
203
204
222
223
239
240
241 bool areRanksUnemployed() const;
242
247
271
272
289 int getIdOfHeaviestLocalSpacetree(double tolerance) const;
290};
291
292std::ostream& operator<<(std::ostream& out, const toolbox::loadbalancing::AbstractLoadBalancing& balancing);
std::ostream & operator<<(std::ostream &out, const toolbox::loadbalancing::AbstractLoadBalancing &balancing)
Log Device.
Definition Log.h:517
Abstract superclass of any load balancing.
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.
bool isEnabled(bool globally) const
Is load balancing enabled.
bool isIntraRankBalancingBad() const
Is the balancing on the rank ok.
bool fitsIntoMemory(State state) const
Ensure enough memory is left-over.
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.
static constexpr int NumberOfMeshSweepsAfterSplitToMakeMeshConsistentAgain
Number of mesh sweeps a split needs until the mesh is consistent again.
void setConfigurationAndMetricsNullWithoutDelete()
This is only used when you concatenate balancing rules and you want to disable any deletion.
virtual bool hasStagnated() const
A load balancing can either be stagnating or be switched off for this predicate to hold.
virtual int getGlobalNumberOfTrees() const
Delegate to stats.
virtual bool hasSplitRecently() const
Has mesh split recently.
virtual std::string toString() const
Create a string representation of load balancing object.
virtual void enable(bool)
Switch on/off.
int getIdOfHeaviestLocalSpacetree(double tolerance) const
Similar to getIdOfHeaviestLocalSpacetree() but you might get one of the trees back that is close to t...
Abstract interface to tweak the behaviour of the recursive subdivision.
Statistics helper routine for load balancing.
Definition Statistics.h:39
State
State descriptor of load balancing.
Definition State.h:22