HEBench
hebench_benchmark_category.h
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef _HEBench_Harness_Benchmark_Category_H_0596d40a3cce4b108a81595c50eb286d
6 #define _HEBench_Harness_Benchmark_Category_H_0596d40a3cce4b108a81595c50eb286d
7 
8 #include <memory>
9 #include <ostream>
10 #include <string>
11 #include <vector>
12 
13 #include "hebench/modules/general/include/nocopy.h"
14 #include "hebench/modules/logging/include/logging.h"
15 
17 
18 namespace hebench {
19 namespace TestHarness {
20 
21 class Engine;
22 
24 {
25 public:
26  DISABLE_COPY(PartialBenchmarkCategory)
27  DISABLE_MOVE(PartialBenchmarkCategory)
28 private:
29  IL_DECLARE_CLASS_NAME(PartialBenchmarkCategory)
30 
31 public:
32  typedef std::shared_ptr<PartialBenchmarkCategory> Ptr;
33 
34  ~PartialBenchmarkCategory() override;
35 
36 protected:
37  class RAIIHandle
38  {
39  public:
40  DISABLE_COPY(RAIIHandle)
41 
42  public:
43  RAIIHandle();
44  RAIIHandle(RAIIHandle &&rhs) noexcept;
46  handle(h) {}
47  ~RAIIHandle();
48  RAIIHandle &operator=(RAIIHandle &&rhs) noexcept;
50  operator bool() const noexcept { return isEmpty(this->handle); }
51  void detach();
53 
55 
56  static bool isEmpty(const hebench::APIBridge::Handle &h) noexcept;
57  };
58 
59  PartialBenchmarkCategory(std::shared_ptr<Engine> p_engine,
60  const IBenchmarkDescriptor::DescriptionToken &description_token);
61 
67  virtual IDataLoader::Ptr getDataset() const = 0;
93  virtual bool validateResult(IDataLoader::Ptr dataset,
94  const std::uint64_t *param_data_pack_indices,
95  const std::vector<hebench::APIBridge::NativeDataBuffer *> &outputs,
96  hebench::APIBridge::DataType data_type) const;
122  virtual void logResult(std::ostream &os,
123  IDataLoader::Ptr dataset,
124  const std::uint64_t *param_data_pack_indices,
125  const std::vector<hebench::APIBridge::NativeDataBuffer *> &outputs,
126  hebench::APIBridge::DataType data_type) const;
127 };
128 
129 } // namespace TestHarness
130 } // namespace hebench
131 
132 #endif // defined _HEBench_Harness_Benchmark_Category_H_0596d40a3cce4b108a81595c50eb286d
Token returned by a successful call to IBenchmarkDescriptor::matchBenchmarkDescriptor().
std::shared_ptr< IDataLoader > Ptr
static bool isEmpty(const hebench::APIBridge::Handle &h) noexcept
virtual IDataLoader::Ptr getDataset() const =0
Dataset to be used for operations previously initialized during creation of this object.
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.
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.
PartialBenchmarkCategory(std::shared_ptr< Engine > p_engine, const IBenchmarkDescriptor::DescriptionToken &description_token)
std::shared_ptr< PartialBenchmarkCategory > Ptr
DataType
Defines data types for a workload.
Definition: types.h:379
std::int32_t ErrorCode
Return value for API bridge functions.
Definition: types.h:34
Structure to contain flexible data.
Definition: types.h:552