forked from taskflow/taskflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBenchmarkTaskflow.xml
More file actions
228 lines (228 loc) · 15.1 KB
/
Copy pathBenchmarkTaskflow.xml
File metadata and controls
228 lines (228 loc) · 15.1 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
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
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.12.0" xml:lang="en-US">
<compounddef id="BenchmarkTaskflow" kind="page">
<compoundname>BenchmarkTaskflow</compoundname>
<title>Benchmark Taskflow</title>
<tableofcontents>
<tocsect>
<name>Compile and Run Benchmarks</name>
<reference>BenchmarkTaskflow_1CompileAndRunBenchmarks</reference>
</tocsect>
<tocsect>
<name>Configure Run Options</name>
<reference>BenchmarkTaskflow_1ConfigureRunOptions</reference>
<tableofcontents>
<tocsect>
<name>Specify the Run Model</name>
<reference>BenchmarkTaskflow_1SpecifyTheRunModel</reference>
</tocsect>
<tocsect>
<name>Specify the Number of Threads</name>
<reference>BenchmarkTaskflow_1SpecifyTheNumberOfThreads</reference>
</tocsect>
<tocsect>
<name>Specify the Number of Rounds</name>
<reference>BenchmarkTaskflow_1SpecifyTheNumberOfRounds</reference>
</tocsect>
</tableofcontents>
</tocsect>
</tableofcontents>
<briefdescription>
</briefdescription>
<detaileddescription>
<sect1 id="BenchmarkTaskflow_1CompileAndRunBenchmarks">
<title>Compile and Run Benchmarks</title><para>To build the benchmark code, enable the CMake option <computeroutput>TF_BUILD_BENCHMARKS</computeroutput> to <computeroutput>ON</computeroutput> as follows:</para>
<para><programlisting filename=".bash"><codeline><highlight class="normal">#<sp/>under<sp/>/taskflow/build</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>cmake<sp/>../<sp/>-DTF_BUILD_BENCHMARKS=ON</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>make</highlight></codeline>
</programlisting></para>
<para>After you successfully build the benchmark code, you can find all benchmark instances in the <computeroutput>benchmarks/</computeroutput> folder. You can run the executable of each instance in the corresponding folder.</para>
<para><programlisting filename=".bash"><codeline><highlight class="normal">~$<sp/>cd<sp/>benchmarks<sp/>&<sp/>ls</highlight></codeline>
<codeline><highlight class="normal">bench_black_scholes<sp/>bench_binary_tree<sp/>bench_graph_traversal<sp/>...</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>./bench_graph_traversal</highlight></codeline>
<codeline><highlight class="normal">|V|+|E|<sp/><sp/><sp/><sp/><sp/>Runtime</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>2<sp/><sp/><sp/><sp/><sp/><sp/><sp/>0.197</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>842<sp/><sp/><sp/><sp/><sp/><sp/><sp/>0.198</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/>3284<sp/><sp/><sp/><sp/><sp/><sp/><sp/>0.488</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/>7288<sp/><sp/><sp/><sp/><sp/><sp/><sp/>0.774</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>...<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>...</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>...<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>...</highlight></codeline>
<codeline><highlight class="normal"><sp/>619802<sp/><sp/><sp/><sp/><sp/><sp/>75.135</highlight></codeline>
<codeline><highlight class="normal"><sp/>664771<sp/><sp/><sp/><sp/><sp/><sp/>77.436</highlight></codeline>
<codeline><highlight class="normal"><sp/>711200<sp/><sp/><sp/><sp/><sp/><sp/>83.957</highlight></codeline>
</programlisting></para>
<para>You can display the help message by giving the option <computeroutput>--help</computeroutput>.</para>
<para><programlisting filename=".bash"><codeline><highlight class="normal">~$<sp/>./bench_graph_traversal<sp/>--help</highlight></codeline>
<codeline><highlight class="normal">Graph<sp/>Traversal</highlight></codeline>
<codeline><highlight class="normal">Usage:<sp/>./bench_graph_traversal<sp/>[OPTIONS]</highlight></codeline>
<codeline></codeline>
<codeline><highlight class="normal">Options:</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>-h,--help<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Print<sp/>this<sp/>help<sp/>message<sp/>and<sp/>exit</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>-t,--num_threads<sp/>UINT<sp/><sp/><sp/><sp/><sp/><sp/><sp/>number<sp/>of<sp/>threads<sp/>(default=1)</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>-r,--num_rounds<sp/>UINT<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>number<sp/>of<sp/>rounds<sp/>(default=1)</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/>-m,--model<sp/>TEXT<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>model<sp/>name<sp/>tbb|omp|tf<sp/>(default=tf)</highlight></codeline>
</programlisting></para>
<para>We currently implement the following instances that are commonly used by the parallel computing community to evaluate the system performance.</para>
<para><table rows="24" cols="2"><row>
<entry thead="yes" align='center'><para>Instance </para>
</entry><entry thead="yes" align='center'><para>Description </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_binary_tree </para>
</entry><entry thead="no" align='center'><para>traverses a complete binary tree </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_black_scholes </para>
</entry><entry thead="no" align='center'><para>computes option pricing with Black-Shcoles Models </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_graph_traversal </para>
</entry><entry thead="no" align='center'><para>traverses a randomly generated direct acyclic graph </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_linear_chain </para>
</entry><entry thead="no" align='center'><para>traverses a linear chain of tasks </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_mandelbrot </para>
</entry><entry thead="no" align='center'><para>exploits imbalanced workloads in a Mandelbrot set </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_matrix_multiplication </para>
</entry><entry thead="no" align='center'><para>multiplies two 2D matrices </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_mnist </para>
</entry><entry thead="no" align='center'><para>trains a neural network-based image classifier on the MNIST dataset </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_parallel_sort </para>
</entry><entry thead="no" align='center'><para>sorts a range of items </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_reduce_sum </para>
</entry><entry thead="no" align='center'><para>sums a range of items using reduction </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_wavefront </para>
</entry><entry thead="no" align='center'><para>propagates computations in a 2D grid </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_linear_pipeline </para>
</entry><entry thead="no" align='center'><para>performs pipeline parallelism on a linear chain of pipes </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_graph_pipeline </para>
</entry><entry thead="no" align='center'><para>performs pipeline parallelism on a graph of pipes </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_deferred_pipeline </para>
</entry><entry thead="no" align='center'><para>performs pipeline parallelism with dependencies from future pipes </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_data_pipeline </para>
</entry><entry thead="no" align='center'><para>performs pipeline parallelisms on a cache-friendly data wrapper </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_thread_pool </para>
</entry><entry thead="no" align='center'><para>uses our executor as a simple thread pool </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_for_each </para>
</entry><entry thead="no" align='center'><para>performs parallel-iteration algorithms </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_scan </para>
</entry><entry thead="no" align='center'><para>performs parallel-scan algorithms </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_async_task </para>
</entry><entry thead="no" align='center'><para>creates asynchronous tasks </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_fibonacci </para>
</entry><entry thead="no" align='center'><para>finds Fibonacci numbers using recursive asynchronous tasking </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_nqueens </para>
</entry><entry thead="no" align='center'><para>parallelizes n-queen search using recursive asynchronous tasking </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_integrate </para>
</entry><entry thead="no" align='center'><para>parallelizes integration using recursive asynchronous tasking </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_primes </para>
</entry><entry thead="no" align='center'><para>finds a range of prime numbers using parallel-reduction algorithms </para>
</entry></row>
<row>
<entry thead="no" align='center'><para>bench_skynet </para>
</entry><entry thead="no" align='center'><para>traverses a 10-ray tree using recursive asynchronous tasking </para>
</entry></row>
</table>
</para>
</sect1>
<sect1 id="BenchmarkTaskflow_1ConfigureRunOptions">
<title>Configure Run Options</title><para>We implement consistent options for each benchmark instance. Common options are:</para>
<para><table rows="5" cols="3"><row>
<entry thead="yes" align='center'><para>option </para>
</entry><entry thead="yes" align='center'><para>value </para>
</entry><entry thead="yes" align='center'><para>function </para>
</entry></row>
<row>
<entry thead="no" align='center'><para><computeroutput>-h</computeroutput> </para>
</entry><entry thead="no" align='center'><para>none </para>
</entry><entry thead="no" align='center'><para>displays the help message </para>
</entry></row>
<row>
<entry thead="no" align='center'><para><computeroutput>-t</computeroutput> </para>
</entry><entry thead="no" align='center'><para>integer </para>
</entry><entry thead="no" align='center'><para>configures the number of threads to run </para>
</entry></row>
<row>
<entry thead="no" align='center'><para><computeroutput>-r</computeroutput> </para>
</entry><entry thead="no" align='center'><para>integer </para>
</entry><entry thead="no" align='center'><para>configures the number of rounds to run </para>
</entry></row>
<row>
<entry thead="no" align='center'><para><computeroutput>-m</computeroutput> </para>
</entry><entry thead="no" align='center'><para>string </para>
</entry><entry thead="no" align='center'><para>configures the baseline models to run, tbb, omp, or tf </para>
</entry></row>
</table>
</para>
<para>You can configure the benchmarking environment by giving different options.</para>
<sect2 id="BenchmarkTaskflow_1SpecifyTheRunModel">
<title>Specify the Run Model</title><para>In addition to a Taskflow-based implementation for each benchmark instance, we have implemented two baseline models using the state-of-the-art parallel programming libraries, <ulink url="https://www.openmp.org/">OpenMP</ulink> and <ulink url="https://github.com/oneapi-src/oneTBB">Intel TBB</ulink>, to measure and evaluate the performance of Taskflow. You can select different implementations by passing the option <computeroutput>-m</computeroutput>.</para>
<para><programlisting filename=".bash"><codeline><highlight class="normal">~$<sp/>./bench_graph_traversal<sp/>-m<sp/>tf<sp/><sp/><sp/>#<sp/>run<sp/>the<sp/>Taskflow<sp/>implementation<sp/>(default)</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>./bench_graph_traversal<sp/>-m<sp/>tbb<sp/><sp/>#<sp/>run<sp/>the<sp/>TBB<sp/>implementation</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>./bench_graph_traversal<sp/>-m<sp/>omp<sp/><sp/>#<sp/>run<sp/>the<sp/>OpenMP<sp/>implementation</highlight></codeline>
</programlisting></para>
</sect2>
<sect2 id="BenchmarkTaskflow_1SpecifyTheNumberOfThreads">
<title>Specify the Number of Threads</title><para>You can configure the number of threads to run a benchmark instance by passing the option <computeroutput>-t</computeroutput>. The default value is one.</para>
<para><programlisting filename=".bash"><codeline><highlight class="normal">#<sp/>run<sp/>the<sp/>Taskflow<sp/>implementation<sp/>using<sp/>4<sp/>threads</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>./bench_graph_traversal<sp/>-m<sp/>tf<sp/>-t<sp/>4</highlight></codeline>
</programlisting></para>
<para>Depending on your environment, you may need to use <computeroutput>taskset</computeroutput> to set the CPU affinity of the running process. This allows the OS scheduler to keep process on the same CPU(s) as long as practical for performance reason.</para>
<para><programlisting filename=".bash"><codeline><highlight class="normal">#<sp/>affine<sp/>the<sp/>process<sp/>to<sp/>4<sp/>CPUs,<sp/>CPU<sp/>0,<sp/>CPU<sp/>1,<sp/>CPU<sp/>2,<sp/>and<sp/>CPU<sp/>3</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>taskset<sp/>-c<sp/>0-3<sp/>bench_graph_traversal<sp/>-t<sp/>4<sp/><sp/></highlight></codeline>
</programlisting></para>
</sect2>
<sect2 id="BenchmarkTaskflow_1SpecifyTheNumberOfRounds">
<title>Specify the Number of Rounds</title><para>Each benchmark instance evaluates the runtime of the implementation at different problem sizes. Each problem size corresponds to one iteration. You can configure the number of rounds per iteration to average the runtime.</para>
<para><programlisting filename=".bash"><codeline><highlight class="normal">#<sp/>measure<sp/>the<sp/>%Taskflow<sp/>runtime<sp/>by<sp/>averaging<sp/>the<sp/>results<sp/>over<sp/>10<sp/>runs</highlight></codeline>
<codeline><highlight class="normal">~$<sp/>./bench_graph_traversal<sp/>-r<sp/>10<sp/>-m<sp/>tf</highlight></codeline>
<codeline><highlight class="normal">|V|+|E|<sp/><sp/><sp/><sp/><sp/>Runtime</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>2<sp/><sp/><sp/><sp/><sp/><sp/><sp/>0.109<sp/><sp/><sp/>#<sp/>the<sp/>runtime<sp/>value<sp/>0.109<sp/>is<sp/>an<sp/>average<sp/>of<sp/>10<sp/>runs</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>842<sp/><sp/><sp/><sp/><sp/><sp/><sp/>0.298</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/>...<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>...</highlight></codeline>
<codeline><highlight class="normal"><sp/>619802<sp/><sp/><sp/><sp/><sp/><sp/>73.135</highlight></codeline>
<codeline><highlight class="normal"><sp/>664771<sp/><sp/><sp/><sp/><sp/><sp/>74.436</highlight></codeline>
</programlisting> </para>
</sect2>
</sect1>
</detaileddescription>
<location file="doxygen/install/benchmark_taskflow.dox"/>
</compounddef>
</doxygen>