HEBench
generic_wl_benchmark.h
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #pragma once
6 
8 
9 #include <array>
10 
12 
13 class ExampleEngine;
14 
15 class ExampleBenchmarkDescription : public hebench::cpp::BenchmarkDescription
16 {
17 public:
18  HEBERROR_DECLARE_CLASS_NAME(ExampleBenchmarkDescription)
19 
20 public:
21  // This workload requires 7 workload parameters
22  static constexpr std::uint64_t NumWorkloadParams = 7;
23  ExampleBenchmarkDescription(hebench::APIBridge::Category category);
24  ~ExampleBenchmarkDescription() override;
25 
27  const hebench::APIBridge::WorkloadParams *p_params) override;
28  void destroyBenchmark(hebench::cpp::BaseBenchmark *p_bench) override;
29 };
30 
31 class ExampleBenchmark : public hebench::cpp::BaseBenchmark
32 {
33 public:
34  HEBERROR_DECLARE_CLASS_NAME(ExampleBenchmark)
35 
36 public:
37  static constexpr std::int64_t tag = 0x1;
38 
39  ExampleBenchmark(ExampleEngine &engine,
41  const hebench::APIBridge::WorkloadParams &bench_params);
42  ~ExampleBenchmark() override;
43 
45  void decode(hebench::APIBridge::Handle encoded_data, hebench::APIBridge::DataPackCollection *p_native) override;
48 
49  hebench::APIBridge::Handle load(const hebench::APIBridge::Handle *p_local_data, std::uint64_t count) override;
50  void store(hebench::APIBridge::Handle remote_data,
51  hebench::APIBridge::Handle *p_local_data, std::uint64_t count) override;
52 
54  const hebench::APIBridge::ParameterIndexer *p_param_indexers) override;
55 
56  std::int64_t classTag() const override { return BaseBenchmark::classTag() | ExampleBenchmark::tag; }
57 
58 private:
59  static constexpr std::uint64_t ParametersCount = 2; // number of parameters for this operation
60  static constexpr std::uint64_t ResultComponentsCount = 3; // number of components of result for this operation
61 
62  // InternalInputData[input_param_index][input_sample][element]
63  typedef std::array<std::vector<std::vector<double>>, ParametersCount> InternalInputData;
64  // InternalResultData[result_sample][result_component][element]
65  typedef std::vector<std::array<std::vector<double>, ResultComponentsCount>> InternalResultData;
66 };
67 
Top level opaque benchmark class.
Definition: benchmark.hpp:143
virtual hebench::APIBridge::Handle load(const hebench::APIBridge::Handle *p_local_data, std::uint64_t count)=0
virtual hebench::APIBridge::Handle decrypt(hebench::APIBridge::Handle encrypted_data)=0
virtual void store(hebench::APIBridge::Handle remote_data, hebench::APIBridge::Handle *p_local_data, std::uint64_t count)=0
virtual hebench::APIBridge::Handle encode(const hebench::APIBridge::DataPackCollection *p_parameters)=0
std::int64_t classTag() const override
Retrieves the tag of the class to which this object belongs.
Definition: benchmark.hpp:199
virtual hebench::APIBridge::Handle encrypt(hebench::APIBridge::Handle encoded_data)=0
virtual void decode(hebench::APIBridge::Handle encoded_data, hebench::APIBridge::DataPackCollection *p_native)=0
virtual hebench::APIBridge::Handle operate(hebench::APIBridge::Handle h_remote_packed, const hebench::APIBridge::ParameterIndexer *p_param_indexers, std::uint64_t indexers_count)=0
Base class that encapsulates common behavior of backend engines.
Definition: engine.hpp:70
Base class for objects representing a specific benchmark based on an HEBench benchmark descriptor.
Definition: benchmark.hpp:36
virtual void destroyBenchmark(BaseBenchmark *p_bench)=0
Destroys and frees resources held by a BaseBenchmark (or derived) object previously created by create...
virtual BaseBenchmark * createBenchmark(BaseEngine &engine, const hebench::APIBridge::WorkloadParams *p_params)=0
Instantiates the represented benchmark.
#define HEBERROR_DECLARE_CLASS_NAME(class_name)
Category
Defines all possible categories for each workload.
Definition: types.h:391
Defines a benchmark test.
Definition: types.h:527
Defines a collection of data packs.
Definition: types.h:624
Specifies the parameters for a workload.
Definition: types.h:363
Structure to contain flexible data.
Definition: types.h:552