Software:Taskflow

From HandWiki
Taskflow
Original author(s)T-W Huang
Initial release2018
Written inC++
Operating systemLinux, OS X, Windows
Typelibrary or framework
LicenseMIT License
Websitegithub.com/taskflow/taskflow

Taskflow is a general-purpose parallel and heterogeneous task programming library written in C++. Taskflow lets users describe a computation in terms of a task dependency graph. The system manages and schedules threads to execute these tasks.

Overview

Taskflow develops a new general-purpose task programming model to streamline the creation of large parallel applications on a heterogeneous node comprising manycore central processing units (CPUs) and graphics processing units (GPUs). It leverages the power of modern C++ to enable efficient implementation of parallel decomposition strategies that are particularly useful for irregular workloads, including dynamic control flow, graph computing, and optimization.

Taskflow implements work stealing to distribute tasks among available processing cores with dynamic load balancing. The runtime adapts the number of worker threads to available task parallelism at any time during the graph execution. The scheduling algorithm effectively avoids underutilized threads that are harmful to performance and prevents oversubscribed threads when tasks are scarce, improving the overall system performance of latency, energy efficiency, and throughput.

Taskflow has extensive real use cases in machine learning (ML), electronic design automation (EDA), high-performance computing (HPC), heterogeneous computing, and data science.

Programming Model

A basic example of Taskflow is shown below. The graph contains four tasks, A, B, C, and D, and four dependencies forcing A to run before B and C, and D to run after B and C. The code explains itself through a succinct and expressive graph description model. Users do not need to touch any threads or system-specific details.

#include <taskflow/taskflow.hpp>  

int main(){
  
  tf::Executor executor;
  tf::Taskflow taskflow;

  auto [A, B, C, D] = taskflow.emplace(
    [] () { std::cout << "TaskA\n"; },               //  task dependency graph
    [] () { std::cout << "TaskB\n"; },               // 
    [] () { std::cout << "TaskC\n"; },               //          +---+          
    [] () { std::cout << "TaskD\n"; }                //    +---->| B |-----+   
  );                                                 //    |     +---+     |
                                                     //  +---+           +-v-+ 
  A.precede(B);  // A runs before B                  //  | A |           | D | 
  A.precede(C);  // A runs before C                  //  +---+           +-^-+ 
  B.precede(D);  // B runs before D                  //    |     +---+     |    
  C.precede(D);  // C runs before D                  //    +---->| C |-----+    
                                                     //          +---+          
  executor.run(taskflow).wait();

  return 0;
}

Awards

Taskflow received a few awards to recognize its contributions to scientific computing:

  • Second Price of the Open Source Software Competition in 2019 ACM Multimedia Conference (MM)
  • Outstanding PhD Dissertation Award in 2019 ACM/SIGDA Design Automation Conference (DAC)
  • Best Tool Award (part of OpenTimer) in 2018 Workshop of Open-source EDA Technology (WOSET) at International Conference of Computer-aided Design (ICCAD)
  • Best Poster Award in 2018 C++ Conference (CppCon)

Systems supported

Taskflow depends only on C++ Standard Library and works for systems that support C++14 compilers:

Taskflow works on Linux, Windows, and Mac OS X. See the C++ compiler support status.

See also

References of Taskflow

Other References

External links


separated reference section