FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fixed old async behavior in documentation · h-acker/taskflow@ce8ba07 · GitHub

fixed old async behavior in documentation · h-acker/taskflow@ce8ba07 · GitHub
Skip to content

Navigation Menu

Commit ce8ba07

Browse files
twhuang
committed
fixed old async behavior in documentation
1 parent 12f8bd4 commit ce8ba07

518 files changed

Lines changed: 24495 additions & 23464 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cmake_minimum_required (VERSION 3.18)
1414
MESSAGE(STATUS "CMAKE_ROOT: " ${CMAKE_ROOT})
1515

1616
# Project name
17-
project(Taskflow VERSION 3.6.0 LANGUAGES CXX)
17+
project(Taskflow VERSION 3.7.0 LANGUAGES CXX)
1818

1919
# build options
2020
option(TF_BUILD_BENCHMARKS "Enables builds of benchmarks" OFF)

‎README.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,26 +275,25 @@ f1_module_task.succeed(f2A, f2B)
275275
## Launch Asynchronous Tasks
276276
277277
Taskflow supports *asynchronous* tasking.
278-
You can launch tasks asynchronously to incorporate independent, dynamic
279-
parallelism in your taskflows.
278+
You can launch tasks asynchronously to dynamically explore task graph parallelism.
280279
281280
```cpp
282281
tf::Executor executor;
283-
tf::Taskflow taskflow;
284282
285283
// create asynchronous tasks directly from an executor
286-
tf::Future<std::optional<int>> future = executor.async([](){
284+
std::future<int> future = executor.async([](){
287285
std::cout << "async task returns 1\n";
288286
return 1;
289287
});
290-
executor.silent_async([](){ std::cout << "async task of no return\n"; });
288+
executor.silent_async([](){ std::cout << "async task does not return\n"; });
291289
292-
// launch an asynchronous task from a running task
293-
taskflow.emplace([&](){
294-
executor.async([](){ std::cout << "async task within a task\n"; });
295-
});
290+
// create asynchronous tasks with dynamic dependencies
291+
tf::AsyncTask A = executor.silent_dependent_async([](){ printf("A\n"); });
292+
tf::AsyncTask B = executor.silent_dependent_async([](){ printf("B\n"); }, A);
293+
tf::AsyncTask C = executor.silent_dependent_async([](){ printf("C\n"); }, A);
294+
tf::AsyncTask D = executor.silent_dependent_async([](){ printf("D\n"); }, B, C);
296295
297-
executor.run(taskflow).wait();
296+
executor.wait_for_all();
298297
```
299298

300299
## Execute a Taskflow

‎docs/Algorithms.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>Taskflow Algorithms | Taskflow QuickStart</title>
66
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
77
<link rel="stylesheet" href="m-dark+documentation.compiled.css" />
8-
<link rel="icon" href="favicon.ico" type="image/x-icon" />
8+
<link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon" />
99
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1010
<meta name="theme-color" content="#22272e" />
1111
</head>
@@ -93,7 +93,7 @@ <h1>
9393
<div class="m-container">
9494
<div class="m-row">
9595
<div class="m-col-l-10 m-push-l-1">
96-
<p>Taskflow handbook is part of the <a href="https://taskflow.github.io">Taskflow project</a>, copyright © <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>, 2018&ndash;2023.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.9.6 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
96+
<p>Taskflow handbook is part of the <a href="https://taskflow.github.io">Taskflow project</a>, copyright © <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>, 2018&ndash;2023.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.8.14 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
9797
</div>
9898
</div>
9999
</div>

‎docs/AsyncTasking.html‎

Lines changed: 57 additions & 57 deletions
Large diffs are not rendered by default.

