HEBench
hebench_genericwl.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_DataGenerator_GenericWL_H_0596d40a3cce4b108a81595c50eb286d
6 #define _HEBench_Harness_DataGenerator_GenericWL_H_0596d40a3cce4b108a81595c50eb286d
7 
8 #include <array>
9 #include <memory>
10 #include <random>
11 #include <utility>
12 #include <vector>
13 
14 #include "hebench/modules/general/include/nocopy.h"
15 #include "hebench/modules/logging/include/logging.h"
16 
18 
21 
22 namespace hebench {
23 namespace TestHarness {
24 namespace GenericWL {
25 
27 {
28 public:
29  DISABLE_COPY(BenchmarkDescriptorCategory)
30  DISABLE_MOVE(BenchmarkDescriptorCategory)
31 private:
32  IL_DECLARE_CLASS_NAME(GenericWL::BenchmarkDescriptorCategory)
33 public:
34  static constexpr const char *BaseWorkloadName = "Generic";
35  static constexpr std::uint64_t WorkloadParameterMinCount = 4; // minimum number of parameters for this workload
38 
39  //static std::uint64_t fetchVectorSize(const std::vector<hebench::APIBridge::WorkloadParam> &w_params);
48  static std::pair<std::vector<std::uint64_t>, std::vector<std::uint64_t>> fetchIOVectorSizes(const std::vector<hebench::APIBridge::WorkloadParam> &w_params);
49 
50 public:
52  ~BenchmarkDescriptorCategory() override = default;
53 
54 protected:
56  const std::vector<hebench::APIBridge::WorkloadParam> &w_params) const override;
58  const Engine &engine,
59  const BenchmarkDescription::Backend &backend_desc,
60  const BenchmarkDescription::Configuration &config) const override;
61 };
62 
64 {
65 public:
66  DISABLE_COPY(DataLoader)
67  DISABLE_MOVE(DataLoader)
68 private:
69  IL_DECLARE_CLASS_NAME(GenericWL::DataLoader)
70 
71 public:
72  typedef std::shared_ptr<DataLoader> Ptr;
73 
74  static DataLoader::Ptr create(const std::vector<std::uint64_t> &input_sizes,
75  const std::vector<std::uint64_t> &max_batch_sizes,
76  const std::vector<std::uint64_t> &output_sizes,
78  const std::string &dataset_filename);
79 
80  ~DataLoader() override {}
81 
82 protected:
83  void computeResult(std::vector<hebench::APIBridge::NativeDataBuffer *> &result,
84  const std::uint64_t *param_data_pack_indices,
85  hebench::APIBridge::DataType data_type) override;
86 
87 private:
88  DataLoader();
89  void init(const std::vector<std::uint64_t> &input_sizes,
90  const std::vector<std::uint64_t> &max_batch_sizes,
91  const std::vector<std::uint64_t> &output_sizes,
93  const std::string &dataset_filename);
94 };
95 
96 } // namespace GenericWL
97 } // namespace TestHarness
98 } // namespace hebench
99 
100 #endif // defined _HEBench_Harness_DataGenerator_GenericWL_H_0596d40a3cce4b108a81595c50eb286d
void completeWorkloadDescription(WorkloadDescriptionOutput &output, const Engine &engine, const BenchmarkDescription::Backend &backend_desc, const BenchmarkDescription::Configuration &config) const override
Completes the description for the matched benchmark.
static std::pair< std::vector< std::uint64_t >, std::vector< std::uint64_t > > fetchIOVectorSizes(const std::vector< hebench::APIBridge::WorkloadParam > &w_params)
Retrieves details about the input parameters and results of the generic operation based on the specif...
bool matchBenchmarkDescriptor(const hebench::APIBridge::BenchmarkDescriptor &bench_desc, const std::vector< hebench::APIBridge::WorkloadParam > &w_params) const override
Determines if the represented benchmark can perform the workload described by a specified HEBench ben...
static constexpr hebench::APIBridge::WorkloadParamType::WorkloadParamType WorkloadParameterType
static DataLoader::Ptr create(const std::vector< std::uint64_t > &input_sizes, const std::vector< std::uint64_t > &max_batch_sizes, const std::vector< std::uint64_t > &output_sizes, hebench::APIBridge::DataType data_type, const std::string &dataset_filename)
void computeResult(std::vector< hebench::APIBridge::NativeDataBuffer * > &result, const std::uint64_t *param_data_pack_indices, hebench::APIBridge::DataType data_type) override
Computes result of the operation on the input data given the of the input sample.
Provides boilerplate implementation to common methods of interface IBenchmarkDescription and implemen...
Bundles values that need to be filled by a workload during completeWorkloadDescription().
WorkloadParamType
Defines the possible data types for a workload flexible parameter.
Definition: types.h:303
@ UInt64
64 bits unsigned integers.
Definition: types.h:305
DataType
Defines data types for a workload.
Definition: types.h:379
Defines a benchmark test.
Definition: types.h:527