Browse Source

데이터 유형 추가.

Hongtae Kim 5 years ago
parent
commit
1fcb6c0530
4 changed files with 48 additions and 18 deletions
  1. 42
    16
      WETSort/WETSort.cpp
  2. 4
    0
      WETSort/WETSort.vcxproj
  3. 1
    1
      djarksnd
  4. 1
    1
      insun

+ 42
- 16
WETSort/WETSort.cpp View File

27
 	1ULL << 24,
27
 	1ULL << 24,
28
 	1ULL << 29,
28
 	1ULL << 29,
29
 #else
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
 #endif
33
 #endif
34
 };
34
 };
35
 
35
 
74
 	GenUniform16,
74
 	GenUniform16,
75
 	GenUniform16Xor,
75
 	GenUniform16Xor,
76
 	GenUniform8,
76
 	GenUniform8,
77
+	GenUniform4,
78
+	GenUniform1,
77
 	GenUniform8Xor,
79
 	GenUniform8Xor,
78
 	GenNormal64,
80
 	GenNormal64,
79
 	GenNormal32,
81
 	GenNormal32,
132
 	case insun:
134
 	case insun:
133
 		fn = [](ElementType* items, size_t numItems)
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
 		break;
139
 		break;
139
 	case prauser:
140
 	case prauser:
287
 			}
288
 			}
288
 		}
289
 		}
289
 		break;
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
 	case GenNormal64:
313
 	case GenNormal64:
291
 		if (1)
314
 		if (1)
292
 		{
315
 		{
317
 	DoSortTest<2>();
340
 	DoSortTest<2>();
318
 	// 3 bytes
341
 	// 3 bytes
319
 	DoSortTest<3>();
342
 	DoSortTest<3>();
320
-	// 4 bytes
343
+	//4 bytes
321
 	DoSortTest<4>();
344
 	DoSortTest<4>();
322
 	// 5 bytes
345
 	// 5 bytes
323
 	DoSortTest<5>();
346
 	DoSortTest<5>();
355
 	testScore[prauser].error  = 1;
378
 	testScore[prauser].error  = 1;
356
 	testScore[witdrg].error   = 1;
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
 	auto PrintScore = [](int phase)
393
 	auto PrintScore = [](int phase)
359
 	{
394
 	{
360
 		printf("------------ SCORE (%d/%d) --------------\n", phase, int(std::size(testLength)));
395
 		printf("------------ SCORE (%d/%d) --------------\n", phase, int(std::size(testLength)));
384
 	for (size_t n : testLength)
419
 	for (size_t n : testLength)
385
 	{
420
 	{
386
 		printf("========= Phase %d / %d (%zu) ==========\n", index, int(std::size(testLength)), n);
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
 			RunTest(n, t);
424
 			RunTest(n, t);
398
 		}
425
 		}
399
-		//RunTest(n, GenNormal64);
400
 		PrintScore(index);
426
 		PrintScore(index);
401
 		index++;
427
 		index++;
402
 	}
428
 	}

+ 4
- 0
WETSort/WETSort.vcxproj View File

103
     <Link>
103
     <Link>
104
       <SubSystem>Console</SubSystem>
104
       <SubSystem>Console</SubSystem>
105
       <GenerateDebugInformation>true</GenerateDebugInformation>
105
       <GenerateDebugInformation>true</GenerateDebugInformation>
106
+      <StackReserveSize>134217728</StackReserveSize>
106
     </Link>
107
     </Link>
107
   </ItemDefinitionGroup>
108
   </ItemDefinitionGroup>
108
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
109
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
118
     <Link>
119
     <Link>
119
       <SubSystem>Console</SubSystem>
120
       <SubSystem>Console</SubSystem>
120
       <GenerateDebugInformation>true</GenerateDebugInformation>
121
       <GenerateDebugInformation>true</GenerateDebugInformation>
122
+      <StackReserveSize>134217728</StackReserveSize>
121
     </Link>
123
     </Link>
122
   </ItemDefinitionGroup>
124
   </ItemDefinitionGroup>
123
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
125
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
137
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
139
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
138
       <OptimizeReferences>true</OptimizeReferences>
140
       <OptimizeReferences>true</OptimizeReferences>
139
       <GenerateDebugInformation>true</GenerateDebugInformation>
141
       <GenerateDebugInformation>true</GenerateDebugInformation>
142
+      <StackReserveSize>134217728</StackReserveSize>
140
     </Link>
143
     </Link>
141
   </ItemDefinitionGroup>
144
   </ItemDefinitionGroup>
142
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
145
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
156
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
159
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
157
       <OptimizeReferences>true</OptimizeReferences>
160
       <OptimizeReferences>true</OptimizeReferences>
158
       <GenerateDebugInformation>true</GenerateDebugInformation>
161
       <GenerateDebugInformation>true</GenerateDebugInformation>
162
+      <StackReserveSize>134217728</StackReserveSize>
159
     </Link>
163
     </Link>
160
   </ItemDefinitionGroup>
164
   </ItemDefinitionGroup>
161
   <ItemGroup>
165
   <ItemGroup>

+ 1
- 1
djarksnd

1
-Subproject commit fb7676ce27fc4a83d507f6e8078b896b87745817
1
+Subproject commit 367c4bf3c9e18765f0f1086d345d818886f2ebfa

+ 1
- 1
insun

1
-Subproject commit 8c1a3c74ebf712341707d138111e5aa0bdcbc3af
1
+Subproject commit 47dc36c71c1c47cb7d45ff7f7288f5868d67243b