OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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. 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

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.
 

Member Enumeration Documentation

◆ Heuristic

Type of DLB heuristics.

Definition at line 58 of file DLB.hpp.

◆ ThresholdLevel

Level of un-balance needed to trigger the re-balance.

Definition at line 64 of file DLB.hpp.

Constructor & Destructor Documentation

◆ DLB()

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

Constructor for DLB class.

Parameters
v_clvirtual cluster object

Definition at line 168 of file DLB.hpp.

Member Function Documentation

◆ endIteration() [1/2]

void DLB::endIteration ( )
inline

Set end time for the single iteration.

Parameters
timewhen 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
ttime 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
computationvalue 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
ttime 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
ttime 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
tthreshold 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
ttimestep

Definition at line 290 of file DLB.hpp.

◆ setUnbalance()

void DLB::setUnbalance ( float  u)
inline

Set un-balance value.

Parameters
uunbalance

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

Field Documentation

◆ c_c

float DLB::c_c = 5
private

Computation cost for SAR heuristic.

Definition at line 81 of file DLB.hpp.

◆ heuristic

Heuristic DLB::heuristic = UNBALANCE_THRLD
private

Type of the heuristic to use.

Definition at line 93 of file DLB.hpp.

◆ i_time

float DLB::i_time = 0
private

Idle time accumulated so far, needed for SAR heuristic.

Definition at line 87 of file DLB.hpp.

◆ n_ts

size_t DLB::n_ts = 1
private

Number of time-steps since the previous DLB.

Definition at line 84 of file DLB.hpp.

◆ thl

ThresholdLevel DLB::thl = THRLD_MEDIUM
private

Threshold value.

Definition at line 99 of file DLB.hpp.

◆ timeInfo

Times DLB::timeInfo
private

Structure that will contain all the timings.

Definition at line 75 of file DLB.hpp.

◆ times

openfpm::vector<long> DLB::times
private

Vector to collect all timings.

Definition at line 90 of file DLB.hpp.

◆ unbalance

float DLB::unbalance = -1
private

Un-balance value.

Definition at line 96 of file DLB.hpp.

◆ v_cl

Vcluster& DLB::v_cl
private

Runtime virtual cluster machine.

Definition at line 72 of file DLB.hpp.

◆ w_n

float DLB::w_n = -1
private

Wn for SAR heuristic.

Definition at line 78 of file DLB.hpp.


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