-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
646 lines (534 loc) · 20.6 KB
/
main.cpp
File metadata and controls
646 lines (534 loc) · 20.6 KB
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
#include "lqt.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <chrono>
#include <vector>
#include <utility>
#include "tbb/tbb.h"
using std::vector;
using std::pair;
using std::make_pair;
using std::cout;
using std::endl;
// generate a uniform random between min and max exclusive
static inline ord_t uniformFrand(const ord_t min, const ord_t max) {
const double r = (double)rand() / RAND_MAX;
return min + r * (max - min);
}
static inline void test_endian_2(const size_t len, const size_t threads) {
printf("test_endian_2\n");
// static_assert(sizeof(unsigned int) == 4, "sizeof(int) is not 4, fix the below code")
unsigned char a[4];
unsigned char* array = a;
// array[0] = 11
array[0] = 0x0;
array[0] = (array[0] << 2) | 0x1;
array[0] = (array[0] << 2) | 0x2;
array[0] = (array[0] << 2) | 0x3;
// array[1] = 10
array[1] = 0x3;
array[1] = (array[1] << 2) | 0x2;
array[1] = (array[1] << 2) | 0x1;
array[1] = (array[1] << 2) | 0x0;
// array[2] = 01
array[2] = 0x0;
array[2] = (array[2] << 2) | 0x3;
array[2] = (array[2] << 2) | 0x2;
array[2] = (array[2] << 2) | 0x1;
// array[3] = 00 00 00 00
array[3] = 0x3;
array[3] = (array[3] << 2) | 0x2;
array[3] = (array[3] << 2) | 0x0;
array[3] = (array[3] << 2) | 0x1;
unsigned int* iarray = (unsigned int*)array;
// unsigned int endian = (array[0] << 24) | (array[1] << 16) | (array[2] << 8) | array[3];
printf("endian: %u\n", *iarray);
}
static const size_t min = 1000;
static const size_t max = 1100;
/// caller takes ownership, must call delete[]
static inline lqt_point* create_points(const size_t len) {
lqt_point* points = new lqt_point[len];
for(int i = 0, end = len; i != end; ++i) {
points[i].x = uniformFrand(min, max);
points[i].y = uniformFrand(min, max);
points[i].key = i;
}
return points;
}
static inline void test_many(const size_t len, const size_t threads) {
printf("test_many\n");
lqt_point* points = create_points(len);
{
printf("creating nodes...\n");
size_t depth;
linear_quadtree lqt = lqt_nodify(points, len, min, max, min, max, &depth);
printf("sorting...\n");
lqt_sortify(lqt);
printf("\ndone\n");
lqt_print_nodes(lqt, false);
lqt_delete(lqt);
}
{
printf("cuda creating nodes...\n");
size_t depth;
linear_quadtree lqt = lqt_nodify_cuda(points, len, min, max, min, max, &depth);
printf("cuda sorting...\n");
lqt_sortify_cuda(lqt);
printf("\ncuda done\n");
lqt_print_nodes(lqt, false);
lqt_delete(lqt);
}
}
static inline void test_endian(const size_t len, const size_t threads) {
printf("test_endian\n");
typedef unsigned char uchar;
typedef unsigned long sort_t;
// const unsigned short esa8[8] = {7, 6, 5, 4, 3, 2, 1, 0}; ///< lookup table
//# define ENDIANSWAP8(a) (esa8[(a) % 8] + (a) / 8 * 8)
// const unsigned short esa4[4] = {3, 2, 1, 0}; ///< lookup table
//# define ENDIANSWAP4(a) (esa4[(a) % 4] + (a) / 4 * 4)
uchar chars[8];
chars[0] = 37;
chars[1] = 228;
chars[2] = 99;
chars[3] = 42;
// sort_t* ichars = (sort_t*)chars;
// sort_t val = *ichars;
// std::cout << "val " << val << std::endl;
// uchar newchars[4];
// for(int i = 0, end = sizeof(sort_t); i != end; ++i)
// newchars[i] = chars[ENDIANSWAP4(i)];
//
// ichars = (sort_t*)newchars;
// val = *ichars;
sort_t val = 0;
val = chars[3] | (chars[2] << 8) | (chars[1] << 16) | (chars[0] << 24);
printf("eval %lu\n", val);
}
static inline void test_few(const size_t len, const size_t threads) {
printf("test_few\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
points[0].x = 299.999;
points[0].y = 299.999;
points[0].key = 42;
points[1].x = 7.0;
points[1].y = 14.0;
points[1].key = 99;
{
printf("creating nodes...\n");
size_t depth;
linear_quadtree lqt = lqt_nodify(points, len,
min, max, min, max, &depth);
printf("sorting...\n");
lqt_sortify(lqt);
printf("\ndone\n");
lqt_print_nodes(lqt, true);
lqt_delete(lqt);
}
{
printf("cuda creating nodes...\n");
size_t depth;
linear_quadtree lqt = lqt_nodify_cuda(points, len,
min, max, min, max, &depth);
printf("cuda sorting...\n");
lqt_sortify_cuda(lqt);
printf("\ncuda done\n");
lqt_print_nodes(lqt, true);
}
}
static inline void test_time(const size_t len, const size_t threads) {
printf("test_time\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
size_t depth;
printf("cpu nodify...\n");
const clock_t start = clock();
linear_quadtree lqt = lqt_nodify(points, len,
min, max, min, max, &depth);
const clock_t end = clock();
const double elapsed_s = (end - start) / (double)CLOCKS_PER_SEC;
printf("cpu nodify time: %fs\n", elapsed_s);
lqt_delete(lqt);
// lqt and points not valid henceforth and hereafter.
printf("creating cuda points...\n");
lqt_point* cuda_points = create_points(len);
printf("gpu nodify...\n");
const clock_t start_cuda = clock();
linear_quadtree cuda_lqt = lqt_nodify_cuda(cuda_points, len,
min, max, min, max, &depth);
const clock_t end_cuda = clock();
const double elapsed_s_cuda = (end_cuda - start_cuda) / (double)CLOCKS_PER_SEC;
const double speedup = elapsed_s / elapsed_s_cuda;
printf("gpu nodify time: %fs\n", elapsed_s_cuda);
printf("gpu speedup: %f\n", speedup);
lqt_delete(cuda_lqt);
}
static inline void test_sorts(const size_t len, const size_t threads) {
printf("test_sorts\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("creating nodes...\n");
size_t depth;
linear_quadtree qt = lqt_nodify(points, len,
min, max, min, max, &depth);
linear_quadtree qt_cuda;
lqt_copy(&qt_cuda, &qt);
printf("sorting...\n");
lqt_sortify(qt);
printf("sorting cuda...\n");
lqt_sortify_cuda(qt_cuda);
printf("nodes:\n");
lqt_print_nodes(qt, false);
printf("cuda nodes:\n");
lqt_print_nodes(qt_cuda, false);
lqt_delete(qt);
lqt_delete(qt_cuda);
}
static inline void test_sort_time(const size_t len, const size_t threads) {
printf("test_sort_time\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("creating nodes...\n");
size_t depth;
linear_quadtree qt = lqt_nodify(points, len,
min, max, min, max, &depth);
linear_quadtree qt_cuda;
lqt_copy(&qt_cuda, &qt);
printf("sorting...\n");
const clock_t start = clock();
lqt_sortify(qt);
const clock_t end = clock();
const double elapsed_s = (end - start) / (double)CLOCKS_PER_SEC;
printf("sort time: %fs\n", elapsed_s);
printf("sorting cuda...\n");
const clock_t start_cuda = clock();
lqt_sortify_cuda(qt_cuda);
const clock_t end_cuda = clock();
const double elapsed_s_cuda = (end_cuda - start_cuda) / (double)CLOCKS_PER_SEC;
const double cuda_speedup = elapsed_s / elapsed_s_cuda;
printf("cuda sort time: %fs\n", elapsed_s_cuda);
printf("cuda speedup: %f\n", cuda_speedup);
lqt_delete(qt);
lqt_delete(qt_cuda);
}
static inline void test_unified_sorts(const size_t len, const size_t threads) {
printf("test_unified_sorts\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
lqt_point* points_cuda = new lqt_point[len];
memcpy(points_cuda, points, len * sizeof(lqt_point));
printf("points: %lu\n", len);
printf("creating quadtree...\n");
size_t depth;
linear_quadtree qt = lqt_create(points, len,
min, max, min, max, &depth);
printf("creating quadtree with CUDA...\n");
linear_quadtree qt_cuda = lqt_create_cuda(points_cuda, len,
min, max, min, max, &depth);
printf("nodes:\n");
lqt_print_nodes(qt, false);
printf("cuda nodes:\n");
lqt_print_nodes(qt_cuda, false);
lqt_delete(qt);
lqt_delete(qt_cuda);
}
static inline void test_unified(const size_t len, const size_t threads) {
printf("test_unified\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
lqt_point* points_cuda = new lqt_point[len];
memcpy(points_cuda, points, len * sizeof(lqt_point));
printf("points: %lu\n", len);
printf("creating quadtree...\n");
const clock_t start = clock();
size_t depth;
linear_quadtree qt = lqt_create(points, len,
min, max, min, max, &depth);
const clock_t end = clock();
const double elapsed_s = (end - start) / (double)CLOCKS_PER_SEC;
printf("cpu time: %fs\n", elapsed_s);
printf("ms per point: %f\n", 1000.0 * elapsed_s / len);
printf("creating quadtree with CUDA...\n");
const clock_t start_cuda = clock();
linear_quadtree qt_cuda = lqt_create_cuda(points_cuda, len,
min, max, min, max, &depth);
const clock_t end_cuda = clock();
const double elapsed_s_cuda = (end_cuda - start_cuda) / (double)CLOCKS_PER_SEC;
const double cuda_speedup = elapsed_s / elapsed_s_cuda;
printf("cuda time: %fs\n", elapsed_s_cuda);
printf("ms per cuda point: %f\n", 1000.0 * elapsed_s_cuda / len);
printf("cuda speedup: %f\n", cuda_speedup);
lqt_delete(qt);
lqt_delete(qt_cuda);
}
static inline void test_unified_cuda(const size_t len, const size_t threads) {
printf("test_unified_cuda\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("points: %lu\n", len);
size_t depth;
printf("creating quadtree with CUDA...\n");
const auto start = std::chrono::high_resolution_clock::now();
linear_quadtree qt = lqt_create_cuda(points, len, min, max, min, max, &depth);
const auto end = std::chrono::high_resolution_clock::now();
const auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "cpu time (ms): " << elapsed_ms << std::endl;
printf("ms per cuda point: %f\n", (double)elapsed_ms / len);
lqt_delete(qt);
}
static inline void test_unified_sisd(const size_t len, const size_t threads) {
printf("test_unified_sisd\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("points: %lu\n", len);
printf("creating quadtree...\n");
size_t depth;
const auto start = std::chrono::high_resolution_clock::now();
linear_quadtree_unified qt = lqt_create_sisd(points, len, min, max, min, max, &depth, threads);
const auto end = std::chrono::high_resolution_clock::now();
const auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "cpu time (ms): " << elapsed_ms << std::endl;
printf("ms per point: %f\n", (double)elapsed_ms / len);
lqt_delete_unified(qt);
}
enum sort_type_e {
st_tbb,
st_merge,
st_sample,
};
typedef linear_quadtree_unified (*create_func_t)(lqt_point* points, size_t len, ord_t xstart, ord_t xend, ord_t ystart, ord_t yend, size_t* depth, const size_t threads);
create_func_t get_create_func(sort_type_e sort_type) {
switch(sort_type) {
case st_tbb:
return &lqt_create_heterogeneous;
case st_merge:
return &lqt_create_heterogeneous_mergesort;
case st_sample:
return &lqt_create_heterogeneous_samplesort;
}
return &lqt_create_heterogeneous;
}
static inline void test_heterogeneous_withtype(const size_t len, const size_t threads, const sort_type_e sort_type) {
printf("test_heterogeneous_%s\n", sort_type == st_tbb ? "tbbsort" : (sort_type == st_merge ? "mergesort" : "samplesort"));
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("points: %lu\n", len);
printf("creating quadtree...\n");
create_func_t create_func = get_create_func(sort_type);
size_t depth;
const auto start = std::chrono::high_resolution_clock::now();
linear_quadtree_unified qt = create_func(points, len, min, max, min, max, &depth, threads);
const auto end = std::chrono::high_resolution_clock::now();
const auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "cpu time (ms): " << elapsed_ms << std::endl;
printf("ms per point: %f\n", (double)elapsed_ms / len);
lqt_delete_unified(qt);
}
static inline void test_heterogeneous(const size_t len, const size_t threads) {
test_heterogeneous_withtype(len, threads, st_tbb);
}
static inline void test_heterogeneous2(const size_t len, const size_t threads) {
test_heterogeneous_withtype(len, threads, st_merge);
}
static inline void test_heterogeneous3(const size_t len, const size_t threads) {
test_heterogeneous_withtype(len, threads, st_sample);
}
static inline void test_mergesort(const size_t len, const size_t threads) {
printf("test_mergesort\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("points: %lu\n", len);
printf("creating quadtree...\n");
size_t depth;
linear_quadtree_unified qt = lqt_create_heterogeneous_mergesort(points, len, min, max, min, max, &depth, threads);
printf("validating sort...\n");
bool failed = false;
for(size_t i = 0, end = qt.length - 1; i != end; ++i) {
if(qt.nodes[i].location > qt.nodes[i + 1].location) {
printf("mergesort failed: node %lu is greater than %lu: %lu > %lu\n", i, i + 1, qt.nodes[i].location, qt.nodes[i + 1].location);
failed = true;
}
}
if(!failed)
printf("mergesort validated: all points in order\n");
else
printf("mergesort failed\n");
lqt_delete_unified(qt);
}
static inline void test_pipelined(const size_t len, const size_t threads) {
const size_t PIPELINE_LEN = 10;
printf("test_pipelined\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("points: %lu\n", len);
vector<pair<lqt_point*, size_t>> pointses;
pointses.push_back(make_pair(points, len));
for(size_t i = 0, end = PIPELINE_LEN; i != end; ++i) {
lqt_point* morepoints = new lqt_point[len];
memcpy(morepoints, points, len * sizeof(lqt_point));
pointses.push_back(make_pair(morepoints, len));
}
printf("creating quadtree...\n");
const auto start = std::chrono::high_resolution_clock::now();
size_t depth;
vector<linear_quadtree_unified> trees = lqt_create_pipelined(pointses, min, max, min, max, &depth, threads);
const auto end = std::chrono::high_resolution_clock::now();
const auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "cpu time (ms): " << elapsed_ms << std::endl;
printf("ms per point: %f\n", (double)elapsed_ms / len);
for(auto&& tree : trees)
lqt_delete_unified(tree);
}
static inline void test_unpipelined_heterogeneous(const size_t len, const size_t threads) {
const size_t PIPELINE_LEN = 10;
printf("test_unpipelined_heterogeneous\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("points: %lu\n", len);
vector<pair<lqt_point*, size_t>> pointses;
pointses.push_back(make_pair(points, len));
for(size_t i = 0, end = PIPELINE_LEN; i != end; ++i) {
lqt_point* morepoints = new lqt_point[len];
memcpy(morepoints, points, len * sizeof(lqt_point));
pointses.push_back(make_pair(morepoints, len));
}
printf("creating quadtree...\n");
const auto start = std::chrono::high_resolution_clock::now();
vector<linear_quadtree_unified> trees;
size_t depth;
for(size_t i = 0, end = PIPELINE_LEN;i != end; ++i) {
trees.push_back(lqt_create_heterogeneous_mergesort(pointses[i].first, pointses[i].second, min, max, min, max, &depth, threads));
}
const auto end = std::chrono::high_resolution_clock::now();
const auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "cpu time (ms): " << elapsed_ms << std::endl;
printf("ms per point: %f\n", (double)elapsed_ms / len);
for(auto&& tree : trees)
lqt_delete_unified(tree);
}
static inline void test_unpipelined_cuda(const size_t len, const size_t threads) {
const size_t PIPELINE_LEN = 10;
printf("test_unpipelined_cuda\n");
printf("creating points...\n");
lqt_point* points = create_points(len);
printf("points: %lu\n", len);
vector<pair<lqt_point*, size_t>> pointses;
pointses.push_back(make_pair(points, len));
for(size_t i = 0, end = PIPELINE_LEN; i != end; ++i) {
lqt_point* morepoints = new lqt_point[len];
memcpy(morepoints, points, len * sizeof(lqt_point));
pointses.push_back(make_pair(morepoints, len));
}
printf("creating quadtree...\n");
const auto start = std::chrono::high_resolution_clock::now();
vector<linear_quadtree> trees;
size_t depth;
for(size_t i = 0, end = PIPELINE_LEN;i != end; ++i) {
trees.push_back(lqt_create_cuda(pointses[i].first, pointses[i].second, min, max, min, max, &depth));
}
const auto end = std::chrono::high_resolution_clock::now();
const auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "cpu time (ms): " << elapsed_ms << std::endl;
printf("ms per point: %f\n", (double)elapsed_ms / len);
for(auto&& tree : trees)
lqt_delete(tree);
}
void(*test_funcs[])(const size_t, const size_t threads) = {
test_endian_2,
test_many,
test_endian,
test_few,
test_time,
test_sorts,
test_sort_time,
test_unified,
test_unified_sorts,
test_heterogeneous,
test_unified_cuda,
test_unified_sisd,
test_mergesort,
test_heterogeneous2,
test_heterogeneous3,
test_pipelined,
test_unpipelined_heterogeneous,
test_unpipelined_cuda,
};
static const char* default_app_name = "mergesort";
const char* tests[][2] = {
{"test_endian_2" , "test endianness conversions between 4-byte array"},
{"test_many" , "print brief reports for many points"},
{"test_endian" , "test endian shifting in 4-byte array"},
{"test_few" , "print detailed reports for a few points"},
{"test_time" , "benchmark the time to create nodes using CPU vs CUDA"},
{"test_sorts" , "test the values produced by sorting with CPU vs CUDA"},
{"test_sort_time" , "benchmark the time to sort using CPU vs CUDA"},
{"test_unified" , "benchmark the time to create and sort using CPU vs CUDA"},
{"test_unified_sorts", "test the values produced by CPU vs CUDA with unified create+sort function"},
{"test_heterogeneous", "benchmark the time to create using CUDA and sort using tbb::parallel_sort"},
{"test_unified_cuda" , "benchmark the time to create and sort using CUDA"},
{"test_unified_sisd" , "benchmark the time to create CUDA and sort SISD (for comparison)"},
{"test_mergesort" , "validate the parallel mergesort function performs correctly"},
{"test_heterogeneous2", "benchmark the time to create using CUDA and sort using parallel_mergesort"},
{"test_heterogeneous3", "benchmark the time to create using CUDA and sort using parallel_samplesort"},
{"test_pipelined" , "benchmark time to create 10 pipelined trees"},
{"test_unpipelined_heterogeneous" , "benchmark time to create 10 trees heterogeneously without pipelining"},
{"test_unpipelined_cuda " , "benchmark time to create 10 trees with CUDA without pipelining"},
};
const size_t test_num = sizeof(tests) / (sizeof(const char*) * 2);
typedef struct {
bool success;
const char* app_name;
size_t test_num;
size_t array_size;
size_t threads;
} app_arguments;
static app_arguments parseArgs(const int argc, const char** argv) {
app_arguments args;
args.success = false;
if(argc < 1)
return args;
args.app_name = argv[0];
if(argc < 2)
return args;
args.test_num = strtol(argv[1], NULL, 10);
if(argc < 3)
return args;
args.array_size = strtol(argv[2], NULL, 10);
if(argc < 4)
return args;
args.threads = strtol(argv[3], NULL, 10);
args.success = true;
return args;
}
/// \param[out] msg
/// \param[out] msg_len
static void print_usage(const char* app_name) {
printf("usage: %s test_num array_size threads\n", strlen(app_name) == 0 ? default_app_name : app_name);
printf(" (threads is only used for heterogeneous test(s)\n");
printf("\n");
printf(" num test description\n");
for(size_t i = 0, end = test_num; i != end; ++i) {
printf(" %-3.1lu %-15.15s %s\n", i, tests[i][0], tests[i][1]);
}
printf("\n");
}
int main(const int argc, const char** argv) {
srand(time(NULL));
const app_arguments args = parseArgs(argc, argv);
if(!args.success) {
print_usage(args.app_name);
return 0;
}
// printf("tbb threads: %lu\n", tbb_num_default_thread());
// tbb_test_scheduler_init();
tbb::task_scheduler_init tbb_scheduler(args.threads);
test_funcs[args.test_num](args.array_size, args.threads);
printf("\n");
return 0;
}