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
69
70
82 virtual std::string toString() const;
83
84
88 virtual void enable(bool);
89
90
104 virtual bool hasSplitRecently() const;
105
106
114 bool isEnabled(bool globally) const;
115
116
120 virtual int getGlobalNumberOfTrees() const;
121
122
127 virtual bool hasStagnated() const;
128
129
130 virtual void finishSimulation();
131
132
143 virtual void finishStep() = 0;
144
151
152protected:
154
156
158
160
162
172
176 bool fitsIntoMemory(State state) const;
177
178
196
197
213
214
215 bool areRanksUnemployed() const;
216
221
248
249
265 int getIdOfHeaviestLocalSpacetree(double tolerance) const;
266};
267
268std::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: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.
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.
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:30
State
State descriptor of load balancing.
Definition State.h:22