Peano
Loading...
Searching...
No Matches
toolbox::loadbalancing::metrics::CustomCellWeight Class Reference

Cost metrics based solely on cell counts. More...

#include <CustomCellWeight.h>

Inheritance diagram for toolbox::loadbalancing::metrics::CustomCellWeight:
Collaboration diagram for toolbox::loadbalancing::metrics::CustomCellWeight:

Public Member Functions

 CustomCellWeight ()
 
virtual ~CustomCellWeight ()=default
 
virtual std::string toString () const override
 Feel free to invoke the variant below if you want.
 
virtual void updateGlobalView () override
 Update global view.
 
virtual double getCostOfLocalTree (int spacetreeNumber) const override
 Implementation of abstract superclass routine.
 
- Public Member Functions inherited from toolbox::loadbalancing::CostMetrics
 CostMetrics ()
 
virtual ~CostMetrics ()=default
 
std::string toString (const std::string &metricName) const
 
virtual void waitForGlobalDataExchange ()
 Typically called by.
 
virtual double getCostOfLocalRank () const
 Wrapper around getCostOfLocalTree().
 
virtual double getGlobalCost () const
 
virtual int getLightestRank () const
 
virtual double getMinimumOfMaximumRankWeights () const
 

Static Public Member Functions

static void logCellWeight (int spacetreeNumber, double weight)
 Report weight of one cell.
 

Static Private Attributes

static tarch::multicore::BooleanSemaphore _semaphore
 
static tarch::logging::Log _log
 
static std::map< int, double_previousCellWeights
 Mapping of trees onto cell weights.
 
static std::map< int, double_currentCellWeights
 Mapping of trees onto cell weights.
 

Additional Inherited Members

- Protected Attributes inherited from toolbox::loadbalancing::CostMetrics
double _localRankWeight
 Weight of local rank.
 
double _globalWeight
 
ReductionBuffer _lightestRank
 
double _minimumOfMaximumOfRankWeights
 
MPI_Request * _globalWeightRequest
 Replicate compared to stats.
 
MPI_Request * _lightestRankRequest
 
MPI_Request * _minimumOfMaximumOfRankWeightsRequest
 
double _globalWeightIn
 
double _globalWeightOut
 
ReductionBuffer _lightestRankIn
 
ReductionBuffer _lightestRankOut
 
double _minimumOfMaximumOfRankWeightsIn
 
double _minimumOfMaximumOfRankWeightsOut
 

Detailed Description

Cost metrics based solely on cell counts.

This is a very simple implementations which basically is based upon the mesh statistics that we have anyway. So the metrics do not require further user input.

Definition at line 29 of file CustomCellWeight.h.

Constructor & Destructor Documentation

◆ CustomCellWeight()

toolbox::loadbalancing::metrics::CustomCellWeight::CustomCellWeight ( )

Definition at line 16 of file CustomCellWeight.cpp.

◆ ~CustomCellWeight()

virtual toolbox::loadbalancing::metrics::CustomCellWeight::~CustomCellWeight ( )
virtualdefault

Member Function Documentation

◆ getCostOfLocalTree()

double toolbox::loadbalancing::metrics::CustomCellWeight::getCostOfLocalTree ( int spacetreeNumber) const
overridevirtual

Implementation of abstract superclass routine.

Deliver the requested entry from _previousCellWeights. If no such entry exists, we return 0.0. As this is a read-only access, we don't need a semaphore.

Implements toolbox::loadbalancing::CostMetrics.

Definition at line 40 of file CustomCellWeight.cpp.

◆ logCellWeight()

void toolbox::loadbalancing::metrics::CustomCellWeight::logCellWeight ( int spacetreeNumber,
double weight )
static

Report weight of one cell.

This routine is thread-safe, as it will be invoked by multiple tree traversals at the same time. It accumulates data within _currentCellWeights.

Definition at line 50 of file CustomCellWeight.cpp.

References tarch::multicore::Lock::free().

Here is the call graph for this function:

◆ toString()

std::string toolbox::loadbalancing::metrics::CustomCellWeight::toString ( ) const
overridevirtual

Feel free to invoke the variant below if you want.

Or add additional info.

Implements toolbox::loadbalancing::CostMetrics.

Definition at line 20 of file CustomCellWeight.cpp.

References toolbox::loadbalancing::CostMetrics::toString().

Here is the call graph for this function:

◆ updateGlobalView()

void toolbox::loadbalancing::metrics::CustomCellWeight::updateGlobalView ( )
overridevirtual

Update global view.

This routine runs through four steps:

  1. We copy _currentCellWeights into _previousCellWeights erasing the latter.
  2. We clear _previousCellWeights, so it can be used to reaccumulate any data of interest.
  3. We determine the value of _localRankWeight.
  4. We finally invoke the superclass' routine so it can handle all the global data exchange.

Reimplemented from toolbox::loadbalancing::CostMetrics.

Definition at line 25 of file CustomCellWeight.cpp.

References toolbox::loadbalancing::CostMetrics::updateGlobalView().

Here is the call graph for this function:

Field Documentation

◆ _currentCellWeights

std::map< int, double > toolbox::loadbalancing::metrics::CustomCellWeight::_currentCellWeights
staticprivate

Mapping of trees onto cell weights.

This is a working data structure, i.e. one we use to accumulate data into. The current data hence might still be incomplete when you read it. As we accumulate data from the local rank only, we do not hold global information, i.e. information from other ranks.

Definition at line 85 of file CustomCellWeight.h.

◆ _log

tarch::logging::Log toolbox::loadbalancing::metrics::CustomCellWeight::_log
staticprivate

Definition at line 70 of file CustomCellWeight.h.

◆ _previousCellWeights

std::map< int, double > toolbox::loadbalancing::metrics::CustomCellWeight::_previousCellWeights
staticprivate

Mapping of trees onto cell weights.

These are the one from a previous tree traversal and hence complete data which we can use to read.

Definition at line 76 of file CustomCellWeight.h.

◆ _semaphore

tarch::multicore::BooleanSemaphore toolbox::loadbalancing::metrics::CustomCellWeight::_semaphore
staticprivate

Definition at line 69 of file CustomCellWeight.h.


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