| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 12f8bd4 commit ce8ba07
518 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ cmake_minimum_required (VERSION 3.18) | |||
| 14 | 14 | MESSAGE(STATUS "CMAKE_ROOT: " ${CMAKE_ROOT}) | |
| 15 | 15 | ||
| 16 | 16 | # Project name | |
| 17 | - project(Taskflow VERSION 3.6.0 LANGUAGES CXX) | ||
| 17 | + project(Taskflow VERSION 3.7.0 LANGUAGES CXX) | ||
| 18 | 18 | ||
| 19 | 19 | # build options | |
| 20 | 20 | option(TF_BUILD_BENCHMARKS "Enables builds of benchmarks" OFF) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -275,26 +275,25 @@ f1_module_task.succeed(f2A, f2B) | |||
| 275 | 275 | ## Launch Asynchronous Tasks | |
| 276 | 276 | ||
| 277 | 277 | 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. | ||
| 280 | 279 | ||
| 281 | 280 | ```cpp | |
| 282 | 281 | tf::Executor executor; | |
| 283 | - tf::Taskflow taskflow; | ||
| 284 | 282 | ||
| 285 | 283 | // create asynchronous tasks directly from an executor | |
| 286 | - tf::Future<std::optional<int>> future = executor.async([](){ | ||
| 284 | + std::future<int> future = executor.async([](){ | ||
| 287 | 285 | std::cout << "async task returns 1\n"; | |
| 288 | 286 | return 1; | |
| 289 | 287 | }); | |
| 290 | - executor.silent_async([](){ std::cout << "async task of no return\n"; }); | ||
| 288 | + executor.silent_async([](){ std::cout << "async task does not return\n"; }); | ||
| 291 | 289 | ||
| 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); | ||
| 296 | 295 | ||
| 297 | - executor.run(taskflow).wait(); | ||
| 296 | + executor.wait_for_all(); | ||
| 298 | 297 | ``` | |
| 299 | 298 | ||
| 300 | 299 | ## Execute a Taskflow | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | <title>Taskflow Algorithms | Taskflow QuickStart</title> | |
| 6 | 6 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" /> | |
| 7 | 7 | <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" /> | ||
| 9 | 9 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| 10 | 10 | <meta name="theme-color" content="#22272e" /> | |
| 11 | 11 | </head> | |
@@ -93,7 +93,7 @@ <h1> | |||
| 93 | 93 | <div class="m-container"> | |
| 94 | 94 | <div class="m-row"> | |
| 95 | 95 | <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–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–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> | ||
| 97 | 97 | </div> | |
| 98 | 98 | </div> | |
| 99 | 99 | </div> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | <title>Building and Installing » Benchmark Taskflow | Taskflow QuickStart</title> | |
| 6 | 6 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" /> | |
| 7 | 7 | <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" /> | ||
| 9 | 9 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| 10 | 10 | <meta name="theme-color" content="#22272e" /> | |
| 11 | 11 | </head> | |
@@ -63,7 +63,7 @@ <h3>Contents</h3> | |||
| 63 | 63 | </li> | |
| 64 | 64 | </ul> | |
| 65 | 65 | </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 | ||
| 67 | 67 | <span class="go">~$ cmake ../ -DTF_BUILD_BENCHMARKS=ON</span> | |
| 68 | 68 | <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 & ls</span> | |
| 69 | 69 | <span class="go">black_scholes binary_tree graph_traversal ...</span> | |
@@ -77,7 +77,7 @@ <h3>Contents</h3> | |||
| 77 | 77 | <span class="go"> ... ...</span> | |
| 78 | 78 | <span class="go"> 619802 75.135</span> | |
| 79 | 79 | <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>–help</code>.</p><pre class="m-console"><span class="go">~$ ./graph_traversal --help</span> | ||
| 81 | 81 | <span class="go">Graph Traversal</span> | |
| 82 | 82 | <span class="go">Usage: ./graph_traversal [OPTIONS]</span> | |
| 83 | 83 | ||
@@ -87,9 +87,9 @@ <h3>Contents</h3> | |||
| 87 | 87 | <span class="go"> -r,--num_rounds UINT number of rounds (default=1)</span> | |
| 88 | 88 | <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> | |
| 89 | 89 | <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 | ||
| 93 | 93 | <span class="go">~$ ./graph_traversal -r 10</span> | |
| 94 | 94 | <span class="go">|V|+|E| Runtime</span> | |
| 95 | 95 | <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> | |||
| 141 | 141 | <div class="m-container"> | |
| 142 | 142 | <div class="m-row"> | |
| 143 | 143 | <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–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–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> | ||
| 145 | 145 | </div> | |
| 146 | 146 | </div> | |
| 147 | 147 | </div> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments