HEBench
|
Base class for benchmarks. More...
#include <hebench_ibenchmark.h>
Classes | |
class | FriendPrivateKey |
Public Types | |
typedef std::shared_ptr< PartialBenchmark > | Ptr |
Public Types inherited from hebench::TestHarness::IBenchmark | |
typedef std::shared_ptr< IBenchmark > | Ptr |
Public Member Functions | |
~PartialBenchmark () override | |
std::weak_ptr< Engine > | getEngine () const override |
const hebench::APIBridge::Handle & | handle () const override |
virtual std::uint32_t | getEventIDStart () const |
An ID to identify the first event during the benchmark run. More... | |
std::uint32_t | getEventIDNext () |
Returns the next available event ID. More... | |
virtual void | init ()=0 |
Initializes the partial benchmark members. More... | |
void | initBackend (hebench::Utilities::TimingReportEx &out_report, const FriendPrivateKey &) |
Initializes backend benchmark. More... | |
virtual void | postInit () |
Called automatically during initialization after the backend has been initialized. More... | |
void | checkInitializationState (const FriendPrivateKey &) const |
Used to check that initialization steps have been completed successfully. More... | |
Public Member Functions inherited from hebench::TestHarness::IBenchmark | |
virtual | ~IBenchmark ()=default |
virtual bool | run (hebench::Utilities::TimingReportEx &out_report, RunConfig &config)=0 |
Executes the benchmark operations. More... | |
Protected Member Functions | |
const BenchmarkDescription::Backend & | getBackendDescription () const |
Allows read-only access to this benchmark backend description. More... | |
const BenchmarkDescription::Configuration & | getBenchmarkConfiguration () const |
Allows read-only access to this benchmark configuration. More... | |
const BenchmarkDescription::Description & | getDescription () const |
Allows read-only access to this benchmark text description. More... | |
PartialBenchmark (std::shared_ptr< Engine > p_engine, const IBenchmarkDescriptor::DescriptionToken &description_token) | |
void | validateRetCode (hebench::APIBridge::ErrorCode err_code, bool last_error=true) const |
Validates whether the specified HEBench API return code represents a success or error. More... | |
Protected Member Functions inherited from hebench::TestHarness::IBenchmark | |
IBenchmark ()=default | |
Base class for benchmarks.
This class offers common implementations to trivial methods declared by interface IBenchmark.
To extend this class and create workloads, it is easier to extend directly from the workload category benchmark classes BenchmarkLatency, BenchmarkOffline, etc. If more control or specific processing other than the generic category execution is needed, extending from this class offers more flexibility.
Definition at line 499 of file hebench_ibenchmark.h.
typedef std::shared_ptr<PartialBenchmark> hebench::TestHarness::PartialBenchmark::Ptr |
Definition at line 517 of file hebench_ibenchmark.h.
|
override |
Definition at line 619 of file hebench_ibenchmark.cpp.
|
protected |
Definition at line 602 of file hebench_ibenchmark.cpp.
void hebench::TestHarness::PartialBenchmark::checkInitializationState | ( | const FriendPrivateKey & | ) | const |
Used to check that initialization steps have been completed successfully.
std::runtime_error | if initialization of PartialBenchmark is incomplete. |
During benchmark creation and initialization the following methods are called in order automatically by the framework:
If any existing default base implementation of these methods provided by PartialBenchmark has not been called, then this method will fail and the exception will be thrown.
Definition at line 670 of file hebench_ibenchmark.cpp.
|
inlineprotected |
Allows read-only access to this benchmark backend description.
Definition at line 608 of file hebench_ibenchmark.h.
|
inlineprotected |
Allows read-only access to this benchmark configuration.
Definition at line 612 of file hebench_ibenchmark.h.
|
inlineprotected |
Allows read-only access to this benchmark text description.
Definition at line 616 of file hebench_ibenchmark.h.
|
inlineoverridevirtual |
Implements hebench::TestHarness::IBenchmark.
Definition at line 521 of file hebench_ibenchmark.h.
|
inline |
Returns the next available event ID.
Next available event ID starts from getEventIDStart()
and increments by one on every call to this method. This ensures unique event IDs for an object of this class.
Definition at line 543 of file hebench_ibenchmark.h.
|
inlinevirtual |
An ID to identify the first event during the benchmark run.
All events in the execution of the benchmark will have an ID. The first event's ID will be this value. ID of subsequent events will be a value greater than this ID.
This is for report and display purposes only, so it matters not whether different benchmarks produce the same ID. If no override, it defaults to 0 for all derived classes.
Reimplemented in hebench::TestHarness::SimpleSetIntersection::Offline::Benchmark, hebench::TestHarness::SimpleSetIntersection::Latency::Benchmark, hebench::TestHarness::MatrixMultiply::Offline::Benchmark, hebench::TestHarness::MatrixMultiply::Latency::Benchmark, hebench::TestHarness::LogisticRegression::Offline::Benchmark, hebench::TestHarness::LogisticRegression::Latency::Benchmark, hebench::TestHarness::GenericWL::Offline::Benchmark, hebench::TestHarness::GenericWL::Latency::Benchmark, hebench::TestHarness::EltwiseMult::Offline::Benchmark, hebench::TestHarness::EltwiseMult::Latency::Benchmark, hebench::TestHarness::EltwiseAdd::Offline::Benchmark, hebench::TestHarness::EltwiseAdd::Latency::Benchmark, hebench::TestHarness::DotProduct::Offline::Benchmark, and hebench::TestHarness::DotProduct::Latency::Benchmark.
Definition at line 534 of file hebench_ibenchmark.h.
|
inlineoverridevirtual |
Implements hebench::TestHarness::IBenchmark.
Definition at line 522 of file hebench_ibenchmark.h.
|
pure virtual |
Initializes the partial benchmark members.
This method is provided to allow clients to perform polymorphic initialization outside of the class constructor before the backend benchmark is initialized. Unless an initialized backend benchmark is required, this is a good spot to perform dataset generation or loading for the benchmark to execute.
This method is called automatically during creation and initialization of the benchmark.
Implemented in hebench::TestHarness::SimpleSetIntersection::Offline::Benchmark, hebench::TestHarness::SimpleSetIntersection::Latency::Benchmark, hebench::TestHarness::MatrixMultiply::Offline::Benchmark, hebench::TestHarness::MatrixMultiply::Latency::Benchmark, hebench::TestHarness::LogisticRegression::Offline::Benchmark, hebench::TestHarness::LogisticRegression::Latency::Benchmark, hebench::TestHarness::GenericWL::Offline::Benchmark, hebench::TestHarness::GenericWL::Latency::Benchmark, hebench::TestHarness::EltwiseMult::Offline::Benchmark, hebench::TestHarness::EltwiseMult::Latency::Benchmark, hebench::TestHarness::EltwiseAdd::Offline::Benchmark, hebench::TestHarness::EltwiseAdd::Latency::Benchmark, hebench::TestHarness::DotProduct::Offline::Benchmark, and hebench::TestHarness::DotProduct::Latency::Benchmark.
void hebench::TestHarness::PartialBenchmark::initBackend | ( | hebench::Utilities::TimingReportEx & | out_report, |
const FriendPrivateKey & | |||
) |
Initializes backend benchmark.
HEBench API calls are performed here in order to initialize the benchmark corresponding to the description token used during construction.
Definition at line 640 of file hebench_ibenchmark.cpp.
|
virtual |
Called automatically during initialization after the backend has been initialized.
This method allows clients to perform polymorphic initialization outside of the class constructor after the backend benchmark has been initialized, if needed.
Derived classes MUST call this base implementation as first step when overriding, otherwise, checkInitializationState()
will throw exceptions.
This method is called automatically during creation and initialization of the benchmark.
Definition at line 635 of file hebench_ibenchmark.cpp.
|
protected |
Validates whether the specified HEBench API return code represents a success or error.
[in] | err_code | Error code to validate. |
[in] | last_error | Specifies if this is the latest error to occur. |
std::runtime_error | if err_code represents an error. |
If err_code
represents success, this method returns immediately. Otherwise, a std::runtime_error exception is thrown with the error description and extra information as retrieved from the backend if requested by setting last_error
to true
.
Definition at line 676 of file hebench_ibenchmark.cpp.