HEBench
hebench::TestHarness::IBenchmarkDescriptor Class Referenceabstract

Base interface for Benchmark Descriptors. More...

#include <hebench_ibenchmark.h>

Inheritance diagram for hebench::TestHarness::IBenchmarkDescriptor:

Classes

class  DescriptionToken
 Token returned by a successful call to IBenchmarkDescriptor::matchBenchmarkDescriptor(). More...
 

Public Member Functions

 IBenchmarkDescriptor ()=default
 
virtual ~IBenchmarkDescriptor ()=default
 
virtual DescriptionToken::Ptr matchDescriptor (const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const =0
 Determines if the represented benchmark can perform the workload described by a specified HEBench benchmark descriptor and configuration. More...
 
virtual PartialBenchmarkcreateBenchmark (std::shared_ptr< Engine > p_engine, const DescriptionToken &description_token)=0
 Creates the represented IBenchmark object that can perform the workload specified by the HEBench benchmark descriptor. More...
 
virtual void destroyBenchmark (PartialBenchmark *p_bench)=0
 Destroys an object returned by createBenchmark(). More...
 

Protected Member Functions

DescriptionToken::Ptr createToken (const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config, const BenchmarkDescription::Description &text_desc) const
 Creates a DescriptionToken object associated to this IBenchmarkDescription object using the specified benchmark description. More...
 

Detailed Description

Base interface for Benchmark Descriptors.

Benchmark Descriptors are lightweight classes that represent a benchmark or collection of benchmarks that can be executed. For each supported benchmark, a corresponding Benchmark Descriptor is registered with the BenchmarkFactory.

During benchmark selection, BenchmarkFactory polls every registered Benchmark Descriptor whether their represented benchmark can execute the benchmark described by a backend. Once a descriptor is matched, it is responsible for creating its represented benchmark object. Once the benchmark completes, the same descriptor is tasked with destroying it.

Clients should extend PartialBenchmarkDescriptor class when creating their descriptors instead of this interface.

Definition at line 43 of file hebench_ibenchmark.h.

Constructor & Destructor Documentation

◆ IBenchmarkDescriptor()

hebench::TestHarness::IBenchmarkDescriptor::IBenchmarkDescriptor ( )
default

◆ ~IBenchmarkDescriptor()

virtual hebench::TestHarness::IBenchmarkDescriptor::~IBenchmarkDescriptor ( )
virtualdefault

Member Function Documentation

◆ createBenchmark()

virtual PartialBenchmark* hebench::TestHarness::IBenchmarkDescriptor::createBenchmark ( std::shared_ptr< Engine p_engine,
const DescriptionToken description_token 
)
pure virtual

Creates the represented IBenchmark object that can perform the workload specified by the HEBench benchmark descriptor.

Parameters
[in]p_engineThe engine creating the benchmark.
[in]description_tokenDescription token describing the benchmark to create, as matched by matchBenchmarkDescriptor().
Returns
Pointer to object of class derived from IBenchmark that can perform the specified workload or null on unknown error.

Instead of returning null, this method may also throw instances of std::exception to communicate errors to caller with better error descriptions.

This method constructs an object of type derived from IBenchmark, performs any pending initialization on the fully constructed object, and returns a pointer to it. The returned pointer must live until passed to method destroyBenchmark().

See also
destroyBenchmark()

Implemented in hebench::TestHarness::SimpleSetIntersection::Offline::BenchmarkDescriptor, hebench::TestHarness::SimpleSetIntersection::Latency::BenchmarkDescriptor, hebench::TestHarness::MatrixMultiply::Offline::BenchmarkDescriptor, hebench::TestHarness::MatrixMultiply::Latency::BenchmarkDescriptor, hebench::TestHarness::LogisticRegression::Offline::BenchmarkDescriptor, hebench::TestHarness::LogisticRegression::Latency::BenchmarkDescriptor, hebench::TestHarness::GenericWL::Offline::BenchmarkDescriptor, hebench::TestHarness::GenericWL::Latency::BenchmarkDescriptor, hebench::TestHarness::EltwiseMult::Offline::BenchmarkDescriptor, hebench::TestHarness::EltwiseMult::Latency::BenchmarkDescriptor, hebench::TestHarness::EltwiseAdd::Offline::BenchmarkDescriptor, hebench::TestHarness::EltwiseAdd::Latency::BenchmarkDescriptor, hebench::TestHarness::DotProduct::Offline::BenchmarkDescriptor, and hebench::TestHarness::DotProduct::Latency::BenchmarkDescriptor.

◆ createToken()

IBenchmarkDescriptor::DescriptionToken::Ptr hebench::TestHarness::IBenchmarkDescriptor::createToken ( const BenchmarkDescription::Backend backend_desc,
const BenchmarkDescription::Configuration config,
const BenchmarkDescription::Description text_desc 
) const
protected

Creates a DescriptionToken object associated to this IBenchmarkDescription object using the specified benchmark description.

Definition at line 27 of file hebench_ibenchmark.cpp.

◆ destroyBenchmark()

◆ matchDescriptor()

virtual DescriptionToken::Ptr hebench::TestHarness::IBenchmarkDescriptor::matchDescriptor ( const Engine engine,
const BenchmarkDescription::Backend backend_desc,
const BenchmarkDescription::Configuration config 
) const
pure virtual

Determines if the represented benchmark can perform the workload described by a specified HEBench benchmark descriptor and configuration.

Parameters
[in]engineEngine requesting the matching.
[in]backend_descBackend descriptor to match.
[in]configConfiguration of benchmark to match.
Returns
A valid token representing the matched benchmark if the benchmark corresponding to this IBenchmarkDescription object is compatible with and can perform the described workload.
null otherwise.

The token returned by this method can be passed to createBenchmark() to instantiate the actual benchmark. All fields in the returned token must be fully and correctly set, including the backend BenchmarkDescriptor with concrete values instead of configurable placeholder values. This token can be used to describe the benchmark.

This method is used by BenchmarkFactory::createBenchmark() to select the appropriate benchmark to create based on the descriptor and the workload parameters.

Implemented in hebench::TestHarness::PartialBenchmarkDescriptor.


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