mesytec-mnode/external/taskflow-3.8.0/docs/FAQ.html

231 lines
24 KiB
HTML
Raw Normal View History

2025-01-04 01:25:05 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Frequently Asked Questions | Taskflow QuickStart</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
<link rel="stylesheet" href="m-dark+documentation.compiled.css" />
<link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#22272e" />
</head>
<body>
<header><nav id="navigation">
<div class="m-container">
<div class="m-row">
<span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
<a href="https://taskflow.github.io"><img src="taskflow_logo.png" alt="" />Taskflow</a> <span class="m-breadcrumb">|</span> <a href="index.html" class="m-thin">QuickStart</a>
</span>
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
<a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
</svg></a>
<a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
<a id="m-navbar-hide" href="#" title="Hide navigation"></a>
</div>
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
<div class="m-row">
<ol class="m-col-t-6 m-col-m-none">
<li><a href="pages.html">Handbook</a></li>
<li><a href="namespaces.html">Namespaces</a></li>
</ol>
<ol class="m-col-t-6 m-col-m-none" start="3">
<li><a href="annotated.html">Classes</a></li>
<li><a href="files.html">Files</a></li>
<li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<use href="#m-doc-search-icon-path" />
</svg></a></li>
</ol>
</div>
</div>
</div>
</div>
</nav></header>
<main><article>
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<h1>
Frequently Asked Questions
</h1>
<nav class="m-block m-default">
<h3>Contents</h3>
<ul>
<li>
<a href="#GeneralQuestions">General Questions</a>
<ul>
<li><a href="#GeneralQuestion1">Q1: What&#x27;s the goal of Taskflow?</a></li>
<li><a href="#GeneralQuestion2">Q2: How do I use Taskflow in my projects?</a></li>
<li><a href="#GeneralQuestion3">Q3: What is the difference between static tasking and dynamic tasking?</a></li>
<li><a href="#GeneralQuestion4">Q4: How many tasks can Taskflow handle?</a></li>
<li><a href="#GeneralQuestion5">Q5: What is the weird hex value, like 0x7fc39d402ab0, in the dumped graph?</a></li>
<li><a href="#GeneralQuestion6">Q6: Does Taskflow have backward compatibility with C++03/98/11/14?</a></li>
<li><a href="#GeneralQuestion7">Q7: How does Taskflow schedule tasks?</a></li>
<li><a href="#GeneralQuestion8">Q8: What is the overhead of taskflow?</a></li>
<li><a href="#GeneralQuestion9">Q9: How does it compare to existing task programming systems?</a></li>
<li><a href="#GeneralQuestion10">Q10: Do you try to simplify the GPU kernel programming?</a></li>
<li><a href="#GeneralQuestion11">Q11: Do you have any real use cases?</a></li>
<li><a href="#GeneralQuestion12">Q12: Who is the Principal Investigator of Taskflow I can talk to?</a></li>
<li><a href="#GeneralQuestion13">Q13: Who are developing and maintaining Taskflow?</a></li>
<li><a href="#GeneralQuestion14">Q14: Is Taskflow just an another API or model?</a></li>
<li><a href="#GeneralQuestion15">Q15: How can I contribute?</a></li>
<li><a href="#GeneralQuestion16">Q16: Does Taskflow support pipeline parallelism?</a></li>
</ul>
</li>
<li>
<a href="#ProgrammingQuestions">Programming Questions</a>
<ul>
<li><a href="#ProgrammingQuestions1">Q1: What is the difference between Taskflow threads and workers?</a></li>
<li><a href="#ProgrammingQuestions2">Q2: What is the Lifetime of a Task and a Graph?</a></li>
<li><a href="#ProgrammingQuestions3">Q3: Is taskflow thread-safe?</a></li>
<li><a href="#ProgrammingQuestions4">Q4: Is executor thread-safe?</a></li>
<li><a href="#ProgrammingQuestions5">Q5: My program hangs and never returns after dispatching a taskflow graph. What&#x27;s wrong?</a></li>
<li><a href="#ProgrammingQuestions6">Q6: In the following example where B spawns a joined subflow of three tasks B1, B2, and B3, do they run concurrently with task A?</a></li>
<li><a href="#ProgrammingQuestions7">Q7: What is the purpose of a condition task?</a></li>
<li><a href="#ProgrammingQuestions8">Q8: Is the program master thread involved in running tasks?</a></li>
<li><a href="#ProgrammingQuestions9">Q9: Are there any limits on the branches of conditional tasking?</a></li>
<li><a href="#ProgrammingQuestions10">Q10: Why does Taskflow program GPU in a task graph?</a></li>
<li><a href="#ProgrammingQuestions11">Q11: Can I limit the concurrency in certain sections of tasks?</a></li>
<li><a href="#ProgrammingQuestions12">Q12: How can I attach custom data to a task and access it?</a></li>
</ul>
</li>
</ul>
</nav>
<p>This page summarizes a list of frequently asked questions about Taskflow. If you cannot find a solution here, please post an issue at <a href="https://github.com/taskflow/taskflow/issues">here</a>.</p><section id="GeneralQuestions"><h2><a href="#GeneralQuestions">General Questions</a></h2><section id="GeneralQuestion1"><h3><a href="#GeneralQuestion1">Q1: What&#x27;s the goal of Taskflow?</a></h3><p>Taskflow aims to help C++ developers quickly implement efficient parallel decomposition strategies using task-based approaches.</p></section><section id="GeneralQuestion2"><h3><a href="#GeneralQuestion2">Q2: How do I use Taskflow in my projects?</a></h3><p>Taskflow is a header-only library with zero dependencies. The only thing you need is a C++17 compiler. To use Taskflow, simply drop the folder <code>taskflow/</code> to your project and include taskflow.hpp.</p></section><section id="GeneralQuestion3"><h3><a href="#GeneralQuestion3">Q3: What is the difference between static tasking and dynamic tasking?</a></h3><p>Static tasking refers to those tasks created before execution, while dynamic tasking refers to those tasks created during the execution of static tasks or dynamic tasks (nested). Dynamic tasks created by the same task node are grouped together to a subflow.</p></section><section id="GeneralQuestion4"><h3><a href="#GeneralQuestion4">Q4: How many tasks can Taskflow handle?</a></h3><p>Benchmarks showed Taskflow can efficiently handle millions or billions of tasks (both large and small tasks) on a machine with up to 64 CPUs.</p></section><section id="GeneralQuestion5"><h3><a href="#GeneralQuestion5">Q5: What is the weird hex value, like 0x7fc39d402ab0, in the dumped graph?</a></h3><p>The hex value represents the memory address of the task. Each task has a method <a href="classtf_1_1Task.html#a9057ecd0f3833b717480e914f8568f02" class="m-doc">tf::<wbr />Task::<wbr />name(const std::<wbr />string&amp;)</a> for user to assign a human readable string to ease the debugging process. If a task is not assigned a name or is an internal node, its address value in the memory is used instead.</p></section><section id="GeneralQuestion6"><h3><a href="#GeneralQuestion6">Q6: Does Taskflow have backward compatibility with C++03/98/11/14?</a></h3><p>Unfortunately, Taskflow is heavily relying on modern C++17&#x27;s features/idoms/STL and it is very difficult to provide a version that compiles under older C++ versions.</p></section><section id="GeneralQuestion7"><h3><a href="#GeneralQuestion7">Q7: How does Taskflow schedule tasks?</a></h3><p>Taskflow implemented a very efficient <a href="https://en.wikipedia.org/wiki/Work_stealing">work-stealing scheduler</a> to execute task dependency graphs. The source code is available at <code><a href="executor_8hpp.html" class="m-doc">taskflow/<wbr />core/<wbr />executor.hpp</a></code>.</p></section><section id="GeneralQuestion8"><h3><a href="#GeneralQuestion8">Q8: What is the overhead of taskflow?</a></h3><p>Creating a taskflow has certain overhead. For example, creating a task and a dependency takes about 61 and 14 nanoseconds in our system (Intel 4-core CPU at 2.00GHz). The time is amortized over 1M operations, since we have implemented an object pool to recycle tasks for minimal overhead.</p></section><section id="GeneralQuestion9"><h3><a href="#GeneralQuestion9">Q9: How does it compare to existing task programming systems?</a></h3><p>There is a large amount of work on programming systems (e.g., StarPU, Intel TBB, OpenMP, PaRSEC, Kokkos, HPX) in the interest of simplifying the programming complexity of parallel and heterogeneous computing. Each of these systems has its own pros and cons and deserves a reason to exist. However, they do have some problems, particularly from the standpoint of ease of use, static control flow, and scheduling efficiency. Taskflow addresses these limitations through a simple, expressive, and transparent graph programming model.</p></section><section id="GeneralQuestion10"><h3><a href="#GeneralQuestion10">Q10: Do you try to simplify the GPU kernel programming?</a></h3>
<g transform="scale(1 1) rotate(0) translate(4 224)">
<title>Taskflow</title>
<g class="m-cluster">
<title>cluster_p0x7ffee9781810</title>
<polygon points="8,-8 8,-212 356,-212 356,-8 8,-8"/>
<text text-anchor="middle" x="182" y="-200" font-family="Helvetica,sans-Serif" font-size="10.00">Taskflow</text>
</g>
<g class="m-cluster">
<title>cluster_p0x7f9866c01b70</title>
<polygon points="16,-60 16,-185 266,-185 266,-60 16,-60"/>
<text text-anchor="middle" x="141" y="-173" font-family="Helvetica,sans-Serif" font-size="10.00">Subflow: B</text>
</g>
<g class="m-node m-flat">
<title>p0x7f9866c01820</title>
<ellipse cx="141" cy="-34" rx="27" ry="18"/>
<text text-anchor="middle" x="141" y="-31.5" font-family="Helvetica,sans-Serif" font-size="10.00">A</text>
</g>
<g class="m-node m-flat">
<title>p0x7f9866c01b70</title>
<ellipse cx="231" cy="-88" rx="27" ry="18"/>
<text text-anchor="middle" x="231" y="-85.5" font-family="Helvetica,sans-Serif" font-size="10.00">B</text>
</g>
<g class="m-edge">
<title>p0x7f9866c01820&#45;&gt;p0x7f9866c01b70</title>
<path d="M161.53,-45.98C173.38,-53.26 188.7,-62.66 201.84,-70.72"/>
<polygon points="200.17,-73.8 210.52,-76.05 203.83,-67.84 200.17,-73.8"/>
</g>
<g class="m-node m-flat">
<title>p0x7f9866c01930</title>
<ellipse cx="231" cy="-34" rx="27" ry="18"/>
<text text-anchor="middle" x="231" y="-31.5" font-family="Helvetica,sans-Serif" font-size="10.00">C</text>
</g>
<g class="m-edge">
<title>p0x7f9866c01820&#45;&gt;p0x7f9866c01930</title>
<path d="M168.4,-34C176.39,-34 185.31,-34 193.82,-34"/>
<polygon points="193.92,-37.5 203.92,-34 193.92,-30.5 193.92,-37.5"/>
</g>
<g class="m-node m-flat">
<title>p0x7f9866c01a40</title>
<ellipse cx="321" cy="-61" rx="27" ry="18"/>
<text text-anchor="middle" x="321" y="-58.5" font-family="Helvetica,sans-Serif" font-size="10.00">D</text>
</g>
<g class="m-edge">
<title>p0x7f9866c01b70&#45;&gt;p0x7f9866c01a40</title>
<path d="M256.05,-80.62C265.44,-77.74 276.36,-74.39 286.5,-71.28"/>
<polygon points="287.75,-74.55 296.29,-68.28 285.7,-67.86 287.75,-74.55"/>
</g>
<g class="m-edge">
<title>p0x7f9866c01930&#45;&gt;p0x7f9866c01a40</title>
<path d="M256.05,-41.38C265.44,-44.26 276.36,-47.61 286.5,-50.72"/>
<polygon points="285.7,-54.14 296.29,-53.72 287.75,-47.45 285.7,-54.14"/>
</g>
<g class="m-node m-flat">
<title>p0x7f9866d01880</title>
<ellipse cx="51" cy="-140" rx="27" ry="18"/>
<text text-anchor="middle" x="51" y="-137.5" font-family="Helvetica,sans-Serif" font-size="10.00">B1</text>
</g>
<g class="m-node m-flat">
<title>p0x7f9866d01ac0</title>
<ellipse cx="141" cy="-88" rx="27" ry="18"/>
<text text-anchor="middle" x="141" y="-85.5" font-family="Helvetica,sans-Serif" font-size="10.00">B3</text>
</g>
<g class="m-edge">
<title>p0x7f9866d01880&#45;&gt;p0x7f9866d01ac0</title>
<path d="M71.97,-128.2C83.56,-121.35 98.35,-112.61 111.19,-105.03"/>
<polygon points="113.28,-107.85 120.11,-99.75 109.72,-101.83 113.28,-107.85"/>
</g>
<g class="m-edge">
<title>p0x7f9866d01ac0&#45;&gt;p0x7f9866c01b70</title>
<path d="M168.4,-88C176.39,-88 185.31,-88 193.82,-88"/>
<polygon points="193.92,-91.5 203.92,-88 193.92,-84.5 193.92,-91.5"/>
</g>
<g class="m-node m-flat">
<title>p0x7f9866d019a0</title>
<ellipse cx="51" cy="-86" rx="27" ry="18"/>
<text text-anchor="middle" x="51" y="-83.5" font-family="Helvetica,sans-Serif" font-size="10.00">B2</text>
</g>
<g class="m-edge">
<title>p0x7f9866d019a0&#45;&gt;p0x7f9866d01ac0</title>
<path d="M78.4,-86.6C86.39,-86.78 95.31,-86.98 103.82,-87.18"/>
<polygon points="103.84,-90.68 113.92,-87.41 104,-83.68 103.84,-90.68"/>
</g>
</g>
</svg>
</div><p>No. The subflow is spawned during the execution of <code>B</code>, and at this point <code>A</code> must have finished because <code>A</code> precedes <code>B</code>. This gives rise to the fact <code>B1</code> and <code>B2</code> must run after <code>A</code>.</p></section><section id="ProgrammingQuestions7"><h3><a href="#ProgrammingQuestions7">Q7: What is the purpose of a condition task?</a></h3><p>A condition task lets you perform <em>in-task</em> decision making so you can integrate control flow into a task graph with end-to-end parallelism without synchronizing or partitioning your parallelism across conditionals.</p></section><section id="ProgrammingQuestions8"><h3><a href="#ProgrammingQuestions8">Q8: Is the program master thread involved in running tasks?</a></h3><p>No, the program master thread is not involved in running taskflows. The executor keeps a set of private worker threads spawned upon construction time to run tasks.</p></section><section id="ProgrammingQuestions9"><h3><a href="#ProgrammingQuestions9">Q9: Are there any limits on the branches of conditional tasking?</a></h3><p>No, as long as the return value points to a valid successors, your conditional tasking is valid.</p></section><section id="ProgrammingQuestions10"><h3><a href="#ProgrammingQuestions10">Q10: Why does Taskflow program GPU in a task graph?</a></h3><p>We ask users to describe a GPU workload in a task graph and execute it in a second moment. This organization minimizes kernels launch overhead and allows the GPU runtime (e.g., CUDA) to optimize the whole workflow.</p></section><section id="ProgrammingQuestions11"><h3><a href="#ProgrammingQuestions11">Q11: Can I limit the concurrency in certain sections of tasks?</a></h3><p>Yes, Taskflow provides a lightweight mechanism, <a href="classtf_1_1Semaphore.html" class="m-doc">tf::<wbr />Semaphore</a>, for you to limit the maximum concurrency (i.e., the number of workers) in a section of tasks. Please refer to <a href="LimitTheMaximumConcurrency.html" class="m-doc">Limit the Maximum Concurrency</a>.</p></section><section id="ProgrammingQuestions12"><h3><a href="#ProgrammingQuestions12">Q12: How can I attach custom data to a task and access it?</a></h3><p>Each node in a taskflow is associated with a C-styled data pointer (i.e., <code>void*</code>) you can use to point to user data and access it in the body of a task callable. Please refer to <a href="StaticTasking.html#AttachUserDataToATask" class="m-doc">Attach User Data to a Task</a>.</p></section></section>
</div>
</div>
</div>
</article></main>
<div class="m-doc-search" id="search">
<a href="#!" onclick="return hideSearch()"></a>
<div class="m-container">
<div class="m-row">
<div class="m-col-m-8 m-push-m-2">
<div class="m-doc-search-header m-text m-small">
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
<div id="search-symbolcount">&hellip;</div>
</div>
<div class="m-doc-search-content">
<form>
<input type="search" name="q" id="search-input" placeholder="Loading &hellip;" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
</form>
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
<div id="search-help" class="m-text m-dim m-text-center">
<p class="m-noindent">Search for symbols, directories, files, pages or
modules. You can omit any prefix from the symbol or file path; adding a
<code>:</code> or <code>/</code> suffix lists all members of given symbol or
directory.</p>
<p class="m-noindent">Use <span class="m-label m-dim">&darr;</span>
/ <span class="m-label m-dim">&uarr;</span> to navigate through the list,
<span class="m-label m-dim">Enter</span> to go.
<span class="m-label m-dim">Tab</span> autocompletes common prefix, you can
copy a link to the result using <span class="m-label m-dim"></span>
<span class="m-label m-dim">L</span> while <span class="m-label m-dim"></span>
<span class="m-label m-dim">M</span> produces a Markdown link.</p>
</div>
<div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
<ul id="search-results"></ul>
</div>
</div>
</div>
</div>
</div>
<script src="search-v2.js"></script>
<script src="searchdata-v2.js" async="async"></script>
<footer><nav>
<div class="m-container">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<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;2024.<br />Generated by <a href="https://doxygen.org/">Doxygen</a> 1.9.1 and <a href="https://mcss.mosra.cz/">m.css</a>.</p>
</div>
</div>
</div>
</nav></footer>
</body>
</html>