‎docs/BenchmarkTaskflow.html‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>Building and Installing &raquo; Benchmark Taskflow | Taskflow QuickStart</title>
66
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
77
<link rel="stylesheet" href="m-dark+documentation.compiled.css" />
8-
<link rel="icon" href="favicon.ico" type="image/x-icon" />
8+
<link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon" />
99
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1010
<meta name="theme-color" content="#22272e" />
1111
</head>
@@ -63,7 +63,7 @@ <h3>Contents</h3>
6363
</li>
6464
</ul>
6565
</nav>
66-
<section id="CompileAndRunBenchmarks"><h2><a href="#CompileAndRunBenchmarks">Compile and Run Benchmarks</a></h2><p>To build the benchmark code, enable the CMake option <code>TF_BUILD_BENCHMARKS</code> to <code>ON</code> as follows:</p><pre class="m-console"><span class="gp"># </span>under<span class="w"> </span>/taskflow/build
66+
<section id="CompileAndRunBenchmarks"><h2><a href="#CompileAndRunBenchmarks">Compile and Run Benchmarks</a></h2><p>To build the benchmark code, enable the CMake option <code>TF_BUILD_BENCHMARKS</code> to <code>ON</code> as follows:</p><pre class="m-console"><span class="gp"># </span>under /taskflow/build
6767
<span class="go">~$ cmake ../ -DTF_BUILD_BENCHMARKS=ON</span>
6868
<span class="go">~$ make</span></pre><p>After you successfully build the benchmark code, you can find all benchmark instances in the <code>benchmarks/</code> folder. You can run the executable of each instance in the corresponding folder.</p><pre class="m-console"><span class="go">~$ cd benchmarks &amp; ls</span>
6969
<span class="go">black_scholes binary_tree graph_traversal ...</span>
@@ -77,7 +77,7 @@ <h3>Contents</h3>
7777
<span class="go"> ... ...</span>
7878
<span class="go"> 619802 75.135</span>
7979
<span class="go"> 664771 77.436</span>
80-
<span class="go"> 711200 83.957</span></pre><p>You can display the help message by giving the option <code>--help</code>.</p><pre class="m-console"><span class="go">~$ ./graph_traversal --help</span>
80+
<span class="go"> 711200 83.957</span></pre><p>You can display the help message by giving the option <code>&ndash;help</code>.</p><pre class="m-console"><span class="go">~$ ./graph_traversal --help</span>
8181
<span class="go">Graph Traversal</span>
8282
<span class="go">Usage: ./graph_traversal [OPTIONS]</span>
8383

