-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.h
321 lines (248 loc) · 10.6 KB
/
constants.h
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#pragma once
#include <iostream>
#include <filesystem>
#include <fstream>
#include <chrono>
// SyCL specific includes
#include <CL/sycl.hpp>
#include <array>
#include <sys/time.h>
#include <stdlib.h>
// #include "intel_noinit_fix.h"
const int ACAT_START_TEST_INDEX = 1;
const int ACAT_STOP_TEST_INDEX = 2;
const int ACAT_RUN_COUNT = 1;
/*const COMM TEMP ACAT*/ int ACAT_REPEAT_LOAD_COUNT = 10; // TODO : remettre 10, 100 c'est trop loong ! (1 pour test, 2022-09-30)
#define DATA_TYPE unsigned int // TODO : try with unsigned int
using data_type = DATA_TYPE;
//using data_type_sum = unsigned long long;
enum sycl_mode {shared_USM, device_USM, host_USM, accessors, glibc};
//enum dataset_type {implicit_USM, device_USM, host_USM, accessors};
unsigned long long PARALLEL_FOR_SIZE;// = 1024 * 32 * 8;// = M ; work items number
unsigned long long VECTOR_SIZE_PER_ITERATION;// = 1; // = L ; vector size per workitem (i.e. parallel_for task) = nb itérations internes par work item
unsigned long long BASE_VECTOR_SIZE_PER_ITERATION; // updated in list_devices()
sycl_mode CURRENT_MODE = sycl_mode::device_USM;
int MEMCOPY_IS_SYCL = 1;
int SIMD_FOR_LOOP = 1;
constexpr int USE_NAMED_KERNEL = 1; // Sandor does not support anonymous kernels.
constexpr bool KEEP_SAME_DATASETS = true;
int USE_HOST_SYCL_BUFFER_DMA = 0;
bool ERR_DEVICE_NOT_FOUND = true;
#define DATA_VERSION 7
#define DATA_VERSION_TRACCC 108 // 105
// number of diffrent datasets
#define DATASET_NUMBER 1
#define CHECK_SIMD_CPU false
#define INPUT_DATA_LENGTH PARALLEL_FOR_SIZE * VECTOR_SIZE_PER_ITERATION
#define OUTPUT_DATA_LENGTH PARALLEL_FOR_SIZE
#define INPUT_DATA_SIZE INPUT_DATA_LENGTH * sizeof(DATA_TYPE)
#define OUTPUT_DATA_SIZE OUTPUT_DATA_LENGTH * sizeof(DATA_TYPE)
// faire un repeat sur les mêmes données pour essayer d'utiliser le cache
// hypothèse : les données sont évincées du cache avant de pouvoir y avoir accès
// observation : j'ai l'impression d'être un peu en train de me perdre dans les explorations,
// avoir une liste pour prioriser ce que je dois faire et
// SEE main on bench.cpp
// SEE main on bench.cpp
// SEE main on bench.cpp
// SEE main on bench.cpp
// SEE main on bench.cpp
// SEE main on bench.cpp
// SEE main on bench.cpp
// number of iterations - no realloc to make it go faster
int REPEAT_COUNT_REALLOC;// défini dans le main (3) - nombre de fois que le test doit être lancé (défini dans le main)
int REPEAT_COUNT_ONLY_PARALLEL; // défini dans le main (0)
// Warmup count : nombre d'itérations non comptabilisées pour ne pas mesurer
// les évènements réalisés en lazy.
int REPEAT_COUNT_ONLY_PARALLEL_WARMUP_COUNT = 0; // 4 défini dans le main (0)
const bool FORCE_EXECUTION_ON_NAMED_DEVICE = true; // go const ?
std::string MUST_RUN_ON_DEVICE_NAME = "<unknown device>"; //"Intel(R) UHD Graphics 620 [0x5917]"; //std::string("s");
// How many times the sum should be repeated
// (to test caches and data access speed)
uint REPEAT_COUNT_SUM = 1;
//#define OUTPUT_FILE_NAME "sh_output_bench_h53.shared_txt"
//#define OUTPUT_FILE_NAME "msi_h60_L_M_128MiB_O0.t"
//#define OUTPUT_FILE_NAME "msi_L_M_512MiB_O2_SIMD_2.t"
//#define OUTPUT_FILE_NAME "sandor_L_M_6GiB_O2_SIMD_2.t"
//#define OUTPUT_FILE_NAME "msi_L_M_128MiB_O2_SIMD.t"
//#define OUTPUT_FILE_NAME "sandor_L_M_6GiB_O2.t"
//#define OUTPUT_FILE_NAME "msi_simd_1GiB_O2.t"
//#define OUTPUT_FILE_NAME "msi_simd_1GiB_O2_debug.temp"
//#define OUTPUT_FILE_NAME "sandor_simd_6GiB_O2.t"
//#define OUTPUT_FILE_NAME "sandor_simd_6GiB_O2_debug_simd_temp.t"
//#define OUTPUT_FILE_NAME "sandor_simd_8GiB_O2_debug_simd_temp.t"
std::string BENCHMARK_VERSION = "ubench" + std::to_string(DATA_VERSION); // Sandor compatible v05
std::string BENCHMARK_VERSION_TRACCC = "sparseccl" + std::to_string(DATA_VERSION_TRACCC);
std::string DISPLAY_VERSION = BENCHMARK_VERSION_TRACCC + " - TRACCC-016";
// Not used anymore
//std::string TRACCC_OUT_FNAME = "tracccMemLocStrat7_sansGraphPtr";
// nombre de fois qu'il faut répéter le chargement des données
unsigned int base_traccc_repeat_load_count = 1; // actualisé dans utils.h : selector_list_devices
unsigned int traccc_repeat_load_count = 1;
int traccc_SPARSITY_MIN = 0;
int traccc_SPARSITY_MAX = 100000;
bool traccc_sparsity_ignore = true;
struct s_runtime_environment {
public:
std::string computer_name;
std::string device_name;
int device_score;
int repeat_load_count = 10; // 100 should be good
int runs_count = 1;
// micro-benchmark
int total_elements = 1024L * 1024L * 128L; // 128 milions elements * 4 bytes => 512 MiB
int workitem_L = 128; // nombre of elements per workitem (default = 128)
std::string get_size_str() {
uint64_t size_in_bytes = total_elements * sizeof(data_type);
if (size_in_bytes < 1024) return std::to_string(size_in_bytes) + std::string("B");
if (size_in_bytes < 1024*1024) return std::to_string(size_in_bytes/1024) + std::string("KiB");
if (size_in_bytes < 1024*1024*1024) return std::to_string(size_in_bytes/(1024*1024)) + std::string("MiB");
return std::to_string(size_in_bytes/(1024*1024*1024)) + std::string("GiB");
}
// Defined as global variables
// const int ACAT_START_TEST_INDEX = 1;
// const int ACAT_STOP_TEST_INDEX = 2;
// const int ACAT_RUN_COUNT = 1;
};
s_runtime_environment runtime_environment;
// OUTPUT_FILE_NAME is now obsolete
std::string OUTPUT_FILE_NAME = "thinkpad_dma_1GiB_O2.t";
//#define OUTPUT_FILE_NAME "msi_dma_1GiB_O2.t"
//#define OUTPUT_FILE_NAME "sandor_dma_1GiB_O2.t"
//#define OUTPUT_FILE_NAME "msi_dma_512MiB_O2.t"
//#define OUTPUT_FILE_NAME "msi_alloc_1GiB_O2.t"
//#define OUTPUT_FILE_NAME "sandor_alloc_6GiB_O2.t"
//#define OUTPUT_FILE_NAME "sandor_h60_L_M_4GiB_O2.t"
//#define OUTPUT_FILE_NAME "msi_h60_alloclib_1GiB_O2.t"
//#define OUTPUT_FILE_NAME "msi_h60_simd_1GiB_O2_20pts.t"
//#define OUTPUT_FILE_NAME "T580_h60_L_M_128MiB.t"
//#define OUTPUT_FILE_NAME "T580_h60_simd_128MiB.t"
//const long long total_elements = 1024L * 1024L * 256L * 8L; // 8 GiB
//const long long total_elements = 1024L * 1024L * 256L * 6L; // 6 GiB
long long total_elements = 1024L * 1024L * 256L; // 1 GiB
std::string g_size_str = "0MiB";
//const long long total_elements = 1024L * 1024L * 128L; // 512 MiB
// 256 => 1 GiB
// 128 => 512 MiB ;
// 32 => 128 MiB ;
// 256 * 4 bytes = 1 GiB.
// 32 * 4 bytes = 128 MiB.
// /!\ WARNING : do not forget to change to the desired function in the main
// of bench.cpp !
std::string ver_indicator = std::string("13d");
// ver_prefix is now obsolete
std::string ver_prefix = OUTPUT_FILE_NAME + std::string(" - " + ver_indicator); // "X42"
struct s_computer {
std::string fullName, toFileName, deviceName;
uint repeat_load_count = 0;
long long total_elements = 0;
std::string size_str = "0MiB";
uint L = 1;
};
const uint g_computer_count = 7;
s_computer g_computers[g_computer_count];
void init_computers() {
s_computer * c;
uint ci = 0;
// 1
c = &g_computers[ci++];
c->fullName = "Thinkpad";
c->toFileName = "thinkpad";
c->deviceName = "Intel(R) UHD Graphics 620 [0x5917]";
c->repeat_load_count = 1;
c->total_elements = 1024L * 1024L * 128L; // 128 milions elements * 4 bytes => 512 MiB
c->size_str = "512MiB";
c->L = 128;
// 2
c = &g_computers[ci++];
c->fullName = "MSI_Intel";
c->toFileName = "msiIntel";
c->deviceName = "???";
c->repeat_load_count = 1;
c->total_elements = 1024L * 1024L * 128L; // 128 milions elements * 4 bytes => 512 MiB
c->size_str = "512MiB";
c->L = 128;
// 3
c = &g_computers[ci++];
c->fullName = "MSI_Nvidia";
c->toFileName = "msiNvidia";
c->deviceName = "NVIDIA GeForce GTX 960M";
c->repeat_load_count = 1;
c->total_elements = 1024L * 1024L * 128L; // 128 milions elements * 4 bytes => 512 MiB
c->size_str = "512MiB";
c->L = 128;
// 4
c = &g_computers[ci++];
c->fullName = "Sandor";
c->toFileName = "sandor";
c->deviceName = "Quadro RTX 5000";
c->repeat_load_count = 100; // TEMP ACAT
c->total_elements = 1024L * 1024L * 256L * 6L; // 256 milions elements * 4 bytes => 1 GiB ; *6 => 6 GiB
c->size_str = "6GiB";
c->L = 128;
// 5
c = &g_computers[ci++];
c->fullName = "Blop_Intel";
c->toFileName = "blopIntel";
c->deviceName = "????";
c->repeat_load_count = 1;
c->total_elements = 1024L * 1024L * 128L; // 128 milions elements * 4 bytes => 512 MiB
c->size_str = "512MiB";
c->L = 128;
// 6
c = &g_computers[ci++];
c->fullName = "Blop_Nvidia";
c->toFileName = "blopNvidia";
c->deviceName = "GeForce GTX 780";//"NVIDIA GeForce GTX 780";
c->repeat_load_count = 10; // benchs ACAT
c->total_elements = 1024L * 1024L * 128L; // 128 milions elements * 4 bytes => 512 MiB
c->size_str = "512MiB";
c->L = 128;
// 7
c = &g_computers[ci++];
c->fullName = "ls-cassidi";
c->toFileName = "cassidi";
c->deviceName = "NVIDIA RTX A6000";
c->repeat_load_count = 10; // benchs ACAT
c->total_elements = 1024L * 1024L * 256L * 6L; // 256 milions elements * 4 bytes => 1 GiB ; *6 => 6 GiB
c->size_str = "6GiB";
c->L = 128;
}
std::string get_computer_name(uint computer_id) {
if ( (computer_id > g_computer_count) || (computer_id == 0) )
return "unknown_computer_id" + std::to_string(computer_id);
return g_computers[computer_id - 1].fullName;
/*switch (computer_id) {
case 1 : return "Thinkpad";
case 2 : return "MSI_Intel";
case 3 : return "MSI_Nvidia";
case 4 : return "Sandor";
case 5 : return "Blop_Intel";
case 6 : return "Blop_Nvidia";
default : return "unknown_computer";
}*/
}
/// For output file name.
std::string get_computer_name_ofile(uint computer_id) {
if ( (computer_id > g_computer_count) || (computer_id == 0) )
return "unknownComputerId" + std::to_string(computer_id);
return g_computers[computer_id - 1].toFileName;
/*switch (computer_id) {
case 1 : return "thinkpad";
case 2 : return "msiIntel";
case 3 : return "msiNvidia";
case 4 : return "sandor";
case 5 : return "blopIntel";
case 6 : return "blopNvidia";
default : return "unknownComputer";
}*/
}
std::string get_computer_device_name(uint computer_id) {
if ( (computer_id > g_computer_count) || (computer_id == 0) )
return "unknown_device_name_computer_id" + std::to_string(computer_id);
return g_computers[computer_id - 1].deviceName;
}
uint get_computer_repeat_load_count(uint computer_id) {
if ( (computer_id > g_computer_count) || (computer_id == 0) )
return 0;
return g_computers[computer_id - 1].repeat_load_count;
}