14 #include "hebench/modules/timer/include/timer.h"
17 #include "hebench/modules/general/include/hebench_math_utils.h"
20 #include "../include/hebench_simple_set_intersection_o.h"
23 namespace TestHarness {
31 bool BenchmarkDescriptor::m_b_registered =
35 const std::vector<hebench::APIBridge::WorkloadParam> &w_params)
const
37 assert(m_b_registered);
65 std::uint64_t sample_size_fallback =
69 std::uint64_t result_set_size = std::min(set_size.at(0), set_size.at(1));
70 std::uint64_t result_batch_size =
78 ss <<
", , Z = Intersect(X, Y)" << std::endl
79 <<
", , , Items in set, Batch size, Elements per item" << std::endl;
81 ss <<
", , X, " << set_size.at(0) <<
", " << batch_sizes[0] <<
", " << set_size.at(2) << std::endl;
83 ss <<
", , Y, " << set_size.at(1) <<
", " << batch_sizes[1] <<
", " << set_size.at(2) << std::endl;
85 ss <<
", , Z, " << result_set_size <<
", " << result_batch_size <<
", " << set_size.at(2) << std::endl;
93 assert(m_b_registered);
98 retval =
new Benchmark(p_engine, description_token);
112 assert(m_b_registered);
121 Benchmark::Benchmark(std::shared_ptr<Engine> p_engine,
129 hebench::Common::EventTimer timer;
130 hebench::Common::TimingReportEvent::Ptr p_timing_event;
132 std::stringstream ss;
136 std::uint64_t sample_size_fallback =
144 sample_size_fallback,
147 std::cout <<
IOS_MSG_INFO << hebench::Logging::GlobalLogger::log(
"Preparing workload.") << std::endl;
150 m_k_count = set_size.at(2);
156 std::cout <<
IOS_MSG_INFO << hebench::Logging::GlobalLogger::log(
"Generating data...") << std::endl;
158 batch_sizes[0], batch_sizes[1],
160 this->getBackendDescription().descriptor.data_type);
164 std::stringstream ss;
165 ss <<
"Loading data from external dataset: " << std::endl
167 std::cout <<
IOS_MSG_INFO << hebench::Logging::GlobalLogger::log(ss.str()) << std::endl;
170 batch_sizes[0], batch_sizes[1],
172 this->getBackendDescription().descriptor.data_type,
173 this->getBenchmarkConfiguration().dataset_filename);
175 p_timing_event = timer.stop<std::milli>();
177 ss = std::stringstream();
178 ss <<
"Total data loaded: " << m_data->getTotalDataLoaded() <<
" bytes";
179 std::cout <<
IOS_MSG_DONE << hebench::Logging::GlobalLogger::log(ss.str()) << std::endl;
180 ss = std::stringstream();
181 ss <<
"Elapsed wall time: " << p_timing_event->elapsedWallTime<std::milli>() <<
" ms";
182 std::cout <<
IOS_MSG_INFO << hebench::Logging::GlobalLogger::log(ss.str()) << std::endl;
183 ss = std::stringstream();
184 ss <<
"Elapsed CPU time: " << p_timing_event->elapsedCPUTime<std::milli>() <<
" ms";
185 std::cout <<
IOS_MSG_INFO << hebench::Logging::GlobalLogger::log(ss.str()) << std::endl;
189 const std::uint64_t *param_data_pack_indices,
190 const std::vector<hebench::APIBridge::NativeDataBuffer *> &outputs,
197 param_data_pack_indices,
const hebench::APIBridge::BenchmarkDescriptor & descriptor
Benchmark backend descriptor, as retrieved by backend, corresponding to the registration handle h_des...
Specifies a benchmark configuration.
std::uint64_t fallback_default_sample_size
Default sample size to be used if a specific size is not specified in the default_sample_sizes collec...
std::vector< std::uint64_t > default_sample_sizes
Default sample size for each operation parameter.
std::vector< hebench::APIBridge::WorkloadParam > w_params
Set of arguments for workload parameters.
std::string dataset_filename
File containing data for the benchmark. If empty string, benchmarks that can auto generate the datase...
static bool registerSupportedBenchmark(std::shared_ptr< IBenchmarkDescriptor > p_desc_obj)
Registers a benchmark description object that represents one of the supported workloads.
Base class for workload benchmarks in the offline category.
Token returned by a successful call to IBenchmarkDescriptor::matchBenchmarkDescriptor().
std::shared_ptr< IDataLoader > Ptr
std::string workload_header
Workload specific information to be added to the report header.
static std::uint64_t computeSampleSizes(std::uint64_t *sample_sizes, std::size_t param_count, const std::vector< std::uint64_t > &config_sample_sizes, const hebench::APIBridge::BenchmarkDescriptor &bench_desc, std::uint64_t default_sample_size_fallback, bool force_config)
Extracts the batch sizes for a workload from a specified HEBench API benchmark descriptor.
static bool getForceConfigValues()
Specifies whether frontend will override backend descriptors using configuration data or not.
std::size_t operation_params_count
Number of parameters for the represented workload operation.
hebench::APIBridge::BenchmarkDescriptor concrete_descriptor
Benchmark descriptor completed with concrete values assigned to configurable fields.
Bundles values that need to be filled by a workload during completeWorkloadDescription().
Base class for benchmarks.
const BenchmarkDescription::Backend & getBackendDescription() const
Allows read-only access to this benchmark backend description.
const BenchmarkDescription::Configuration & getBenchmarkConfiguration() const
Allows read-only access to this benchmark configuration.
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::array< std::uint64_t, BenchmarkDescriptorCategory::WorkloadParameterCount > fetchSetSize(const std::vector< hebench::APIBridge::WorkloadParam > &w_params)
static constexpr std::uint64_t OpResultCount
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 std::uint64_t OpParameterCount
static DataLoader::Ptr create(std::uint64_t set_size_x, std::uint64_t set_size_y, std::uint64_t batch_size_x, std::uint64_t batch_size_y, std::uint64_t element_size_k, hebench::APIBridge::DataType data_type)
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.
void destroyBenchmark(hebench::TestHarness::PartialBenchmark *p_bench) override
Destroys an object returned by createBenchmark().
hebench::TestHarness::PartialBenchmark * createBenchmark(std::shared_ptr< Engine > p_engine, const DescriptionToken &description_token) override
Creates the represented IBenchmark object that can perform the workload specified by the HEBench benc...
static constexpr std::uint64_t DefaultBatchSize
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...
bool validateResult(IDataLoader::Ptr dataset, const std::uint64_t *param_data_pack_indices, const std::vector< hebench::APIBridge::NativeDataBuffer * > &p_outputs, hebench::APIBridge::DataType data_type) const override
Validates the result of an operation against the ground truth.
void init() override
Initializes the partial benchmark members.
DataType
Defines data types for a workload.
CategoryParams cat_params
Parameters for the category.
Category category
Category for the benchmark.
Defines a benchmark test.
bool validateResult(IDataLoader::Ptr dataset, const std::uint64_t *param_data_pack_indices, const std::vector< hebench::APIBridge::NativeDataBuffer * > &p_outputs, std::uint64_t k_count, hebench::APIBridge::DataType data_type)