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 Configuration & | getCurrentConfig (InteractionTypeOption::Value interactionType) const |
| Get the current configuration for a specific interaction type. | |
| const TuningMetricOption & | getTuningMetric (InteractionTypeOption::Value interactionType) const |
| Gets the tuning metric of the AutoTuner of interactionType. | |
| std::unordered_map< InteractionTypeOption::Value, std::unique_ptr< AutoTuner > > & | getAutoTuners () |
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.
|
explicit |
Constructor of the TuningManager.
| autoTunerInfo | to get the tuning interval |
| void autopas::TuningManager::addAutoTuner | ( | std::unique_ptr< AutoTuner > | tuner, |
| InteractionTypeOption::Value | interactionType | ||
| ) |
Add an AutoTuner to the TuningManager, which will take over ownership.
| interactionType | |
| tuner | A unique_ptr to the new tuner. |
| 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.
| sampleRebuild | Measurement for the rebuild step. |
| sampleTraverseParticles | Measurement for the traversal step. |
| neighborListRebuilt | True, if this was a rebuild iteration. |
| iteration | The current iteration number. |
| interactionType |
| bool autopas::TuningManager::allSearchSpacesAreTrivial | ( | ) | const |
|
inline |
| const Configuration & autopas::TuningManager::getCurrentConfig | ( | InteractionTypeOption::Value | interactionType | ) | const |
Get the current configuration for a specific interaction type.
| interactionType |
| const TuningMetricOption & autopas::TuningManager::getTuningMetric | ( | InteractionTypeOption::Value | interactionType | ) | const |
Gets the tuning metric of the AutoTuner of interactionType.
(Metric as in time, energy, ...)
| interactionType | Get info from the pairwise/triwise AutoTuner. |
| 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.
| currentIteration | Current LogicHandler iteration number. |
| 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.
| currentIteration | Current LogicHandler iteration number. |
| void autopas::TuningManager::logTuningResult | ( | long | tuningTime, |
| size_t | currentIteration, | ||
| InteractionTypeOption::Value | interactionType | ||
| ) | const |
Log the tuning result for a specific interaction type.
| tuningTime | Measured time it took for tuning in nanoseconds. |
| currentIteration | Current LogicHandler iteration number. |
| interactionType |
| 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.
| currentIteration | Current LogicHandler iteration number. |
| 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.
| rejectedConfig | The configuration to skip/remove |
| indefinitely | True, if the configuration should also be removed from the search space and with that upcoming tuning phases. |
| interactionType | Pairwise, triwise, ... |
| 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.
| currentIteration | Current LogicHandler iteration number. |
| void autopas::TuningManager::setRebuildFrequency | ( | double | rebuildFrequency | ) |
Pass the given rebuild frequency over to all AutoTuners.
| rebuildFrequency |
| 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.
| currentIteration | Current LogicHandler iteration number. |
| info | LiveInfo object to be passed to AutoTuners if relevant. |
| bool autopas::TuningManager::tuningPhaseJustFinished | ( | ) | const |