-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtester.cpp
156 lines (145 loc) · 6.3 KB
/
tester.cpp
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
//g++ tester.cpp -fopenmp -std=c++1z
//requires c++ 17
#include "my_library.hpp"
#include "my_testing_library.hpp"
std::string GetCurrentTimeForFileName()
{
auto time = std::time(nullptr);
std::stringstream ss;
ss << std::put_time(std::localtime(&time), "%F_%T"); // ISO 8601 without timezone information.
auto s = ss.str();
std::replace(s.begin(), s.end(), ':', '-');
return s;
}
int main()
{
// auto [avg, std_dev] = tester(6000, true, 4, 100, false);
// cout << avg << " " << std_dev << endl;
// tie(avg, std_dev) = tester(3, false);
// cout << avg << " " << std_dev << endl;
std::ofstream output("comprehensive_test_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 0; psd < 2; psd++)
{
for (int num_threads = 1; num_threads < 5; num_threads++)
{
for (int size = 100; size <= 1000; size += 100)
{
auto [avg, std_dev] = tester(size, psd, num_threads);
output << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
}
}
}
{
std::ofstream output("sparse_pd_4_5000_testing_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 1; psd < 2; psd++)
{
for (int num_threads = 4; num_threads < 5; num_threads++)
{
for (int size = 5000; size <= 5000; size += 100)
{
for (double sparse_proportion = 0.1; sparse_proportion < 1; sparse_proportion += 0.1)
{
auto [avg, std_dev] = tester(size, psd, num_threads, 100, false, 10, sparse_proportion);
output << psd << " " << num_threads << " " << size << " " << sparse_proportion << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << sparse_proportion << " " << avg << " " << std_dev << endl;
}
}
}
}
}
{
std::ofstream output("sparse_npd_4_1000_testing_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 0; psd < 1; psd++)
{
for (int num_threads = 4; num_threads < 5; num_threads++)
{
for (int size = 1000; size <= 1000; size += 100)
{
for (double sparse_proportion = 0.1; sparse_proportion < 1; sparse_proportion += 0.1)
{
auto [avg, std_dev] = tester(size, psd, num_threads, 100, false, 10, sparse_proportion);
output << psd << " " << num_threads << " " << size << " " << sparse_proportion << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << sparse_proportion << " " << avg << " " << std_dev << endl;
}
}
}
}
}
{
std::ofstream output("size_pd_4_testing_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 1; psd < 2; psd++)
{
for (int num_threads = 4; num_threads < 5; num_threads++)
{
for (int size = 100; size <= 5000; size += 100)
{
auto [avg, std_dev] = tester(size, psd, num_threads);
output << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
}
}
}
}
{
std::ofstream output("thread_pd_5000_testing_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 1; psd < 2; psd++)
{
for (int num_threads = 4; num_threads < 5; num_threads++)
{
for (int size = 5000; size <= 5000; size += 100)
{
auto [avg, std_dev] = tester(size, psd, num_threads);
output << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
}
}
}
}
{
std::ofstream output("pd_1000_testing_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 0; psd < 2; psd++)
{
for (int num_threads = 1; num_threads < 5; num_threads++)
{
for (int size = 1000; size <= 1000; size += 100)
{
auto [avg, std_dev] = tester(size, psd, num_threads);
output << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
}
}
}
}
{
std::ofstream output("size_npd_4_testing_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 0; psd < 1; psd++)
{
for (int num_threads = 4; num_threads < 5; num_threads++)
{
for (int size = 100; size <= 1000; size += 100)
{
auto [avg, std_dev] = tester(size, psd, num_threads);
output << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
}
}
}
}
{
std::ofstream output("thread_npd_1000_testing_results" + GetCurrentTimeForFileName() + ".txt");
for (int psd = 0; psd < 1; psd++)
{
for (int num_threads = 1; num_threads < 5; num_threads++)
{
for (int size = 1000; size <= 1000; size += 100)
{
auto [avg, std_dev] = tester(size, psd, num_threads);
output << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
cout << psd << " " << num_threads << " " << size << " " << avg << " " << std_dev << endl;
}
}
}
}
return 0;
}