HEBench
hebench_engine.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_Engine_H_0596d40a3cce4b108a81595c50eb286d
6 #define _HEBench_Harness_Engine_H_0596d40a3cce4b108a81595c50eb286d
7 
8 #include <memory>
9 #include <string>
10 #include <vector>
11 
13 #include "hebench/modules/general/include/nocopy.h"
14 #include "hebench/modules/logging/include/logging.h"
15 
18 
19 namespace hebench {
20 namespace TestHarness {
21 
22 class Engine : public std::enable_shared_from_this<Engine>
23 {
24 public:
25  DISABLE_COPY(Engine)
26  DISABLE_MOVE(Engine)
27 private:
28  IL_DECLARE_CLASS_NAME(Engine)
29 
30 public:
31  typedef std::shared_ptr<Engine> Ptr;
32 
46  const hebench::APIBridge::BenchmarkDescriptor &completed_descriptor);
47 
48  std::string getErrorDescription(hebench::APIBridge::ErrorCode err_code) const;
49  void validateRetCode(hebench::APIBridge::ErrorCode err_code, bool last_error = true) const;
58  static Engine::Ptr create(const std::vector<std::int8_t> &data);
59 
60  virtual ~Engine();
61 
62  std::string getSchemeName(hebench::APIBridge::Scheme s) const;
65  std::string getExtraDescription(hebench::APIBridge::Handle h_bench_desc,
66  const std::vector<hebench::APIBridge::WorkloadParam> &w_params) const;
67 
71  std::size_t countBenchmarks() const { return m_h_bench_desc.size(); }
72 
109  const BenchmarkDescription::Configuration &config) const;
110 
118  std::vector<std::vector<hebench::APIBridge::WorkloadParam>> getDefaultWorkloadParams(std::size_t index) const;
119 
120  std::string getLastErrorDescription() const;
121 
122  const hebench::APIBridge::Handle &handle() const { return m_handle; }
123 
124 private:
126  // handles to backend registered benchmark descriptors in order of subscription
127  std::vector<hebench::APIBridge::Handle> m_h_bench_desc;
128  std::weak_ptr<IBenchmark> m_last_benchmark; // keeps track of whether a benchmark is already created
129 
130  Engine();
131  void init(const std::vector<std::int8_t> &data);
132 };
133 
134 } // namespace TestHarness
135 } // namespace hebench
136 
137 #endif // defined _HEBench_Harness_Engine_H_0596d40a3cce4b108a81595c50eb286d
static Engine::Ptr create(const std::vector< std::int8_t > &data)
Creates a new backend engine.
std::string getSecurityName(hebench::APIBridge::Scheme s, hebench::APIBridge::Security sec) const
IBenchmarkDescriptor::DescriptionToken::Ptr describeBenchmark(std::size_t index, const BenchmarkDescription::Configuration &config) const
Describes a benchmark workload that matches the specified description from the benchmarks registered ...
static void completeBenchmarkDescriptor(hebench::TestHarness::BenchmarkDescription::Backend &backend_description, const hebench::APIBridge::BenchmarkDescriptor &completed_descriptor)
Grants a guarded write access to hebench::TestHarness::BenchmarkDescription::Backend::m_descriptor::c...
std::shared_ptr< Engine > Ptr
std::vector< std::vector< hebench::APIBridge::WorkloadParam > > getDefaultWorkloadParams(std::size_t index) const
Retrieves the list of default parameters for a workload as specified by the backend.
std::size_t countBenchmarks() const
Number of benchmarks for which backend is registered to perform.
const hebench::APIBridge::Handle & handle() const
std::string getExtraDescription(hebench::APIBridge::Handle h_bench_desc, const std::vector< hebench::APIBridge::WorkloadParam > &w_params) const
void validateRetCode(hebench::APIBridge::ErrorCode err_code, bool last_error=true) const
std::string getErrorDescription(hebench::APIBridge::ErrorCode err_code) const
std::string getLastErrorDescription() const
std::string getSchemeName(hebench::APIBridge::Scheme s) const
IBenchmark::Ptr createBenchmark(IBenchmarkDescriptor::DescriptionToken::Ptr p_token, hebench::Utilities::TimingReportEx &out_report)
Creates the the benchmark workload represented by the specified token.
std::shared_ptr< IBenchmark > Ptr
std::int32_t Scheme
Open-ended homomorphic encryption scheme ID.
Definition: types.h:406
std::int32_t Security
Open-ended homomorphic encryption scheme security ID.
Definition: types.h:412
std::int32_t ErrorCode
Return value for API bridge functions.
Definition: types.h:34
Defines a benchmark test.
Definition: types.h:527
Structure to contain flexible data.
Definition: types.h:552