OpenFPM_pdata  4.1.0 Project that contain the implementation of distributed structures
DLB Class Reference

## Detailed Description

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.

Definition at line 53 of file DLB.hpp.

#include <DLB.hpp>

## Public Types

enum  Heuristic { SAR_HEURISTIC, UNBALANCE_THRLD }
Type of DLB heuristics.

enum  ThresholdLevel { THRLD_LOW = 5, THRLD_MEDIUM = 7, THRLD_HIGH = 10 }
Level of un-balance needed to trigger the re-balance.

## Public Member Functions

DLB (Vcluster<> &v_cl)
Constructor for DLB class. More...

void setHeurisitc (Heuristic h)
Set the heuristic to use (default: un-balance threshold) More...

Heuristic getHeurisitc ()
Get the heuristic. More...

bool rebalanceNeeded ()
check if a re-balance is needed using the selected heuristic More...

void setSimulationStartTime (size_t t)
Set start time for the simulation. More...

size_t getSimulationStartTime ()
Get start time for the simulation. More...

void setSimulationEndTime (size_t t)
Set end time for the simulation. More...

size_t getSimulationEndTime ()
Get end time for the simulation. More...

void startIteration ()
Set start time for the single iteration. More...

void startIteration (size_t t)
Set start time for the single iteration. More...

void endIteration ()
Set end time for the single iteration. More...

void endIteration (size_t t)
Set the end time when the previous rebalance has been performed. More...

void setTimeStep (double t)
Set delta time step for one iteration (Computation time) More...

void setComputationCost (size_t computation)
Set time step for the single iteration. More...

size_t getNTimeStepSinceDLB ()
Get how many time-steps have passed since the last re-balancing. More...

void setUnbalance (float u)
Set un-balance value. More...

void setThresholdLevel (ThresholdLevel t)
threshold of umbalance to start a rebalance More...

## Private Member Functions

bool SAR ()
Function that gather times informations and decides if a rebalance is needed it uses the SAR heuristic. More...

bool unbalanceThreshold ()
Check if the un-balance has exceeded the threshold. More...

## Private Attributes

Vclusterv_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.

## ◆ DLB()

 DLB::DLB ( Vcluster<> & v_cl )
inline

Constructor for DLB class.

Parameters
 v_cl virtual cluster object

Definition at line 168 of file DLB.hpp.

## ◆ endIteration() [1/2]

 void DLB::endIteration ( )
inline

Set end time for the single iteration.

Parameters
 time when one iteration is completed

Definition at line 272 of file DLB.hpp.

## ◆ endIteration() [2/2]

 void DLB::endIteration ( size_t t )
inline

Set the end time when the previous rebalance has been performed.

Parameters
 t time when one iteration ends

Definition at line 281 of file DLB.hpp.

## ◆ getHeurisitc()

 Heuristic DLB::getHeurisitc ( )
inline

Get the heuristic.

Indicate which heuristic model is used to calculate when a rebalance is needed

Returns
the Heuristic used by DLB

Definition at line 190 of file DLB.hpp.

## ◆ getNTimeStepSinceDLB()

 size_t DLB::getNTimeStepSinceDLB ( )
inline

Get how many time-steps have passed since the last re-balancing.

Returns
number of timesteos

Definition at line 309 of file DLB.hpp.

## ◆ getSimulationEndTime()

 size_t DLB::getSimulationEndTime ( )
inline

Get end time for the simulation.

Returns
the end time of the simulation

Definition at line 245 of file DLB.hpp.

## ◆ getSimulationStartTime()

 size_t DLB::getSimulationStartTime ( )
inline

Get start time for the simulation.

Returns
the start point of the simulation

Definition at line 226 of file DLB.hpp.

## ◆ rebalanceNeeded()

 bool DLB::rebalanceNeeded ( )
inline

check if a re-balance is needed using the selected heuristic

Returns
true if the rebalance is needed

Definition at line 200 of file DLB.hpp.

## ◆ SAR()

 bool DLB::SAR ( )
inlineprivate

Function that gather times informations and decides if a rebalance is needed it uses the SAR heuristic.

Returns
true if re-balance is needed

Definition at line 106 of file DLB.hpp.

## ◆ setComputationCost()

 void DLB::setComputationCost ( size_t computation )
inline

Set time step for the single iteration.

Parameters
 computation value of the computation cost (default: 5)

Definition at line 299 of file DLB.hpp.

## ◆ setHeurisitc()

 void DLB::setHeurisitc ( Heuristic h )
inline

Set the heuristic to use (default: un-balance threshold)

Parameters
 h

Definition at line 177 of file DLB.hpp.

## ◆ setSimulationEndTime()

 void DLB::setSimulationEndTime ( size_t t )
inline

Set end time for the simulation.

Parameters
 t time when the whole simulation ends

Definition at line 235 of file DLB.hpp.

## ◆ setSimulationStartTime()

 void DLB::setSimulationStartTime ( size_t t )
inline

Set start time for the simulation.

Parameters
 t time when the whole simulation starts

Definition at line 216 of file DLB.hpp.

## ◆ setThresholdLevel()

 void DLB::setThresholdLevel ( ThresholdLevel t )
inline

threshold of umbalance to start a rebalance

Parameters
 t threshold level

Definition at line 327 of file DLB.hpp.

## ◆ setTimeStep()

 void DLB::setTimeStep ( double t )
inline

Set delta time step for one iteration (Computation time)

Parameters
 t timestep

Definition at line 290 of file DLB.hpp.

## ◆ setUnbalance()

 void DLB::setUnbalance ( float u )
inline

Set un-balance value.

Parameters
 u unbalance

Definition at line 318 of file DLB.hpp.

## ◆ startIteration() [1/2]

 void DLB::startIteration ( )
inline

Set start time for the single iteration.

Definition at line 253 of file DLB.hpp.

## ◆ startIteration() [2/2]

 void DLB::startIteration ( size_t t )
inline

Set start time for the single iteration.

Parameters
 t time when the one iteration starts

Definition at line 262 of file DLB.hpp.

## ◆ unbalanceThreshold()

 bool DLB::unbalanceThreshold ( )
inlineprivate

Check if the un-balance has exceeded the threshold.

Returns
true if re-balance is needed, false otherwise

Definition at line 146 of file DLB.hpp.

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