-
Notifications
You must be signed in to change notification settings - Fork 908
/
nvbench_helpers.hpp
240 lines (211 loc) · 7.08 KB
/
nvbench_helpers.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/*
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <benchmarks/common/generate_input.hpp>
#include <benchmarks/io/cuio_common.hpp>
#include <cudf/io/types.hpp>
#include <cudf/types.hpp>
#include <nvbench/nvbench.cuh>
enum class data_type : int32_t {
INTEGRAL = static_cast<int32_t>(type_group_id::INTEGRAL),
INTEGRAL_SIGNED = static_cast<int32_t>(type_group_id::INTEGRAL_SIGNED),
FLOAT = static_cast<int32_t>(type_group_id::FLOATING_POINT),
BOOL8 = static_cast<int32_t>(cudf::type_id::BOOL8),
DECIMAL = static_cast<int32_t>(type_group_id::FIXED_POINT),
TIMESTAMP = static_cast<int32_t>(type_group_id::TIMESTAMP),
DURATION = static_cast<int32_t>(type_group_id::DURATION),
STRING = static_cast<int32_t>(cudf::type_id::STRING),
LIST = static_cast<int32_t>(cudf::type_id::LIST),
STRUCT = static_cast<int32_t>(cudf::type_id::STRUCT)
};
// NVBENCH_DECLARE_ENUM_TYPE_STRINGS macro must be used from global namespace scope
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
data_type,
[](data_type value) {
switch (value) {
case data_type::INTEGRAL: return "INTEGRAL";
case data_type::INTEGRAL_SIGNED: return "INTEGRAL_SIGNED";
case data_type::FLOAT: return "FLOAT";
case data_type::BOOL8: return "BOOL8";
case data_type::DECIMAL: return "DECIMAL";
case data_type::TIMESTAMP: return "TIMESTAMP";
case data_type::DURATION: return "DURATION";
case data_type::STRING: return "STRING";
case data_type::LIST: return "LIST";
case data_type::STRUCT: return "STRUCT";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
io_type,
[](auto value) {
switch (value) {
case io_type::FILEPATH: return "FILEPATH";
case io_type::HOST_BUFFER: return "HOST_BUFFER";
case io_type::PINNED_BUFFER: return "PINNED_BUFFER";
case io_type::DEVICE_BUFFER: return "DEVICE_BUFFER";
case io_type::VOID: return "VOID";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
cudf::io::compression_type,
[](auto value) {
switch (value) {
case cudf::io::compression_type::SNAPPY: return "SNAPPY";
case cudf::io::compression_type::GZIP: return "GZIP";
case cudf::io::compression_type::NONE: return "NONE";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
enum class uses_index : bool { YES, NO };
enum class uses_numpy_dtype : bool { YES, NO };
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
uses_index,
[](auto value) {
switch (value) {
case uses_index::YES: return "YES";
case uses_index::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
uses_numpy_dtype,
[](auto value) {
switch (value) {
case uses_numpy_dtype::YES: return "YES";
case uses_numpy_dtype::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
column_selection,
[](auto value) {
switch (value) {
case column_selection::ALL: return "ALL";
case column_selection::ALTERNATE: return "ALTERNATE";
case column_selection::FIRST_HALF: return "FIRST_HALF";
case column_selection::SECOND_HALF: return "SECOND_HALF";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
row_selection,
[](auto value) {
switch (value) {
case row_selection::ALL: return "ALL";
case row_selection::BYTE_RANGE: return "BYTE_RANGE";
case row_selection::NROWS: return "NROWS";
case row_selection::SKIPFOOTER: return "SKIPFOOTER";
case row_selection::STRIPES: return "STRIPES";
case row_selection::ROW_GROUPS: return "ROW_GROUPS";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
cudf::type_id,
[](auto value) {
switch (value) {
case cudf::type_id::EMPTY: return "EMPTY";
case cudf::type_id::TIMESTAMP_NANOSECONDS: return "TIMESTAMP_NANOSECONDS";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
enum class converts_strings : bool { YES, NO };
enum class uses_pandas_metadata : bool { YES, NO };
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
converts_strings,
[](auto value) {
switch (value) {
case converts_strings::YES: return "YES";
case converts_strings::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
uses_pandas_metadata,
[](auto value) {
switch (value) {
case uses_pandas_metadata::YES: return "YES";
case uses_pandas_metadata::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
enum class json_lines : bool { YES, NO };
enum class normalize_single_quotes : bool { YES, NO };
enum class normalize_whitespace : bool { YES, NO };
enum class mixed_types_as_string : bool { YES, NO };
enum class recovery_mode : bool { FAIL, RECOVER_WITH_NULL };
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
json_lines,
[](auto value) {
switch (value) {
case json_lines::YES: return "YES";
case json_lines::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
normalize_single_quotes,
[](auto value) {
switch (value) {
case normalize_single_quotes::YES: return "YES";
case normalize_single_quotes::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
normalize_whitespace,
[](auto value) {
switch (value) {
case normalize_whitespace::YES: return "YES";
case normalize_whitespace::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
mixed_types_as_string,
[](auto value) {
switch (value) {
case mixed_types_as_string::YES: return "YES";
case mixed_types_as_string::NO: return "NO";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })
NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
recovery_mode,
[](auto value) {
switch (value) {
case recovery_mode::FAIL: return "FAIL";
case recovery_mode::RECOVER_WITH_NULL: return "RECOVER_WITH_NULL";
default: return "Unknown";
}
},
[](auto) { return std::string{}; })