AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
autopas::TuningManager Class Reference

The TuningManager is responsible for coordinating the AutoTuner(s) In the case of multiple AutoTuners it ensures that configurations are selected with the same container for all tuners. More...

#include <TuningManager.h>

Public Member Functions

 TuningManager (const AutoTunerInfo &autoTunerInfo)
 Constructor of the TuningManager.
 
void addAutoTuner (std::unique_ptr< AutoTuner > tuner, InteractionTypeOption::Value interactionType)
 Add an AutoTuner to the TuningManager, which will take over ownership.
 
bool tune (size_t currentIteration, const LiveInfo &info)
 This method is the backbone of the TuningManager.
 
void addMeasurement (long sampleRebuild, long sampleTraverseParticles, bool neighborListRebuilt, size_t iteration, InteractionTypeOption::Value interactionType) const
 Add performance metrics for the currently active configuration.
 
void setRebuildFrequency (double rebuildFrequency)
 Pass the given rebuild frequency over to all AutoTuners.
 
Configuration rejectConfiguration (const Configuration &rejectedConfig, bool indefinitely, InteractionTypeOption::Value interactionType)
 Reject the current configuration for the interactionType by either skipping over it (indefinitely = false) or removing it entirely (indefinitely = true).
 
void forceRetune ()
 Force all AutoTuners to start a new tuning phase immediately.
 
void logTuningResult (long tuningTime, size_t currentIteration, InteractionTypeOption::Value interactionType) const
 Log the tuning result for a specific interaction type.
 
bool requiresRebuilding (size_t currentIteration)
 Returns whether a rebuild is required during the given iteration, based on AutoTuner(s) providing a new configuration.
 
bool needsLiveInfo (size_t currentIteration)
 Returns true if at least one AutoTuner needs LiveInfo.
 
bool allSearchSpacesAreTrivial () const
 
bool tuningPhaseJustFinished () const
 
bool isStartOfTuningPhase (size_t currentIteration) const
 Calculate whether we are at the start of a new tuning phase based on the current iteration and tuning interval.
 
bool inFirstConfigurationLastSample (size_t currentIteration) const
 Indicates whether the tuner is in the iteration corresponding to the last sample of the first configuration in the current tuning phase.
 
const ConfigurationgetCurrentConfig (InteractionTypeOption::Value interactionType) const
 Get the current configuration for a specific interaction type.
 
const TuningMetricOptiongetTuningMetric (InteractionTypeOption::Value interactionType) const
 Gets the tuning metric of the AutoTuner of interactionType.
 
std::unordered_map< InteractionTypeOption::Value, std::unique_ptr< AutoTuner > > & getAutoTuners ()
 

Detailed Description

The TuningManager is responsible for coordinating the AutoTuner(s) In the case of multiple AutoTuners it ensures that configurations are selected with the same container for all tuners.

Otherwise, neighbor lists would need to be rebuilt every time the interaction type (e.g. pairwise and triwise) is switched.

Constructor & Destructor Documentation

◆ TuningManager()

autopas::TuningManager::TuningManager ( const AutoTunerInfo autoTunerInfo)
explicit

Constructor of the TuningManager.

Parameters
autoTunerInfoto get the tuning interval

Member Function Documentation

◆ addAutoTuner()

void autopas::TuningManager::addAutoTuner ( std::unique_ptr< AutoTuner tuner,
InteractionTypeOption::Value  interactionType 
)

Add an AutoTuner to the TuningManager, which will take over ownership.

Parameters
interactionType
tunerA unique_ptr to the new tuner.

◆ addMeasurement()

void autopas::TuningManager::addMeasurement ( long  sampleRebuild,
long  sampleTraverseParticles,
bool  neighborListRebuilt,
size_t  iteration,
InteractionTypeOption::Value  interactionType 
) const

Add performance metrics for the currently active configuration.

Parameters
sampleRebuildMeasurement for the rebuild step.
sampleTraverseParticlesMeasurement for the traversal step.
neighborListRebuiltTrue, if this was a rebuild iteration.
iterationThe current iteration number.
interactionType

◆ allSearchSpacesAreTrivial()

bool autopas::TuningManager::allSearchSpacesAreTrivial ( ) const
Returns
True, if the search space of all AutoTuners consists of only one valid configuration.

