|
| 1 | +<!-- HTML header for doxygen 1.8.13--> |
| 2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | +<head> |
| 5 | +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 6 | +<meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 7 | +<meta name="generator" content="Doxygen 1.8.13"/> |
| 8 | +<meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 9 | +<title>Cpp-Taskflow</title> |
| 10 | +<link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 11 | +<link rel="icon" type="image/x-icon" href="favicon.ico" /> |
| 12 | +<script type="text/javascript" src="jquery.js"></script> |
| 13 | +<script type="text/javascript" src="dynsections.js"></script> |
| 14 | +<link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 15 | +<script type="text/javascript" src="resize.js"></script> |
| 16 | +<script type="text/javascript" src="navtreedata.js"></script> |
| 17 | +<script type="text/javascript" src="navtree.js"></script> |
| 18 | +<script type="text/javascript"> |
| 19 | + $(document).ready(initResizable); |
| 20 | +</script> |
| 21 | +<link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 22 | +<script type="text/javascript" src="search/searchdata.js"></script> |
| 23 | +<script type="text/javascript" src="search/search.js"></script> |
| 24 | +<script type="text/javascript"> |
| 25 | + $(document).ready(function() { init_search(); }); |
| 26 | +</script> |
| 27 | +<link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 28 | +</head> |
| 29 | +<body> |
| 30 | +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 31 | +<div id="titlearea"> |
| 32 | +<table cellspacing="0" cellpadding="0"> |
| 33 | + <tbody> |
| 34 | + <tr style="height: 56px;"> |
| 35 | + <td id="projectalign" style="padding-left: 0.5em;"> |
| 36 | + <div id="projectname"><a href="https://github.com/cpp-taskflow/cpp-taskflow">Cpp-Taskflow</a> |
| 37 | +  <span id="projectnumber">2.0.0</span> |
| 38 | + </div> |
| 39 | + </td> |
| 40 | + <td> <div id="MSearchBox" class="MSearchBoxInactive"> |
| 41 | + <span class="left"> |
| 42 | + <img id="MSearchSelect" src="search/mag_sel.png" |
| 43 | + onmouseover="return searchBox.OnSearchSelectShow()" |
| 44 | + onmouseout="return searchBox.OnSearchSelectHide()" |
| 45 | + alt=""/> |
| 46 | + <input type="text" id="MSearchField" value="Search" accesskey="S" |
| 47 | + onfocus="searchBox.OnSearchFieldFocus(true)" |
| 48 | + onblur="searchBox.OnSearchFieldFocus(false)" |
| 49 | + onkeyup="searchBox.OnSearchFieldChange(event)"/> |
| 50 | + </span><span class="right"> |
| 51 | + <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> |
| 52 | + </span> |
| 53 | + </div> |
| 54 | +</td> |
| 55 | + </tr> |
| 56 | + </tbody> |
| 57 | +</table> |
| 58 | +</div> |
| 59 | +<!-- end header part --> |
| 60 | +<!-- Generated by Doxygen 1.8.13 --> |
| 61 | +<script type="text/javascript"> |
| 62 | +var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 63 | +</script> |
| 64 | +</div><!-- top --> |
| 65 | +<div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 66 | + <div id="nav-tree"> |
| 67 | + <div id="nav-tree-contents"> |
| 68 | + <div id="nav-sync" class="sync"></div> |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + <div id="splitbar" style="-moz-user-select:none;" |
| 72 | + class="ui-resizable-handle"> |
| 73 | + </div> |
| 74 | +</div> |
| 75 | +<script type="text/javascript"> |
| 76 | +$(document).ready(function(){initNavTree('FAQ.html','');}); |
| 77 | +</script> |
| 78 | +<div id="doc-content"> |
| 79 | +<!-- window showing the filter options --> |
| 80 | +<div id="MSearchSelectWindow" |
| 81 | + onmouseover="return searchBox.OnSearchSelectShow()" |
| 82 | + onmouseout="return searchBox.OnSearchSelectHide()" |
| 83 | + onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 84 | +</div> |
| 85 | + |
| 86 | +<!-- iframe showing the search results (closed by default) --> |
| 87 | +<div id="MSearchResultsWindow"> |
| 88 | +<iframe src="javascript:void(0)" frameborder="0" |
| 89 | + name="MSearchResults" id="MSearchResults"> |
| 90 | +</iframe> |
| 91 | +</div> |
| 92 | + |
| 93 | +<div class="header"> |
| 94 | + <div class="headertitle"> |
| 95 | +<div class="title">Frequently Asked Questions </div> </div> |
| 96 | +</div><!--header--> |
| 97 | +<div class="contents"> |
| 98 | +<div class="textblock"><p>This page summarizes a list of frequently asked questions about Cpp-Taskflow. If you cannot find a solution here, please post an issue at <a href="https://github.com/cpp-taskflow/cpp-taskflow/issues">here</a>.</p> |
| 99 | +<h1><a class="anchor" id="GeneralQuestions"></a> |
| 100 | +General Questions</h1> |
| 101 | +<h2><a class="anchor" id="GeneralQuestion1"></a> |
| 102 | +Q1: What's the goal of Cpp-Taskflow?</h2> |
| 103 | +<p>Cpp-Taskflow aims to help C++ developers quickly implement efficient parallel decomposition strategies using task-based approaches.</p> |
| 104 | +<h2><a class="anchor" id="GeneralQuestion2"></a> |
| 105 | +Q2: How do I use Cpp-Taskflow in my projects?</h2> |
| 106 | +<p>Cpp-Taskflow is a header-only library with zero dependencies. The only thing you need is a <a href="https://en.wikipedia.org/wiki/C%2B%2B17">C++17</a> compiler. To use Cpp-Taskflow, simply drop the folder <code>taskflow/</code> to your project and include <a class="el" href="taskflow_8hpp_source.html">taskflow.hpp</a>.</p> |
| 107 | +<h2><a class="anchor" id="GeneralQuestion3"></a> |
| 108 | +Q3: What is the difference between static tasking and dynamic tasking?</h2> |
| 109 | +<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> |
| 110 | +<h2><a class="anchor" id="GeneralQuestion4"></a> |
| 111 | +Q4: How many tasks can Cpp-Taskflow handle?</h2> |
| 112 | +<p>Benchmarks showed Cpp-Taskflow can efficiently handle millions or billions of tasks (both large and small tasks) on a machine with up to 64 CPUs.</p> |
| 113 | +<h2><a class="anchor" id="GeneralQuestion5"></a> |
| 114 | +Q5: What is the weird hex value, like 0x7fc39d402ab0, in the dumped graph?</h2> |
| 115 | +<p>The hex value represents the memory address of the task. Each task has a method <a class="el" href="classtf_1_1Task.html#a9057ecd0f3833b717480e914f8568f02" title="assigns a name to the task ">tf::Task::name(const std::string&)</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><hr/> |
| 116 | +<h1><a class="anchor" id="ProgrammingQuestions"></a> |
| 117 | +Programming Questions</h1> |
| 118 | +<h2><a class="anchor" id="ProgrammingQuestions1"></a> |
| 119 | +Q1: What is the difference between Cpp-Taskflow threads and workers?</h2> |
| 120 | +<p>The master thread owns the thread pool and can spawn workers to run tasks or shutdown the pool. Giving taskflow <code>N</code> threads means using <code>N</code> threads to do the works, and there is a total of <code>N+1</code> threads (including the master threads) in the program.</p> |
| 121 | +<div class="fragment"><div class="line"><a class="code" href="classtf_1_1BasicTaskflow.html">tf::Taskflow</a>(N); <span class="comment">// N workers, N+1 threads in the program.</span></div></div><!-- fragment --><p>If there is no worker threads in the pool, the master thread will do all the works by itself. Please refer to <a class="el" href="chapter6.html#C6_MasterWorkersAndExecutor">Master, Workers, and Executor</a> for more details.</p> |
| 122 | +<h2><a class="anchor" id="ProgrammingQuestions2"></a> |
| 123 | +Q2: What is the Lifetime of a Task and a Graph?</h2> |
| 124 | +<p>The lifetime of a task sticks with its parent graph. A task is not destroyed until its parent graph is destroyed. Please refer to <a class="el" href="chapter2.html#LifeTimeOfAGraph">Lifetime of a Graph</a> for more details.</p> |
| 125 | +<h2><a class="anchor" id="ProgrammingQuestions3"></a> |
| 126 | +Q3: Is taskflow thread-safe?</h2> |
| 127 | +<p>No, the taskflow object is not thread-safe. You can't create tasks from multiple threads at the same time.</p> |
| 128 | +<h2><a class="anchor" id="ProgrammingQuestions4"></a> |
| 129 | +Q4: My program hangs and never returns after dispatching a taskflow graph. What's wrong?</h2> |
| 130 | +<p>When the program hangs forever it is very likely your taskflow graph has a cycle. Try the <a class="el" href="classtf_1_1BasicTaskflow.html#adac448e1cc44307856b3116d7ed5490f" title="dumps the present task dependency graph to a std::ostream in DOT format ">tf::Taskflow::dump</a> method to debug the graph before dispatching your taskflow graph.</p> |
| 131 | +<h2><a class="anchor" id="ProgrammingQuestions5"></a> |
| 132 | +Q5: In the following example where B spawns a joined subflow of two tasks B1 and B2, do they run concurrently with task A?</h2> |
| 133 | +<div class="image"> |
| 134 | +<img src="dynamic_graph.png" alt="dynamic_graph.png" width="60%"/> |
| 135 | +</div> |
| 136 | +<p>No. The subflow is spawned during the execution of B, and at this point A must finish because A precedes B. This gives rise to the fact B1 and B2 must run after A. This graph may looks strange because B seems to run twice! However, Cpp-Taskflow will schedule B only once to create its subflow. Whether this subflow joins or detaches from B only affects the future object returned from B. </p> |
| 137 | +</div></div><!-- contents --> |
| 138 | +</div><!-- doc-content --> |
| 139 | +<!-- start footer part --> |
| 140 | +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 141 | + <ul> |
| 142 | + <li class="footer">Generated by |
| 143 | + <a href="http://www.doxygen.org/index.html"> |
| 144 | + <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 145 | + </ul> |
| 146 | +</div> |
| 147 | +</body> |
| 148 | +</html> |
0 commit comments