Kernel Tuning Toolkit 2.3
 
Loading...
Searching...
No Matches
ktt::Searcher Class Referenceabstract

#include <Searcher.h>

Inheritance diagram for ktt::Searcher:
ktt::DeterministicSearcher ktt::McmcSearcher ktt::RandomSearcher

Public Member Functions

virtual ~Searcher ()=default
 
virtual void OnInitialize ()
 
virtual void OnReset ()
 
virtual bool CalculateNextConfiguration (const KernelResult &previousResult)=0
 
virtual KernelConfiguration GetCurrentConfiguration () const =0
 
 Searcher ()
 
KernelConfiguration GetConfiguration (const uint64_t index) const
 
uint64_t GetIndex (const KernelConfiguration &configuration) const
 
KernelConfiguration GetRandomConfiguration () const
 
std::vector< KernelConfigurationGetNeighbourConfigurations (const KernelConfiguration &configuration, const uint64_t maxDifferences, const size_t maxNeighbours=3) const
 
uint64_t GetConfigurationsCount () const
 
uint64_t GetUnexploredConfigurationsCount () const
 
const std::set< uint64_t > & GetExploredIndices () const
 
bool IsInitialized () const
 
void Initialize (const ConfigurationData &data)
 
void Reset ()
 

Detailed Description

Class which is used to decide which kernel configuration will be run next during the kernel tuning process.

Constructor & Destructor Documentation

◆ ~Searcher()

ktt::Searcher::~Searcher ( )
virtualdefault

Searcher destructor. Inheriting class can override destructor with custom implementation. Default implementation is provided by KTT framework.

◆ Searcher()

ktt::Searcher::Searcher ( )

Default searcher constructor. Should be called from inheriting searcher's constructor.

Member Function Documentation

◆ CalculateNextConfiguration()

bool ktt::Searcher::CalculateNextConfiguration ( const KernelResult previousResult)
pure virtual

Calculates the configuration which will be run next. Called after processing the current configuration if there are any remaining unexplored configurations.

Parameters
previousResultResult from the last tested configuration. See KernelResult for more information.
Returns
True if the next configuration was successfully calculated, false otherwise. If false is returned, configuration space exploration will be stopped.

Implemented in ktt::DeterministicSearcher, ktt::McmcSearcher, and ktt::RandomSearcher.

◆ GetConfiguration()

KernelConfiguration ktt::Searcher::GetConfiguration ( const uint64_t  index) const

Returns configuration with the specified index.

Parameters
indexIndex of the configuration that should be retrieved. The index must be less than the count returned by GetConfigurationsCount method.
Returns
Configuration with the specified index.

◆ GetConfigurationsCount()

uint64_t ktt::Searcher::GetConfigurationsCount ( ) const

Returns total number of valid kernel configurations.

Returns
Number of valid kernel configurations.

◆ GetCurrentConfiguration()

KernelConfiguration ktt::Searcher::GetCurrentConfiguration ( ) const
pure virtual

Returns current kernel configuration. Note that this may be called repeatedly before calculating next configuration. In that case, the returned configuration must always be the same.

Returns
Current configuration.

Implemented in ktt::DeterministicSearcher, ktt::McmcSearcher, and ktt::RandomSearcher.

◆ GetExploredIndices()

const std::set< uint64_t > & ktt::Searcher::GetExploredIndices ( ) const

Returns indices of already explored configurations.

Returns
Indices of already explored configurations.

◆ GetIndex()

uint64_t ktt::Searcher::GetIndex ( const KernelConfiguration configuration) const

Returns index of the specified configuration.

Parameters
configurationConfiguration for which the index will be retrieved.
Returns
Index of the specified configuration.

◆ GetNeighbourConfigurations()

std::vector< KernelConfiguration > ktt::Searcher::GetNeighbourConfigurations ( const KernelConfiguration configuration,
const uint64_t  maxDifferences,
const size_t  maxNeighbours = 3 
) const

Retrieves unexplored neighbour configurations of the specified configuration.

Parameters
configurationConfiguration whose neighbours will be retrieved.
maxDifferencesMaximum number of parameters in neighbour configurations whose values differ from the original configuration.
maxNeighboursMaximum number of retrieved neighbour configurations.
Returns
Neighbours of the specified configuration. Note that the result might be empty in case no suitable configurations were found.

◆ GetRandomConfiguration()

KernelConfiguration ktt::Searcher::GetRandomConfiguration ( ) const

Returns random unexplored configuration.

Returns
Random unexplored configuration.

◆ GetUnexploredConfigurationsCount()

uint64_t ktt::Searcher::GetUnexploredConfigurationsCount ( ) const

Return number of unexplored kernel configurations

Returns
Number of unexplored kernel configurations

◆ Initialize()

void ktt::Searcher::Initialize ( const ConfigurationData &  data)

Initializes searcher with the tree of configurations which can be explored for corresponding kernel.

Parameters
dataInternal structure containing configurations which can be explored

◆ IsInitialized()

bool ktt::Searcher::IsInitialized ( ) const

Returns whether searcher is initialized.

Returns
True if searcher is initialized, false otherwise.

◆ OnInitialize()

void ktt::Searcher::OnInitialize ( )
virtual

Called after searcher is initialized with kernel configurations. The first kernel configuration as well as custom searcher parameters should be initialized here.

Reimplemented in ktt::McmcSearcher, and ktt::RandomSearcher.

◆ OnReset()

void ktt::Searcher::OnReset ( )
virtual

Called before searcher is reset to initial state and configurations are removed. Custom searcher parameters should be reset here.

Reimplemented in ktt::DeterministicSearcher, and ktt::McmcSearcher.

◆ Reset()

void ktt::Searcher::Reset ( )

Resets searcher to initial state and clears configuration tree.


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