FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
taskflow/benchmarks/wavefront/main.cpp at task_isolation · ModuleWorks/taskflow · GitHub
ModuleWorks
/
taskflow
Public
forked from
taskflow/taskflow
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
taskflow
/
benchmarks
/
wavefront
/
main.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
84 lines (63 loc) · 1.85 KB
Breadcrumbs
taskflow
/
benchmarks
/
wavefront
/
main.cpp
Copy path
File metadata and controls
84 lines (63 loc) · 1.85 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
#
include
"
matrix.hpp
"
#
include
<
CLI11.hpp
>
int
M =
0
;
int
N =
0
;
int
B =
0
;
int
MB
=
0
;
int
NB
=
0
;
double
**matrix =
nullptr
;
void
wavefront
(
const
std::string& model,
const
unsigned
num_threads,
const
unsigned
num_rounds
) {
std::cout <<
std::setw
(
12
) <<
"
size
"
<<
std::setw
(
12
) <<
"
runtime
"
<< std::endl;
for
(
int
S=
32
; S<=
4096
; S +=
128
) {
M = N = S;
B =
8
;
MB
= (M/B) + (M%B>
0
);
NB
= (N/B) + (N%B>
0
);
double
runtime {
0.0
};
init_matrix
();
for
(
unsigned
j=
0
; j<num_rounds; ++j) {
if
(model ==
"
tf
"
) {
runtime +=
measure_time_taskflow
(num_threads).
count
();
}
else
if
(model ==
"
tbb
"
) {
runtime +=
measure_time_tbb
(num_threads).
count
();
}
else
if
(model ==
"
omp
"
) {
runtime +=
measure_time_omp
(num_threads).
count
();
}
else
assert
(
false
);
}
destroy_matrix
();
std::cout <<
std::setw
(
12
) <<
MB
*
NB
<<
std::setw
(
12
) << runtime / num_rounds /
1e3
<< std::endl;
}
}
int
main
(
int
argc,
char
* argv[]) {
CLI
::App app{
"
Wavefront
"
};
unsigned
num_threads {
1
};
app.
add_option
(
"
-t,--num_threads
"
, num_threads,
"
number of threads (default=1)
"
);
unsigned
num_rounds {
1
};
app.
add_option
(
"
-r,--num_rounds
"
, num_rounds,
"
number of rounds (default=1)
"
);
std::string model =
"
tf
"
;
app.
add_option
(
"
-m,--model
"
, model,
"
model name tbb|omp|tf (default=tf)
"
)
->
check
([] (
const
std::string& m) {
if
(m !=
"
tbb
"
&& m !=
"
omp
"
&& m !=
"
tf
"
) {
return
"
model name should be
\"
tbb
\"
,
\"
omp
\"
, or
\"
tf
\"
"
;
}
return
"
"
;
});
CLI11_PARSE
(app, argc, argv);
std::cout <<
"
model=
"
<< model <<
'
'
<<
"
num_threads=
"
<< num_threads <<
'
'
<<
"
num_rounds=
"
<< num_rounds <<
'
'
<< std::endl;
wavefront
(model, num_threads, num_rounds);
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL