forked from lazarcl/research
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunMemoryTests.cu
More file actions
150 lines (120 loc) · 4.97 KB
/
runMemoryTests.cu
File metadata and controls
150 lines (120 loc) · 4.97 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
#include "testFramework.cu"
#include "arithmeticTests.h"
#include "memoryTests.cu"
#include <string>
#include <sys/stat.h>
#include "testHelpers.h"
#include <tuple>
#include <vector>
template <typename kernel>
void runTestGeneric(int, int, const char*);
template <typename kernel>
void runTestGeneric_setBlockScale(int, int, const char*, int);
template <typename kernel>
void runL1Test(int, int, const char*, const char*);
template <typename kernel>
void runL2Test(int, int, const char*, const char*);
template <typename T>
void runGlobalTest(int, int, const char*, const char*);
template <typename kernel>
void runSharedMemTest(int, int, const char*, const char*);
int main() {
// std::string storagePath = setupStoragePath(argc, argv);
int blockSize = 256;
int iterationsSmall = 200000;
int iterationsBig = 200000000;
// std::string out1;
// std::string out2;
// out1 = storagePath + std::string("outputAddFP32_1.csv");
// out2 = storagePath + std::string("outputAddFP32_2.csv");
runTestGeneric_setBlockScale<L1MemTest1<float>>(iterationsSmall*3, blockSize, "data/outputL1ReadTest_1.csv", 100);
runTestGeneric_setBlockScale<L1MemTest2<float>>(iterationsSmall*3, blockSize, "data/outputL1ReadTest_2.csv", 100);
runTestGeneric_setBlockScale<L2MemReadTest1<float>>(iterationsSmall*3, blockSize, "data/outputL2ReadTest_1.csv", 100);
runTestGeneric_setBlockScale<L2MemReadTest2<float>>(iterationsSmall*3, blockSize, "data/outputL2ReadTest_2.csv", 100);
runTestGeneric_setBlockScale<SharedMemReadTest1<float>>(iterationsSmall*4, blockSize, "data/outputSharedReadTest_1.csv", 100);
runTestGeneric_setBlockScale<SharedMemReadTest2<float>>(iterationsSmall*4, blockSize, "data/outputSharedReadTest_2.csv", 100);
runGlobalTest<float>(1000, blockSize, "data/outputGlobalReadTest_1.csv", "data/outputGlobalReadTest_2.csv");
// printf("---- beginning L1 Testing ----\n");
// runL1Test<L1MemTest1<T>>(iterations, blockSize, "tmp1.csv");
// printf("---- test end ----\n");
// printf("---- beginning L2 Testing ----\n");
// runL2Test<L2MemReadTest1<float>>(iterations, blockSize, "tmp1.csv");
// printf("---- test end ----\n");
// printf("---- beginning Global Memory Testing ----\n");
// runGlobalTest<GlobalMemTest1<float>>(iterations, blockSize, "tmp1.csv");
// printf("---- test end ----\n");
// printf("---- beginning Shared Memory Testing ----\n");
// runSharedMemTest<SharedMemReadTest1<float>>(iterations, blockSize, "tmp1.csv");
// printf("---- test end ----\n");
return 0;
}
template <typename kernel>
void runTestGeneric(int iterNum, int blockSize, const char* outputName)
{
printf("Starting Kernel: '%s'\n", outputName);
kernel test1(blockSize, iterNum);
TestRunner<kernel> tester1(&test1, outputName, 0.1);
tester1.getGoodSample();
tester1.dataToFile();
printf("Kernel '%s' finished\n", outputName);
}
template <typename kernel>
void runTestGeneric_setBlockScale(int iterNum, int blockSize, const char* outputName, int blockScale)
{
printf("Starting Kernel: '%s'\n", outputName);
kernel test1(blockSize, iterNum, blockScale);
TestRunner<kernel> tester1(&test1, outputName, 0.1);
tester1.getGoodSample();
tester1.dataToFile();
printf("Kernel '%s' finished\n", outputName);
}
// template <typename kernel>
// void runL1Test(int iterNum, int blockSize, const char* outputName1,
// const char* outputName2)
// {
// printf("Starting Kernel1\n");
// L1MemTest1<T> test1(blockSize, iterNum);
// TestRunner<L1MemTest1<T>> tester1(&test1, outputName1);
// tester1.getGoodSample();
// // tester1.dataToFile();
// printf("Kernel 1 finished\n");
// }
// template <typename kernel>
// void runL2Test(int iterNum, int blockSize, const char* outputName1,
// const char* outputName2)
// {
// printf("Starting Kernel1\n");
// L2MemTest1<T> test1(blockSize, iterNum);
// TestRunner<L2MemTest1<T>> tester1(&test1, outputName1);
// tester1.getGoodSample();
// // tester1.dataToFile();
// printf("Kernel 1 finished\n");
// }
template <typename T>
void runGlobalTest(int iterNum, int blockSize, const char* outputName1,
const char* outputName2)
{
printf("Starting Global Kernel1\n");
GlobalMemTest1<T> test1(blockSize, iterNum);
TestRunner<GlobalMemTest1<T>> tester1(&test1, outputName1);
tester1.getGoodSample();
tester1.dataToFile();
printf("Kernel 1 finished\n");
printf("Starting Global Kernel2\n");
GlobalMemTest2<T> test2(blockSize, iterNum);
TestRunner<GlobalMemTest2<T>> tester2(&test2, outputName2);
tester2.getGoodSample();
tester2.dataToFile();
printf("Kernel 2 finished\n");
}
// template <typename kernel>
// void runSharedMemTest(int iterNum, int blockSize, const char* outputName1,
// const char* outputName2)
// {
// printf("Starting Kernel1\n");
// SharedMemTest1<T> test1(blockSize, iterNum);
// TestRunner<SharedMemTest1<T>> tester1(&test1, outputName1);
// tester1.getGoodSample();
// // tester1.dataToFile();
// printf("Kernel 1 finished\n");
// }