Browse Source

데이터 유형 추가.

Hongtae Kim 6 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,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
 	}

+ 4
- 0
WETSort/WETSort.vcxproj View File

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

+ 1
- 1
djarksnd

@@ -1 +1 @@
1
-Subproject commit fb7676ce27fc4a83d507f6e8078b896b87745817
1
+Subproject commit 367c4bf3c9e18765f0f1086d345d818886f2ebfa

+ 1
- 1
insun

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