FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpp.react/benchmarks/src/Main.cpp at master · mnpk/cpp.react · GitHub
mnpk
/
cpp.react
Public
forked from
snakster/cpp.react
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cpp.react
/
benchmarks
/
src
/
Main.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
241 lines (177 loc) · 7.78 KB
Breadcrumbs
cpp.react
/
benchmarks
/
src
/
Main.cpp
Copy path
File metadata and controls
241 lines (177 loc) · 7.78 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
//
Copyright Sebastian Jeckel 2014.
//
Distributed under the Boost Software License, Version 1.0.
//
(See accompanying file LICENSE_1_0.txt or copy at
//
http://www.boost.org/LICENSE_1_0.txt)
//
#define REACT_ENABLE_LOGGING
#
include
"
tbb/tick_count.h
"
#
include
"
tbb/tbbmalloc_proxy.h
"
//
#include "ittnotify.h"
#
include
"
BenchmarkGrid.h
"
#
include
"
BenchmarkRandom.h
"
#
include
"
BenchmarkFanout.h
"
#
include
"
BenchmarkSequence.h
"
#
include
"
BenchmarkLifeSim.h
"
#
include
"
react/Domain.h
"
#
include
"
react/Signal.h
"
#
include
"
react/Algorithm.h
"
#
include
"
react/common/Util.h
"
#
include
"
react/logging/EventLog.h
"
#
include
"
react/engine/ToposortEngine.h
"
#
include
"
react/engine/PulsecountEngine.h
"
#
include
"
react/engine/SubtreeEngine.h
"
//
/////////////////////////////////////////////////////////////////////////////////////////////////
namespace
{
using
namespace
react
;
REACTIVE_DOMAIN
(ToposortSTDomain, sequential, ToposortEngine)
REACTIVE_DOMAIN
(ToposortDomain, parallel, ToposortEngine)
REACTIVE_DOMAIN
(PulsecountDomain, parallel, PulsecountEngine)
REACTIVE_DOMAIN
(SubtreeDomain, parallel, SubtreeEngine)
void
runBenchmarkGrid
(std::ostream& out)
{
RUN_BENCHMARK
(out,
5
, Benchmark_Grid,
BenchmarkParams_Grid
(
20
,
10000
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
5
, Benchmark_Grid,
BenchmarkParams_Grid
(
30
,
10000
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
5
, Benchmark_Grid,
BenchmarkParams_Grid
(
40
,
10000
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
5
, Benchmark_Grid,
BenchmarkParams_Grid
(
50
,
10000
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
}
void
runBenchmarkRandom
(std::ostream& out)
{
const
auto
w =
20
;
const
auto
h =
11
;
int
seed1 =
41556
;
int
seed2 =
21624
;
for
(
int
j=
1
; j<=
10
; j++)
{
printf
(
"
STARTING SERIES %d
\n
"
, j);
for
(
int
slowPercent=
0
; slowPercent<=
50
; slowPercent+=
5
)
{
int
x = (slowPercent * (w*(h-
1
))) /
100
;
//
RUN_BENCHMARK(out, 5, Benchmark_Random, BenchmarkParams_Random(w, h, 20, 0, 10, 40, x, true, seed1, seed2),
//
ToposortDomain, ELMDomain, PulsecountDomain, SourceSetDomain);
RUN_BENCHMARK
(out,
5
, Benchmark_Random,
BenchmarkParams_Random
(w, h,
20
,
0
,
10
,
40
, x,
true
, seed1, seed2),
ToposortSTDomain);
}
seed1 *=
2
;
seed2 *=
2
;
}
}
void
runBenchmarkFanout
(std::ostream& out)
{
//
RUN_BENCHMARK(out, 5, Benchmark_Fanout, BenchmarkParams_Fanout(10, 10000, 0),
//
ToposortSTDomain, ToposortDomain, ELMDomain, PulsecountDomain, SourceSetDomain);
//
RUN_BENCHMARK(out, 5, Benchmark_Fanout, BenchmarkParams_Fanout(100, 10000, 0),
//
ToposortSTDomain, ToposortDomain, ELMDomain, PulsecountDomain, SourceSetDomain);
//
RUN_BENCHMARK(out, 5, Benchmark_Fanout, BenchmarkParams_Fanout(1000, 10000, 0),
//
ToposortSTDomain, ToposortDomain, ELMDomain, PulsecountDomain, SourceSetDomain);
RUN_BENCHMARK
(out,
3
, Benchmark_Fanout,
BenchmarkParams_Fanout
(
10
,
10
,
10
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
3
, Benchmark_Fanout,
BenchmarkParams_Fanout
(
100
,
10
,
10
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
3
, Benchmark_Fanout,
BenchmarkParams_Fanout
(
1000
,
10
,
10
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
}
void
runBenchmarkSequence
(std::ostream& out)
{
//
RUN_BENCHMARK(out, 3, Benchmark_Sequence, BenchmarkParams_Sequence(10, 10000, 0),
//
ToposortSTDomain, ToposortDomain, ELMDomain, PulsecountDomain, SourceSetDomain);
//
RUN_BENCHMARK(out, 3, Benchmark_Sequence, BenchmarkParams_Sequence(100, 10000, 0),
//
ToposortSTDomain, ToposortDomain, ELMDomain, PulsecountDomain, SourceSetDomain);
//
RUN_BENCHMARK(out, 3, Benchmark_Sequence, BenchmarkParams_Sequence(1000, 10000, 0),
//
ToposortSTDomain, ToposortDomain, ELMDomain, PulsecountDomain, SourceSetDomain);
RUN_BENCHMARK
(out,
3
, Benchmark_Sequence,
BenchmarkParams_Sequence
(
10
,
10
,
10
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
3
, Benchmark_Sequence,
BenchmarkParams_Sequence
(
100
,
10
,
10
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
3
, Benchmark_Sequence,
BenchmarkParams_Sequence
(
1000
,
10
,
10
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
}
void
runBenchmarkLifeSim
(std::ostream& out)
{
//
RUN_BENCHMARK(std::cout, 1, Benchmark_LifeSim, BenchmarkParams_LifeSim(150, 1000),
//
ELMDomain);
//
RUN_BENCHMARK(std::cout, 1, Benchmark_LifeSim, BenchmarkParams_LifeSim(250, 30, 10000),
//
SourceSetDomain, PulsecountDomain);
RUN_BENCHMARK
(out,
1
, Benchmark_LifeSim,
BenchmarkParams_LifeSim
(
100
,
15
,
10000
),
ToposortSTDomain, ToposortDomain, PulsecountDomain);
//
RUN_BENCHMARK(out, 3, Benchmark_LifeSim, BenchmarkParams_LifeSim(100, 50, 100),
//
PulsecountDomain, PulsecountDomain);
}
void
runBenchmarks
()
{
std::ofstream logfile;
std::string path =
"
Benchmark Results/
"
+
CurrentDateTime
() +
"
.txt
"
;
logfile.
open
(path.
c_str
());
//
=== GRID
//
runBenchmarkGrid(logfile);
//
runBenchmarkFlooding(logfile);
//
=== RANDOM
//
runBenchmarkRandom(logfile);
//
=== FANOUT
//
runBenchmarkFanout(logfile);
//
=== SEQUENCE
//
runBenchmarkSequence(logfile);
//
=== LIFESIM
runBenchmarkLifeSim
(logfile);
logfile.
close
();
}
void
debugBenchmarks
()
{
using
TestDomain = PulsecountDomain;
//
RUN_BENCHMARK(std::cout, 1, Benchmark_Grid, BenchmarkParams_Grid(30, 1),
//
TestDomain);
//
RUN_BENCHMARK(std::cout, 1, Benchmark_Fanout, BenchmarkParams_Fanout(1000, 5, 0),
//
TestDomain);
//
RUN_BENCHMARK(std::cout, 1, Benchmark_Grid, BenchmarkParams_Grid(30, 1),
//
TestDomain);
//
RUN_BENCHMARK(std::cout, 1, Benchmark_Sequence, BenchmarkParams_Sequence(500, 1, 0),
//
TestDomain);
//
RUN_BENCHMARK(std::cout, 1, Benchmark_Random, BenchmarkParams_Random(10, 25, 10, 0, 10, 25, 25, false),
//
ToposortDomain);
RUN_BENCHMARK
(std::cout,
1
, Benchmark_Random,
BenchmarkParams_Random
(
40
,
11
,
2
,
0
,
1
,
40
,
40
,
false
,
41556
,
21624
),
TestDomain);
//
const auto w = 10;
//
const auto h = 11;
//
for (int slowPercent=0; slowPercent<=50; slowPercent+=50)
//
{
//
int seed1 = 4156;
//
int seed2 = 2124;
//
for (int j=1; j<=5; j++)
//
{
//
int x = (slowPercent * (w*(h-1))) / 100;
//
RUN_BENCHMARK(std::cout, 1, Benchmark_Random, BenchmarkParams_Random(w, h, 100, 0, 5, 25, x, false, seed1 / j, seed2 / j),
//
ToposortDomain);
//
}
//
}
//
RunBenchmark<1>(Benchmark2<BTokenDomain>());
//
RunBenchmark<1>(Benchmark2<SourceSetDomain>());
//
RunBenchmark<3>(Benchmark2<ToposortDomain>());
#
ifdef
REACT_ENABLE_LOGGING
std::ofstream logfile;
logfile.
open
(
"
log.txt
"
);
TestDomain::Log
().
Write
(logfile);
logfile.
close
();
#
endif
}
void
profileBenchmark
()
{
RUN_BENCHMARK
(std::cout,
1
, Benchmark_Grid,
BenchmarkParams_Grid
(
30
,
10000
),
ToposortSTDomain);
//
ToposortSTDomain, ToposortDomain, PulsecountDomain, SubtreeDomain);
//
RUN_BENCHMARK(std::cout, 1, Benchmark_Grid, BenchmarkParams_Grid(30, 10000),
//
SourceSetDomain);
//
RUN_BENCHMARK(std::cout, 3, Benchmark_Random, BenchmarkParams_Random(20, 11, 100, 0, 1, 40, 40, false, 41556, 21624),
//
SubtreeDomain);
//
ToposortSTDomain, ToposortDomain, PulsecountDomain, SubtreeDomain);
//
RUN_BENCHMARK(std::cout, 1, Benchmark_LifeSim, BenchmarkParams_LifeSim(100, 15, 10000),
//
ToposortSTDomain);
}
}
//
~anonymous namespace
int
main
()
{
//
runBenchmarks();
//
debugBenchmarks();
profileBenchmark
();
}
Back
|
FazBrowse Home
|
New Git URL