◆ getAutoTuners()

std::unordered_map< InteractionTypeOption::Value, std::unique_ptr< AutoTuner > > & autopas::TuningManager::getAutoTuners ( )
inline
Returns
A reference to the map of AutoTuners.

◆ getCurrentConfig()

const Configuration & autopas::TuningManager::getCurrentConfig ( InteractionTypeOption::Value  interactionType) const

Get the current configuration for a specific interaction type.

Parameters
interactionType
Returns
Configuration

◆ getTuningMetric()

const TuningMetricOption & autopas::TuningManager::getTuningMetric ( InteractionTypeOption::Value  interactionType) const

Gets the tuning metric of the AutoTuner of interactionType.

(Metric as in time, energy, ...)

Parameters
interactionTypeGet info from the pairwise/triwise AutoTuner.
Returns
TuningMetricOption of the respective AutoTuner.

◆ inFirstConfigurationLastSample()

bool autopas::TuningManager::inFirstConfigurationLastSample ( size_t  currentIteration) const

Indicates whether the tuner is in the iteration corresponding to the last sample of the first configuration in the current tuning phase.

Parameters
currentIterationCurrent LogicHandler iteration number.
Returns
True, if this is the last sampling iteration for the first tested config.

◆ isStartOfTuningPhase()

bool autopas::TuningManager::isStartOfTuningPhase ( size_t  currentIteration) const

Calculate whether we are at the start of a new tuning phase based on the current iteration and tuning interval.

Parameters
currentIterationCurrent LogicHandler iteration number.
Returns
True, if this is the first tuning iteration.

◆ logTuningResult()

void autopas::TuningManager::logTuningResult ( long  tuningTime,
size_t  currentIteration,
InteractionTypeOption::Value  interactionType 
) const

Log the tuning result for a specific interaction type.

Parameters
tuningTimeMeasured time it took for tuning in nanoseconds.
currentIterationCurrent LogicHandler iteration number.
interactionType

◆ needsLiveInfo()

bool autopas::TuningManager::needsLiveInfo ( size_t  currentIteration)

Returns true if at least one AutoTuner needs LiveInfo.

This occurs if any strategy requires this and AutoPas is beginning a tuning phase or if a strategy requires domain similarity statistics (taken from LiveInfo) and AutoPas is within 10 iterations of a tuning phase.

Parameters
currentIterationCurrent LogicHandler iteration number.
Returns
true, if at least one AutoTuner needs live information for tuning.

◆ rejectConfiguration()

Configuration autopas::TuningManager::rejectConfiguration ( const Configuration rejectedConfig,
bool  indefinitely,
InteractionTypeOption::Value  interactionType 
)

Reject the current configuration for the interactionType by either skipping over it (indefinitely = false) or removing it entirely (indefinitely = true).

Also refreshes the respective AutoTuner's queue and returns the next configuration in line.

Parameters
rejectedConfigThe configuration to skip/remove
indefinitelyTrue, if the configuration should also be removed from the search space and with that upcoming tuning phases.
interactionTypePairwise, triwise, ...
Returns
The next configuration from the queue.

◆ requiresRebuilding()

bool autopas::TuningManager::requiresRebuilding ( size_t  currentIteration)

Returns whether a rebuild is required during the given iteration, based on AutoTuner(s) providing a new configuration.

Parameters
currentIterationCurrent LogicHandler iteration number.
Returns
True, if a rebuild is necessary due to a configuration change.

◆ setRebuildFrequency()

void autopas::TuningManager::setRebuildFrequency ( double  rebuildFrequency)

Pass the given rebuild frequency over to all AutoTuners.

Parameters
rebuildFrequency

◆ tune()

bool autopas::TuningManager::tune ( size_t  currentIteration,
const LiveInfo info 
)

This method is the backbone of the TuningManager.

It handles tuning phases and orchestrates between all active AutoTuners.

Parameters
currentIterationCurrent LogicHandler iteration number.
infoLiveInfo object to be passed to AutoTuners if relevant.
Returns
true, if at least one AutoTuner is still in tuning state.

◆ tuningPhaseJustFinished()

bool autopas::TuningManager::tuningPhaseJustFinished ( ) const
Returns
True, if the tuning phase just finished for all AutoTuners.

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