@@ -87,9 +87,9 @@ <h3>Contents</h3>
8787
<span class="go"> -r,--num_rounds UINT number of rounds (default=1)</span>
8888
<span class="go"> -m,--model TEXT model name tbb|omp|tf (default=tf)</span></pre><p>We currently implement the following instances that are commonly used by the parallel computing community to evaluate the system performance.</p><table class="m-table"><thead><tr><th>Instance</th><th>Description</th></tr></thead><tbody><tr><td>binary_tree</td><td>traverses a complete binary tree</td></tr><tr><td>black_scholes</td><td>computes option pricing with Black-Shcoles Models</td></tr><tr><td>graph_traversal</td><td>traverses a randomly generated direct acyclic graph</td></tr><tr><td>linear_chain</td><td>traverses a linear chain of tasks</td></tr><tr><td>mandelbrot</td><td>exploits imbalanced workloads in a Mandelbrot set</td></tr><tr><td>matrix_multiplication</td><td>multiplies two 2D matrices</td></tr><tr><td>mnist</td><td>trains a neural network-based image classifier on the MNIST dataset</td></tr><tr><td>parallel_sort</td><td>sorts a range of items</td></tr><tr><td>reduce_sum</td><td>sums a range of items using reduction</td></tr><tr><td>wavefront</td><td>propagates computations in a 2D grid</td></tr><tr><td>linear_pipeline</td><td>pipeline scheduling on a linear chain of pipes</td></tr><tr><td>graph_pipeline</td><td>pipeline scheduling on a graph of pipes</td></tr></tbody></table></section><section id="ConfigureRunOptions"><h2><a href="#ConfigureRunOptions">Configure Run Options</a></h2><p>We implement consistent options for each benchmark instance. Common options are:</p><table class="m-table"><thead><tr><th>option</th><th>value</th><th>function</th></tr></thead><tbody><tr><td><code>-h</code></td><td>none</td><td>display the help message</td></tr><tr><td><code>-t</code></td><td>integer</td><td>configure the number of threads to run</td></tr><tr><td><code>-r</code></td><td>integer</td><td>configure the number of rounds to run</td></tr><tr><td><code>-m</code></td><td>string</td><td>configure the baseline models to run, tbb, omp, or tf</td></tr></tbody></table><p>You can configure the benchmarking environment by giving different options.</p><section id="SpecifyTheRunModel"><h3><a href="#SpecifyTheRunModel">Specify the Run Model</a></h3><p>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, <a href="https://www.openmp.org/">OpenMP</a> and <a href="https://github.com/oneapi-src/oneTBB">Intel TBB</a>, to measure and evaluate the performance of Taskflow. You can select different implementations by passing the option <code>-m</code>.</p><pre class="m-console"><span class="go">~$ ./graph_traversal -m tf # run the Taskflow implementation (default)</span>
8989
<span class="go">~$ ./graph_traversal -m tbb # run the TBB implementation</span>
90-
<span class="go">~$ ./graph_traversal -m omp # run the OpenMP implementation</span></pre></section><section id="SpecifyTheNumberOfThreads"><h3><a href="#SpecifyTheNumberOfThreads">Specify the Number of Threads</a></h3><p>You can configure the number of threads to run a benchmark instance by passing the option <code>-t</code>. The default value is one.</p><pre class="m-console"><span class="gp"># </span>run<span class="w"> </span>the<span class="w"> </span>Taskflow<span class="w"> </span>implementation<span class="w"> </span>using<span class="w"> </span><span class="m">4</span><span class="w"> </span>threads
91-
<span class="go">~$ ./graph_traversal -m tf -t 4</span></pre><p>Depending on your environment, you may need to use <code>taskset</code> 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.</p><pre class="m-console"><span class="gp"># </span>affine<span class="w"> </span>the<span class="w"> </span>process<span class="w"> </span>to<span class="w"> </span><span class="m">4</span><span class="w"> </span>CPUs,<span class="w"> </span>CPU<span class="w"> </span><span class="m">0</span>,<span class="w"> </span>CPU<span class="w"> </span><span class="m">1</span>,<span class="w"> </span>CPU<span class="w"> </span><span class="m">2</span>,<span class="w"> </span>and<span class="w"> </span>CPU<span class="w"> </span><span class="m">3</span>
92-
<span class="go">~$ taskset -c 0-3 graph_traversal -t 4 </span></pre></section><section id="SpecifyTheNumberOfRounds"><h3><a href="#SpecifyTheNumberOfRounds">Specify the Number of Rounds</a></h3><p>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.</p><pre class="m-console"><span class="gp"># </span>measure<span class="w"> </span>the<span class="w"> </span>runtime<span class="w"> </span><span class="k">in</span><span class="w"> </span>an<span class="w"> </span>average<span class="w"> </span>of<span class="w"> </span><span class="m">10</span><span class="w"> </span>runs
90+
<span class="go">~$ ./graph_traversal -m omp # run the OpenMP implementation</span></pre></section><section id="SpecifyTheNumberOfThreads"><h3><a href="#SpecifyTheNumberOfThreads">Specify the Number of Threads</a></h3><p>You can configure the number of threads to run a benchmark instance by passing the option <code>-t</code>. The default value is one.</p><pre class="m-console"><span class="gp"># </span>run the Taskflow implementation using <span class="m">4</span> threads
91+
<span class="go">~$ ./graph_traversal -m tf -t 4</span></pre><p>Depending on your environment, you may need to use <code>taskset</code> 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.</p><pre class="m-console"><span class="gp"># </span>affine the process to <span class="m">4</span> CPUs, CPU <span class="m">0</span>, CPU <span class="m">1</span>, CPU <span class="m">2</span>, and CPU <span class="m">3</span>
92+
<span class="go">~$ taskset -c 0-3 graph_traversal -t 4 </span></pre></section><section id="SpecifyTheNumberOfRounds"><h3><a href="#SpecifyTheNumberOfRounds">Specify the Number of Rounds</a></h3><p>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.</p><pre class="m-console"><span class="gp"># </span>measure the runtime <span class="k">in</span> an average of <span class="m">10</span> runs
9393
<span class="go">~$ ./graph_traversal -r 10</span>
9494
<span class="go">|V|+|E| Runtime</span>
9595
<span class="go"> 2 0.109 # the runtime value 0.109 is an average of 10 runs</span>
@@ -141,7 +141,7 @@ <h3>Contents</h3>
141141
<div class="m-container">
142142
<div class="m-row">
143143
<div class="m-col-l-10 m-push-l-1">
144-
<p>Taskflow handbook is part of the <a href="https://taskflow.github.io">Taskflow project</a>, copyright © <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>, 2018&ndash;2023.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.9.6 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
144+
<p>Taskflow handbook is part of the <a href="https://taskflow.github.io">Taskflow project</a>, copyright © <a href="https://tsung-wei-huang.github.io/">Dr. Tsung-Wei Huang</a>, 2018&ndash;2023.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.8.14 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
145145
</div>
146146
</div>
147147
</div>

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.

Back | FazBrowse Home | New Git URL