-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbench.hpp
98 lines (85 loc) · 1.91 KB
/
bench.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#pragma once
#include <stdexcept>
#include <string>
#include <vector>
namespace DwarfBench {
/**
* @brief Dwarfs list enum
*
*/
enum Dwarf {
Scan,
Join,
GroupBy,
Sort,
};
/**
* @brief Device type for execution settings
*
*/
enum DeviceType { CPU, GPU };
/**
* @brief Measurements got from execution
*
* @var Measurement::dataSize how many bytes were used during execution
* @var Measurement::microseconds how many microseconds did the execution last
*/
struct Measurement {
size_t dataSize;
size_t microseconds;
};
/**
* @brief Execution configuration
*
* @var RunConfig::device on which device to be executed
* @var RunConfig::inputSize data array size, ususally a column size in elements
* @var RunConfig::iterations number of iterations to run a bmark
* @var RunConfig::dwarf dwarf to run
*/
struct RunConfig {
DeviceType device;
size_t inputSize;
size_t iterations;
Dwarf dwarf;
};
/**
* @brief main class for execution
*
*/
class DwarfBench {
public:
DwarfBench() = default;
/**
* @brief make measurements of a Dwarf based on configuration
*
* @param conf sets the generated data size, the number of iterations, the
* device and the Dwarf to run
* @return std::vector<Measurement> measurements made by dwarfs. Each element
* corresponds to a single run.
*/
std::vector<Measurement> makeMeasurements(const RunConfig &conf);
private:
enum DwarfImpl {
ConstantExampleDPCPP,
DPLScan,
GroupBy,
GroupByLocal,
HashBuild,
HashBuildNonBitmask,
Join,
NestedLoopJoin,
Radix,
TBBSort,
JoinOmnisci
};
DwarfImpl dwarfToImpl(Dwarf dwarf);
std::string dwarfToString(DwarfImpl dwarf, DeviceType device);
};
class DwarfBenchException : public std::exception {
private:
std::string message_;
public:
explicit DwarfBenchException(const std::string &message);
const char *what() const noexcept override;
};
} // namespace DwarfBench