|
@@ -27,9 +27,9 @@ const size_t testLength[] = {
|
27
|
27
|
1ULL << 24,
|
28
|
28
|
1ULL << 29,
|
29
|
29
|
#else
|
30
|
|
- 1ULL << 31,
|
31
|
|
- 1ULL << 32,
|
32
|
|
- 1ULL << 33
|
|
30
|
+ 1ULL << 31, // 2G (4G)
|
|
31
|
+ 1ULL << 32, // 4G (8G)
|
|
32
|
+ 1ULL << 33 // 8G (16G)
|
33
|
33
|
#endif
|
34
|
34
|
};
|
35
|
35
|
|
|
@@ -74,6 +74,8 @@ enum GenerateDataTypes
|
74
|
74
|
GenUniform16,
|
75
|
75
|
GenUniform16Xor,
|
76
|
76
|
GenUniform8,
|
|
77
|
+ GenUniform4,
|
|
78
|
+ GenUniform1,
|
77
|
79
|
GenUniform8Xor,
|
78
|
80
|
GenNormal64,
|
79
|
81
|
GenNormal32,
|
|
@@ -132,8 +134,7 @@ TestResult TestUnit(int index)
|
132
|
134
|
case insun:
|
133
|
135
|
fn = [](ElementType* items, size_t numItems)
|
134
|
136
|
{
|
135
|
|
- // ERROR
|
136
|
|
- //SunSort::SSort(items, &items[0], &items[numItems - 1], std::less<ElementType>());
|
|
137
|
+ SunSort::SSort(items, &items[0], &items[numItems - 1], std::less<ElementType>());
|
137
|
138
|
};
|
138
|
139
|
break;
|
139
|
140
|
case prauser:
|
|
@@ -287,6 +288,28 @@ void RunTest(size_t size, GenerateDataTypes type)
|
287
|
288
|
}
|
288
|
289
|
}
|
289
|
290
|
break;
|
|
291
|
+ case GenUniform4:
|
|
292
|
+ if (1)
|
|
293
|
+ {
|
|
294
|
+ printf("Generating random data... (%zu bytes, type: Uniform8)\n", size);
|
|
295
|
+ std::uniform_int_distribution<uint16_t> dist(0, 0xff);
|
|
296
|
+ for (size_t i = 0, e = size / sizeof(uint32_t); i < e; ++i)
|
|
297
|
+ {
|
|
298
|
+ reinterpret_cast<uint32_t*>(data0.data())[i] = dist(re) & 0x7;
|
|
299
|
+ }
|
|
300
|
+ }
|
|
301
|
+ break;
|
|
302
|
+ case GenUniform1:
|
|
303
|
+ if (1)
|
|
304
|
+ {
|
|
305
|
+ printf("Generating random data... (%zu bytes, type: Uniform8)\n", size);
|
|
306
|
+ std::uniform_int_distribution<uint16_t> dist(0, 0xff);
|
|
307
|
+ for (size_t i = 0, e = size / sizeof(uint32_t); i < e; ++i)
|
|
308
|
+ {
|
|
309
|
+ reinterpret_cast<uint32_t*>(data0.data())[i] = dist(re) & 0x1;
|
|
310
|
+ }
|
|
311
|
+ }
|
|
312
|
+ break;
|
290
|
313
|
case GenNormal64:
|
291
|
314
|
if (1)
|
292
|
315
|
{
|
|
@@ -317,7 +340,7 @@ void RunTest(size_t size, GenerateDataTypes type)
|
317
|
340
|
DoSortTest<2>();
|
318
|
341
|
// 3 bytes
|
319
|
342
|
DoSortTest<3>();
|
320
|
|
- // 4 bytes
|
|
343
|
+ //4 bytes
|
321
|
344
|
DoSortTest<4>();
|
322
|
345
|
// 5 bytes
|
323
|
346
|
DoSortTest<5>();
|
|
@@ -355,6 +378,18 @@ int main()
|
355
|
378
|
testScore[prauser].error = 1;
|
356
|
379
|
testScore[witdrg].error = 1;
|
357
|
380
|
|
|
381
|
+ auto dataTypes = {
|
|
382
|
+ GenUniform32,
|
|
383
|
+ GenUniform16,
|
|
384
|
+ GenUniform16Xor,
|
|
385
|
+ GenUniform8,
|
|
386
|
+ GenUniform8Xor,
|
|
387
|
+ GenUniform4,
|
|
388
|
+ GenUniform1,
|
|
389
|
+ GenNormal64,
|
|
390
|
+ GenNormal32
|
|
391
|
+ };
|
|
392
|
+
|
358
|
393
|
auto PrintScore = [](int phase)
|
359
|
394
|
{
|
360
|
395
|
printf("------------ SCORE (%d/%d) --------------\n", phase, int(std::size(testLength)));
|
|
@@ -384,19 +419,10 @@ int main()
|
384
|
419
|
for (size_t n : testLength)
|
385
|
420
|
{
|
386
|
421
|
printf("========= Phase %d / %d (%zu) ==========\n", index, int(std::size(testLength)), n);
|
387
|
|
- for (auto t : {
|
388
|
|
- GenUniform32,
|
389
|
|
- GenUniform16,
|
390
|
|
- GenUniform16Xor,
|
391
|
|
- GenUniform8,
|
392
|
|
- GenUniform8Xor,
|
393
|
|
- GenNormal64,
|
394
|
|
- GenNormal32
|
395
|
|
- })
|
|
422
|
+ for (auto t : dataTypes)
|
396
|
423
|
{
|
397
|
424
|
RunTest(n, t);
|
398
|
425
|
}
|
399
|
|
- //RunTest(n, GenNormal64);
|
400
|
426
|
PrintScore(index);
|
401
|
427
|
index++;
|
402
|
428
|
}
|