forked from taskflow/taskflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
145 lines (143 loc) · 10.9 KB
/
Copy pathindex.html
File metadata and controls
145 lines (143 loc) · 10.9 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
<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Cpp-Taskflow</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname"><a href="https://github.com/cpp-taskflow/cpp-taskflow">Cpp-Taskflow</a>
 <span id="projectnumber">2.0.0</span>
</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('index.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Quick Start </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="ModernCppParallelTaskProgrammingLibrary"></a>
Modern C++ Parallel Task Programming Library</h1>
<p>Cpp-Taskflow is by far faster, more expressive, fewer lines of code, and easier for drop-in integration than existing parallel task programming libraries such as <a href="http://www.nersc.gov/users/software/programming-models/openmp/openmp-tasking/">OpenMP Tasking</a> and Intel <a href="https://www.threadingbuildingblocks.org/tutorial-intel-tbb-flow-graph">Thread Building Block (TBB) FlowGraph</a>.</p>
<div class="image">
<img src="performance.jpg" alt="performance.jpg" width="95%"/>
</div>
<p>Cpp-Taskflow is committed to support both academic and industry research projects, making it reliable and cost-effective for long-term and large-scale developments. Our users say:</p>
<ul>
<li>"<em>Cpp-Taskflow has the cleanest task API I've ever seen.</em>" <a href="https://github.com/damienhocking">Damien Hocking</a> </li>
<li>"<em>Cpp-Taskflow has a very simple and elegant tasking interface. The performance also scales very well.</em>" <a href="https://github.com/totalgee">Glen Fraser</a> </li>
<li>"<em>Best poster award for the open-source parallel programming library.</em>" <a href="https://github.com/CppCon/CppCon2018">Cpp Conference 2018</a></li>
</ul>
<p>See a quick <a href="https://cpp-taskflow.github.io/">presentation</a> and visit our <a href="https://github.com/cpp-taskflow/cpp-taskflow">GitHub</a> to learn more about Cpp-Taskflow.</p>
<h1><a class="anchor" id="HowToInstallCppTaskflow"></a>
How to Install Cpp-Taskflow?</h1>
<p>Cpp-Taskflow is <em>header-only</em> and there is no need for installation. Simply download the source and copy the headers under the <code>taskflow</code> subdirectory to your project.</p>
<div class="fragment"><div class="line">~$ git clone https://github.com/cpp-taskflow/cpp-taskflow.git</div><div class="line">~$ cd cpp-taskflow/</div><div class="line">~$ cp -r taskflow myproject/include/</div></div><!-- fragment --><h1><a class="anchor" id="ASimpleFirstProgram"></a>
A Simple First Program</h1>
<p>Here is a rather simple program to get you started.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <taskflow/taskflow.hpp></span> <span class="comment">// Cpp-Taskflow is header-only</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(){</div><div class="line"> </div><div class="line"> <a class="code" href="classtf_1_1BasicTaskflow.html">tf::Taskflow</a> taskflow;</div><div class="line"></div><div class="line"> <span class="keyword">auto</span> [A, B, C, D] = taskflow.<a class="code" href="classtf_1_1FlowBuilder.html#a7285613836c840e22b8511d447734c87">silent_emplace</a>(</div><div class="line"> [] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TaskA\n"</span>; }, <span class="comment">// task dependency graph</span></div><div class="line"> [] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TaskB\n"</span>; }, <span class="comment">// </span></div><div class="line"> [] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TaskC\n"</span>; }, <span class="comment">// +---+ </span></div><div class="line"> [] () { <a class="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/docs/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TaskD\n"</span>; } <span class="comment">// +---->| B |-----+ </span></div><div class="line"> ); <span class="comment">// | +---+ |</span></div><div class="line"> <span class="comment">// +---+ +-v-+ </span></div><div class="line"> A.precede(B); <span class="comment">// A runs before B // | A | | D | </span></div><div class="line"> A.precede(C); <span class="comment">// A runs before C // +---+ +-^-+ </span></div><div class="line"> B.precede(D); <span class="comment">// B runs before D // | +---+ | </span></div><div class="line"> C.precede(D); <span class="comment">// C runs before D // +---->| C |-----+ </span></div><div class="line"> <span class="comment">// +---+ </span></div><div class="line"> taskflow.<a class="code" href="classtf_1_1BasicTaskflow.html#a37ef86998f23ee7315be032c40fe815e">wait_for_all</a>(); <span class="comment">// block until finish</span></div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --><p>The program creates four tasks A, B, C, and D. The dependency constraints force A to run before B and C, and D to run after B and C. The maximum concurrency is this example is two, where B and C can run at the same time.</p>
<h1><a class="anchor" id="CompileAndRunYourFirstProgram"></a>
Compile and Run Your First Program</h1>
<p>Cpp-Taskflow is written in C++17 and is built on top of C++ standardized threading libraries. To compile the above program, you need to tell the compiler where to find the Cpp-Taskflow header files. For example, with gcc you need the <code>-I</code> option.</p>
<div class="fragment"><div class="line">~$ g++ simple.cpp -I myproject/include/ -std=c++17 -O2 -pthread -o simple</div><div class="line">~$ ./simple</div><div class="line">TaskA</div><div class="line">TaskC </div><div class="line">TaskB </div><div class="line">TaskD</div></div><!-- fragment --><p>The execution order of B and C might differ as they can run concurrently.</p>
<h1><a class="anchor" id="SupportedCompilers"></a>
Supported Compilers</h1>
<p>To use Cpp-Taskflow, you only need a compiler that supports C++17:</p>
<ul>
<li>GNU C++ Compiler v7.3 with -std=c++17 </li>
<li>Clang C++ Compiler v6.0 with -std=c++17 </li>
<li>Microsoft Visual Studio Version 15.7 (MSVC++ 19.14)</li>
</ul>
<p>Cpp-Taskflow works on Linux, Windows, and OSX.</p>
<h1><a class="anchor" id="License"></a>
License</h1>
<p>Cpp-Taskflow is open-source under permissive MIT license. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>