Class that implements the two heuristics to determine when a re-balance of the distribution is needed.
Used heuristics are: SAR and Un-balance Threshold (Default)
To chose the heuristic use the method setHeuristic(Heuristic)
In the SAR heuristic the following formula is applied:
\(W_{n} = \frac{\sum_{j=1}^{n} (T_{max}(j) - T_{avg}(j)) + C} {n}\)
\(T_{max}(j)\) – wall-clock time of bottleneck process in time step j
\(T_{avg}(j)\) – average wall-clock time for time step j over all processes
\(C\) – cost of re-decomposing the problem
\(n\) – number of time steps since last re-decomposition
For small n, load balance is good and W decreases since C is amortized over an increasing number of time steps. As the accumulated idle time starts to dominate, W starts to rise. At this point, C has been fully amortized. Re-decompose when \(W_{n} > W_{n-1}\)
In the Un-balance Threshold heuristic the re-balance is triggered when the un-balance level exceeds a certain level. Levels can be chosen in the ThresholdLevel type.
#include <DLB.hpp>
Public Types | |
enum | Heuristic { SAR_HEURISTIC , UNBALANCE_THRLD } |
Type of DLB heuristics. More... | |
enum | ThresholdLevel { THRLD_LOW = 5 , THRLD_MEDIUM = 7 , THRLD_HIGH = 10 } |
Level of un-balance needed to trigger the re-balance. More... | |
Public Member Functions | |
DLB (Vcluster<> &v_cl) | |
Constructor for DLB class. | |
void | setHeurisitc (Heuristic h) |
Set the heuristic to use (default: un-balance threshold) | |
Heuristic | getHeurisitc () |
Get the heuristic. | |
bool | rebalanceNeeded () |
check if a re-balance is needed using the selected heuristic | |
void | setSimulationStartTime (size_t t) |
Set start time for the simulation. | |
size_t | getSimulationStartTime () |
Get start time for the simulation. | |
void | setSimulationEndTime (size_t t) |
Set end time for the simulation. | |
size_t | getSimulationEndTime () |
Get end time for the simulation. | |
void | startIteration () |
Set start time for the single iteration. | |
void | startIteration (size_t t) |
Set start time for the single iteration. | |
void | endIteration () |
Set end time for the single iteration. | |
void | endIteration (size_t t) |
Set the end time when the previous rebalance has been performed. | |
void | setTimeStep (double t) |
Set delta time step for one iteration (Computation time) | |
void | setComputationCost (size_t computation) |
Set time step for the single iteration. | |
size_t | getNTimeStepSinceDLB () |
Get how many time-steps have passed since the last re-balancing. | |
void | setUnbalance (float u) |
Set un-balance value. | |
void | setThresholdLevel (ThresholdLevel t) |
threshold of umbalance to start a rebalance | |
Private Member Functions | |
bool | SAR () |
Function that gather times informations and decides if a rebalance is needed it uses the SAR heuristic. | |
bool | unbalanceThreshold () |
Check if the un-balance has exceeded the threshold. | |
Private Attributes | |
Vcluster & | v_cl |
Runtime virtual cluster machine. | |
Times | timeInfo |
Structure that will contain all the timings. | |
float | w_n = -1 |
Wn for SAR heuristic. | |
float | c_c = 5 |
Computation cost for SAR heuristic. | |
size_t | n_ts = 1 |
Number of time-steps since the previous DLB. | |
float | i_time = 0 |
Idle time accumulated so far, needed for SAR heuristic. | |
openfpm::vector< long > | times |
Vector to collect all timings. | |
Heuristic | heuristic = UNBALANCE_THRLD |
Type of the heuristic to use. | |
float | unbalance = -1 |
Un-balance value. | |
ThresholdLevel | thl = THRLD_MEDIUM |
Threshold value. | |
enum DLB::Heuristic |
enum DLB::ThresholdLevel |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |