HEBench
hebench::TestHarness::PartialBenchmarkCategory Class Referenceabstract

#include <hebench_benchmark_category.h>

Inheritance diagram for hebench::TestHarness::PartialBenchmarkCategory:
Collaboration diagram for hebench::TestHarness::PartialBenchmarkCategory:

Classes

class  RAIIHandle
 

Public Types

typedef std::shared_ptr< PartialBenchmarkCategoryPtr
 
- Public Types inherited from hebench::TestHarness::PartialBenchmark
typedef std::shared_ptr< PartialBenchmarkPtr
 
- Public Types inherited from hebench::TestHarness::IBenchmark
typedef std::shared_ptr< IBenchmarkPtr
 

Public Member Functions

 ~PartialBenchmarkCategory () override
 
- Public Member Functions inherited from hebench::TestHarness::PartialBenchmark
 ~PartialBenchmark () override
 
std::weak_ptr< EnginegetEngine () const override
 
const hebench::APIBridge::Handlehandle () 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

 PartialBenchmarkCategory (std::shared_ptr< Engine > p_engine, const IBenchmarkDescriptor::DescriptionToken &description_token)
 
virtual IDataLoader::Ptr getDataset () const =0
 Dataset to be used for operations previously initialized during creation of this object. More...
 
virtual bool validateResult (IDataLoader::Ptr dataset, const std::uint64_t *param_data_pack_indices, const std::vector< hebench::APIBridge::NativeDataBuffer * > &outputs, hebench::APIBridge::DataType data_type) const
 Validates the result of an operation against the ground truth. More...
 
virtual void logResult (std::ostream &os, IDataLoader::Ptr dataset, const std::uint64_t *param_data_pack_indices, const std::vector< hebench::APIBridge::NativeDataBuffer * > &outputs, hebench::APIBridge::DataType data_type) const
 Outputs the arguments, expected ground truth, and received result to an output stream. More...
 
- Protected Member Functions inherited from hebench::TestHarness::PartialBenchmark
const BenchmarkDescription::BackendgetBackendDescription () const
 Allows read-only access to this benchmark backend description. More...
 
const BenchmarkDescription::ConfigurationgetBenchmarkConfiguration () const
 Allows read-only access to this benchmark configuration. More...
 
const BenchmarkDescription::DescriptiongetDescription () 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
 

Detailed Description

Definition at line 23 of file hebench_benchmark_category.h.

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ ~PartialBenchmarkCategory()

hebench::TestHarness::PartialBenchmarkCategory::~PartialBenchmarkCategory ( )
override

Definition at line 90 of file hebench_benchmark_category.cpp.

◆ PartialBenchmarkCategory()

hebench::TestHarness::PartialBenchmarkCategory::PartialBenchmarkCategory ( std::shared_ptr< Engine p_engine,
const IBenchmarkDescriptor::DescriptionToken description_token 
)
protected

Definition at line 84 of file hebench_benchmark_category.cpp.

Member Function Documentation

◆ getDataset()

◆ logResult()

void hebench::TestHarness::PartialBenchmarkCategory::logResult ( std::ostream &  os,
IDataLoader::Ptr  dataset,
const std::uint64_t *  param_data_pack_indices,
const std::vector< hebench::APIBridge::NativeDataBuffer * > &  outputs,
hebench::APIBridge::DataType  data_type 
) const
protectedvirtual

Outputs the arguments, expected ground truth, and received result to an output stream.

Parameters
osStream where to write the log.
datasetDataset used for the operation.
[in]param_data_pack_indicesCollection of indices for data sample to use inside each parameter pack. See IDataLoader::getResultIndex().
[in]p_outputsPointer to the buffers containing the result of the operation to validate.
[in]data_typeData type of the data used in the operation.

The number of buffers in vector p_outputs must be the same as the dimension of the ground truth result. It is expected that each buffer pointed by p_outputs is, at least, of the same size, in bytes, as the corresponding ground truth buffer.

While not required, data output format should be a vector per column, for uniformity with default implementation. Utility function hebench::Utilities::printArraysAsColumns() can help with column format printout.

The default implementation provided assumes that dataset contains the results pre-computed and the data type for all arguments and results is data_type. If this is not the case for the derived class, clients should provide their own override version of this method.

See also
hebench::Utilities::printArraysAsColumns()

Definition at line 210 of file hebench_benchmark_category.cpp.

◆ validateResult()

bool hebench::TestHarness::PartialBenchmarkCategory::validateResult ( IDataLoader::Ptr  dataset,
const std::uint64_t *  param_data_pack_indices,
const std::vector< hebench::APIBridge::NativeDataBuffer * > &  outputs,
hebench::APIBridge::DataType  data_type 
) const
protectedvirtual

Validates the result of an operation against the ground truth.

Parameters
[in]datasetDataset containing the data for the operation performed.
[in]param_data_pack_indicesCollection of indices for data sample to use inside each parameter pack. See IDataLoader::getResultIndex().
[in]p_outputsPointer to the buffers containing the result of the operation to validate.
[in]data_typeData type of the data used in the operation.
Returns
true if result is valid.
false if result is not valid (or an std::exception descendant can be thrown in such case).

The number of buffers in vector p_outputs must be the same as the dimension of the ground truth result. It is expected that each buffer pointed by p_outputs is, at least, of the same size, in bytes, as the corresponding ground truth buffer.

Validation routine can either retrieve the ground truth result from dataset or compute it on the fly using the inputs from dataset pointed by param_data_pack_indices.

The default implementation provided assumes that dataset contains the results pre-computed and the data type for all arguments and results is data_type. If this is not the case for the derived class, clients should provide their own override version of this method.

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 94 of file hebench_benchmark_category.cpp.


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