{"id":13398872,"url":"https://github.com/taskflow/taskflow","last_synced_at":"2026-01-12T01:56:33.885Z","repository":{"id":37079399,"uuid":"130068982","full_name":"taskflow/taskflow","owner":"taskflow","description":"A General-purpose Task-parallel Programming System using Modern C++","archived":false,"fork":false,"pushed_at":"2025-12-26T04:06:35.000Z","size":150488,"stargazers_count":11498,"open_issues_count":22,"forks_count":1345,"subscribers_count":248,"default_branch":"master","last_synced_at":"2025-12-26T13:49:00.599Z","etag":null,"topics":["concurrent-programming","cuda-programming","gpu-programming","heterogeneous-parallel-programming","high-performance-computing","multi-threading","multicore-programming","multithreading","parallel","parallel-computing","parallel-programming","taskflow","taskparallelism","threadpool","work-stealing"],"latest_commit_sha":null,"homepage":"https://taskflow.github.io","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taskflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/Contributing.html","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":"docs/Governance.html","roadmap":"docs/roadmap.png","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"taskflow"}},"created_at":"2018-04-18T13:45:30.000Z","updated_at":"2025-12-26T02:40:22.000Z","dependencies_parsed_at":"2023-10-15T14:58:25.812Z","dependency_job_id":"e5789cbc-601b-4418-83e5-b44394cc39a7","html_url":"https://github.com/taskflow/taskflow","commit_stats":{"total_commits":1944,"total_committers":96,"mean_commits":20.25,"dds":0.6147119341563786,"last_synced_commit":"f08e6a4111b753e327b61397ae2550d508326f93"},"previous_names":["cpp-taskflow/cpp-taskflow"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/taskflow/taskflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskflow%2Ftaskflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskflow%2Ftaskflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskflow%2Ftaskflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskflow%2Ftaskflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taskflow","download_url":"https://codeload.github.com/taskflow/taskflow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskflow%2Ftaskflow/sbom","scorecard":{"id":869293,"data":{"date":"2025-08-11","repo":{"name":"github.com/taskflow/taskflow","commit":"0007dd38512b704b6c7e456f0b9499139bbb36ef"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5,"checks":[{"name":"Maintained","score":10,"reason":"13 commit(s) and 22 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 4/23 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/macos.yml:1","Warn: no topLevel permission defined: .github/workflows/ubuntu.yml:1","Warn: no topLevel permission defined: .github/workflows/windows.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":9,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 9 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:90: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/macos.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:90: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:101: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/ubuntu.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/windows.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/windows.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/windows.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/taskflow/taskflow/windows.yml/master?enable=pin","Info:   0 out of  24 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T03:39:24.806Z","repository_id":37079399,"created_at":"2025-08-24T03:39:24.806Z","updated_at":"2025-08-24T03:39:24.806Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28331357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrent-programming","cuda-programming","gpu-programming","heterogeneous-parallel-programming","high-performance-computing","multi-threading","multicore-programming","multithreading","parallel","parallel-computing","parallel-programming","taskflow","taskparallelism","threadpool","work-stealing"],"created_at":"2024-07-30T19:00:32.375Z","updated_at":"2026-01-12T01:56:33.872Z","avatar_url":"https://github.com/taskflow.png","language":"C++","readme":"# Taskflow \u003cimg align=\"right\" width=\"10%\" src=\"image/taskflow_logo.png\"\u003e\n\n\u003c!--[![Linux Build Status](https://travis-ci.com/taskflow/taskflow.svg?branch=master)](https://travis-ci.com/taskflow/taskflow)--\u003e\n[![Ubuntu](https://github.com/taskflow/taskflow/workflows/Ubuntu/badge.svg)](https://github.com/taskflow/taskflow/actions?query=workflow%3AUbuntu)\n[![macOS](https://github.com/taskflow/taskflow/workflows/macOS/badge.svg)](https://github.com/taskflow/taskflow/actions?query=workflow%3AmacOS)\n[![Windows](https://github.com/taskflow/taskflow/workflows/Windows/badge.svg)](https://github.com/taskflow/taskflow/actions?query=workflow%3AWindows)\n[![Wiki](image/api-doc.svg)][documentation]\n[![TFProf](image/tfprof.svg)](https://taskflow.github.io/tfprof/)\n[![Cite](image/cite-tpds.svg)][TPDS22]\n\nTaskflow helps you quickly write task-parallel programs using modern C++\n\n# Why Taskflow?\n\nTaskflow is faster, more expressive, and easier to integrate than many existing task programming frameworks when handling complex parallel workloads.\n\n![](image/performance.png)\n\nTaskflow lets you quickly implement task decomposition strategies\nthat incorporate both regular and irregular compute patterns,\ntogether with an efficient *work-stealing* scheduler to optimize your multithreaded performance.\n\n| [Static Tasking](#start-your-first-taskflow-program) | [Subflow Tasking](#create-a-subflow-graph) |\n| :------------: | :-------------: |\n| ![](image/static_graph.svg) | \u003cimg align=\"right\" src=\"image/dynamic_graph.svg\" width=\"100%\"\u003e |\n\nTaskflow supports conditional tasking for you to make rapid control-flow decisions\nacross dependent tasks to implement cycles and conditions that were otherwise difficult to do\nwith existing tools.\n\n| [Conditional Tasking](#integrate-control-flow-to-a-task-graph) |\n| :-----------------: |\n| ![](image/condition.svg) |\n\nTaskflow is composable. You can create large parallel graphs through\ncomposition of modular and reusable blocks that are easier to optimize\nat an individual scope.\n\n| [Taskflow Composition](#compose-task-graphs) |\n| :---------------: |\n|![](image/framework.svg)|\n\nTaskflow supports heterogeneous tasking for you to\naccelerate a wide range of scientific computing applications\nby harnessing the power of CPU-GPU collaborative computing.\n\n| [Concurrent CPU-GPU Tasking](#offload-a-task-to-a-gpu) |\n| :-----------------: |\n| ![](image/cudaflow.svg) |\n\n\nTaskflow provides visualization and tooling needed for profiling Taskflow programs.\n\n| [Taskflow Profiler](https://taskflow.github.io/tfprof) |\n| :-----------------: |\n| ![](image/tfprof.png) |\n\nWe are committed to support trustworthy developments for both academic and industrial research projects\nin parallel computing. Check out [Who is Using Taskflow](https://taskflow.github.io/#tag_users) and what our users say:\n\n+ *\"Taskflow is the cleanest Task API I've ever seen.\" [Damien Hocking @Corelium Inc](http://coreliuminc.com)*\n+ *\"Taskflow has a very simple and elegant tasking interface. The performance also scales very well.\" [Glen Fraser][totalgee]*\n+ *\"Taskflow lets me handle parallel processing in a smart way.\" [Hayabusa @Learning](https://cpp-learning.com/cpp-taskflow/)*\n+ *\"Taskflow improves the throughput of our graph engine in just a few hours of coding.\" [Jean-Michaël @KDAB](https://ossia.io/)*\n+ *\"Best poster award for open-source parallel programming library.\" [Cpp Conference 2018][Cpp Conference 2018]*\n+ *\"Second Prize of Open-source Software Competition.\" [ACM Multimedia Conference 2019](https://tsung-wei-huang.github.io/img/mm19-ossc-award.jpg)*\n\nSee a quick poster presentation below and\nvisit the [documentation][documentation] to learn more about Taskflow.\nTechnical details can be referred to our [IEEE TPDS paper][TPDS22].\n\n![](image/taskflow-poster.png)\n\n# Start Your First Taskflow Program\n\nThe following program (`simple.cpp`) creates a taskflow of four tasks \n`A`, `B`, `C`, and `D`, where `A` runs before `B` and `C`, and `D`\nruns after `B` and `C`.\nWhen `A` finishes, `B` and `C` can run in parallel.\nTry it live on [Compiler Explorer (godbolt)](https://godbolt.org/z/j8hx3xnnx)!\n\n\n\n```cpp\n#include \u003ctaskflow/taskflow.hpp\u003e  // Taskflow is header-only\n\nint main(){\n  \n  tf::Executor executor;\n  tf::Taskflow taskflow;\n\n  auto [A, B, C, D] = taskflow.emplace(  // create four tasks\n    [] () { std::cout \u003c\u003c \"TaskA\\n\"; },\n    [] () { std::cout \u003c\u003c \"TaskB\\n\"; },\n    [] () { std::cout \u003c\u003c \"TaskC\\n\"; },\n    [] () { std::cout \u003c\u003c \"TaskD\\n\"; } \n  );                                  \n                                      \n  A.precede(B, C);  // A runs before B and C\n  D.succeed(B, C);  // D runs after  B and C\n                                      \n  executor.run(taskflow).wait(); \n\n  return 0;\n}\n```\n\nTaskflow is *header-only* and there is no wrangle with installation.\nTo compile the program, clone the Taskflow project and \ntell the compiler to include the [headers](./taskflow/).\n\n```bash\n~$ git clone https://github.com/taskflow/taskflow.git  # clone it only once\n~$ g++ -std=c++20 examples/simple.cpp -I. -O2 -pthread -o simple\n~$ ./simple\nTaskA\nTaskC \nTaskB \nTaskD\n```\n\n# Visualize Your First Taskflow Program\n\nTaskflow comes with a built-in profiler, \n[TFProf](https://taskflow.github.io/tfprof/), \nfor you to profile and visualize taskflow programs\nin an easy-to-use web-based interface.\n\n![](doxygen/images/tfprof.png)\n\n```bash\n# run the program with the environment variable TF_ENABLE_PROFILER enabled\n~$ TF_ENABLE_PROFILER=simple.json ./simple\n~$ cat simple.json\n[\n{\"executor\":\"0\",\"data\":[{\"worker\":0,\"level\":0,\"data\":[{\"span\":[172,186],\"name\":\"0_0\",\"type\":\"static\"},{\"span\":[187,189],\"name\":\"0_1\",\"type\":\"static\"}]},{\"worker\":2,\"level\":0,\"data\":[{\"span\":[93,164],\"name\":\"2_0\",\"type\":\"static\"},{\"span\":[170,179],\"name\":\"2_1\",\"type\":\"static\"}]}]}\n]\n# paste the profiling json data to https://taskflow.github.io/tfprof/\n```\n\nIn addition to execution diagram, you can dump the graph to a DOT format \nand visualize it using a number of free [GraphViz][GraphViz] tools.\n\n```\n// dump the taskflow graph to a DOT format through std::cout\ntaskflow.dump(std::cout); \n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"doxygen/images/simple.svg\"\u003e\u003c/p\u003e\n\n# Express Task Graph Parallelism\n\nTaskflow empowers users with both static and dynamic task graph constructions\nto express end-to-end parallelism in a task graph that\nembeds in-graph control flow.\n\n1. [Create a Subflow Graph](#create-a-subflow-graph)\n2. [Integrate Control Flow to a Task Graph](#integrate-control-flow-to-a-task-graph)\n3. [Offload a Task to a GPU](#offload-a-task-to-a-gpu)\n4. [Compose Task Graphs](#compose-task-graphs)\n5. [Launch Asynchronous Tasks](#launch-asynchronous-tasks)\n6. [Execute a Taskflow](#execute-a-taskflow)\n7. [Leverage Standard Parallel Algorithms](#leverage-standard-parallel-algorithms)\n\n## Create a Subflow Graph\n\nTaskflow supports *dynamic tasking* for you to create a subflow\ngraph from the execution of a task to perform dynamic parallelism.\nThe following program spawns a task dependency graph parented at task `B`.\n\n```cpp\ntf::Task A = taskflow.emplace([](){}).name(\"A\");  \ntf::Task C = taskflow.emplace([](){}).name(\"C\");  \ntf::Task D = taskflow.emplace([](){}).name(\"D\");  \n\ntf::Task B = taskflow.emplace([] (tf::Subflow\u0026 subflow) { \n  tf::Task B1 = subflow.emplace([](){}).name(\"B1\");  \n  tf::Task B2 = subflow.emplace([](){}).name(\"B2\");  \n  tf::Task B3 = subflow.emplace([](){}).name(\"B3\");  \n  B3.succeed(B1, B2);  // B3 runs after B1 and B2\n}).name(\"B\");\n\nA.precede(B, C);  // A runs before B and C\nD.succeed(B, C);  // D runs after  B and C\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"doxygen/images/subflow_join.svg\"\u003e\u003c/p\u003e\n\n## Integrate Control Flow to a Task Graph \n\nTaskflow supports *conditional tasking* for you to make rapid \ncontrol-flow decisions across dependent tasks to implement cycles \nand conditions in an *end-to-end* task graph.\n\n```cpp\ntf::Task init = taskflow.emplace([](){}).name(\"init\");\ntf::Task stop = taskflow.emplace([](){}).name(\"stop\");\n\n// creates a condition task that returns a random binary\ntf::Task cond = taskflow.emplace(\n  [](){ return std::rand() % 2; }\n).name(\"cond\");\n\ninit.precede(cond);\n\n// creates a feedback loop {0: cond, 1: stop}\ncond.precede(cond, stop);\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"doxygen/images/conditional-tasking-1.svg\"\u003e\u003c/p\u003e\n\n\n## Offload a Task to a GPU\n\nTaskflow supports GPU tasking for you to accelerate a wide range of scientific computing applications by harnessing the power of CPU-GPU collaborative computing using Nvidia CUDA Graph.\n\n```cpp\n__global__ void saxpy(size_t N, float alpha, float* dx, float* dy) {\n  int i = blockIdx.x*blockDim.x + threadIdx.x;\n  if (i \u003c N) {\n    y[i] = alpha*x[i] + y[i];\n  }\n}\n  \n// create a CUDA Graph task\ntf::Task cudaflow = taskflow.emplace([\u0026]() {\n  tf::cudaGraph cg;\n  tf::cudaTask h2d_x = cg.copy(dx, hx.data(), N);\n  tf::cudaTask h2d_y = cg.copy(dy, hy.data(), N);\n  tf::cudaTask d2h_x = cg.copy(hx.data(), dx, N);\n  tf::cudaTask d2h_y = cg.copy(hy.data(), dy, N);\n  tf::cudaTask saxpy = cg.kernel((N+255)/256, 256, 0, saxpy, N, 2.0f, dx, dy);\n  saxpy.succeed(h2d_x, h2d_y)\n       .precede(d2h_x, d2h_y);\n  \n  // instantiate an executable CUDA graph and run it through a stream\n  tf::cudaGraphExec exec(cg);\n  tf::cudaStream stream;\n  stream.run(exec).synchronize();\n}).name(\"CUDA Graph Task\");\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"doxygen/images/saxpy_1_cudaflow.svg\"\u003e\u003c/p\u003e\n\n## Compose Task Graphs\n\nTaskflow is composable. \nYou can create large parallel graphs through composition of modular \nand reusable blocks that are easier to optimize at an individual scope.\n\n```cpp\ntf::Taskflow f1, f2;\n\n// create taskflow f1 of two tasks\ntf::Task f1A = f1.emplace([]() { std::cout \u003c\u003c \"Task f1A\\n\"; })\n                 .name(\"f1A\");\ntf::Task f1B = f1.emplace([]() { std::cout \u003c\u003c \"Task f1B\\n\"; })\n                 .name(\"f1B\");\n\n// create taskflow f2 with one module task composed of f1\ntf::Task f2A = f2.emplace([]() { std::cout \u003c\u003c \"Task f2A\\n\"; })\n                 .name(\"f2A\");\ntf::Task f2B = f2.emplace([]() { std::cout \u003c\u003c \"Task f2B\\n\"; })\n                 .name(\"f2B\");\ntf::Task f2C = f2.emplace([]() { std::cout \u003c\u003c \"Task f2C\\n\"; })\n                 .name(\"f2C\");\n\ntf::Task f1_module_task = f2.composed_of(f1)\n                            .name(\"module\");\n\nf1_module_task.succeed(f2A, f2B)\n              .precede(f2C);\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"doxygen/images/composition.svg\"\u003e\u003c/p\u003e\n\n## Launch Asynchronous Tasks\n\nTaskflow supports *asynchronous* tasking.\nYou can launch tasks asynchronously to dynamically explore task graph parallelism.\n\n```cpp\ntf::Executor executor;\n\n// create asynchronous tasks directly from an executor\nstd::future\u003cint\u003e future = executor.async([](){ \n  std::cout \u003c\u003c \"async task returns 1\\n\";\n  return 1;\n}); \nexecutor.silent_async([](){ std::cout \u003c\u003c \"async task does not return\\n\"; });\n\n// create asynchronous tasks with dynamic dependencies\ntf::AsyncTask A = executor.silent_dependent_async([](){ printf(\"A\\n\"); });\ntf::AsyncTask B = executor.silent_dependent_async([](){ printf(\"B\\n\"); }, A);\ntf::AsyncTask C = executor.silent_dependent_async([](){ printf(\"C\\n\"); }, A);\ntf::AsyncTask D = executor.silent_dependent_async([](){ printf(\"D\\n\"); }, B, C);\n\nexecutor.wait_for_all();\n```\n\n## Execute a Taskflow\n\nThe executor provides several *thread-safe* methods to run a taskflow. \nYou can run a taskflow once, multiple times, or until a stopping criteria is met. \nThese methods are non-blocking with a `tf::Future\u003cvoid\u003e` return \nto let you query the execution status. \n\n```cpp\n// runs the taskflow once\ntf::Future\u003cvoid\u003e run_once = executor.run(taskflow); \n\n// wait on this run to finish\nrun_once.get();\n\n// run the taskflow four times\nexecutor.run_n(taskflow, 4);\n\n// runs the taskflow five times\nexecutor.run_until(taskflow, [counter=5](){ return --counter == 0; });\n\n// block the executor until all submitted taskflows complete\nexecutor.wait_for_all();\n```\n\n## Leverage Standard Parallel Algorithms\n\nTaskflow defines algorithms for you to quickly express common parallel\npatterns using standard C++ syntaxes, \nsuch as parallel iterations, parallel reductions, and parallel sort.\n\n```cpp\ntf::Task task1 = taskflow.for_each( // assign each element to 100 in parallel\n  first, last, [] (auto\u0026 i) { i = 100; }    \n);\ntf::Task task2 = taskflow.reduce(   // reduce a range of items in parallel\n  first, last, init, [] (auto a, auto b) { return a + b; }\n);\ntf::Task task3 = taskflow.sort(     // sort a range of items in parallel\n  first, last, [] (auto a, auto b) { return a \u003c b; }\n);\n```\n\nAdditionally, Taskflow provides composable graph building blocks for you to \nefficiently implement common parallel algorithms, such as parallel pipeline.\n\n```cpp\n// create a pipeline to propagate five tokens through three serial stages\ntf::Pipeline pl(num_parallel_lines,\n  tf::Pipe{tf::PipeType::SERIAL, [](tf::Pipeflow\u0026 pf) {\n    if(pf.token() == 5) {\n      pf.stop();\n    }\n  }},\n  tf::Pipe{tf::PipeType::SERIAL, [](tf::Pipeflow\u0026 pf) {\n    printf(\"stage 2: input buffer[%zu] = %d\\n\", pf.line(), buffer[pf.line()]);\n  }},\n  tf::Pipe{tf::PipeType::SERIAL, [](tf::Pipeflow\u0026 pf) {\n    printf(\"stage 3: input buffer[%zu] = %d\\n\", pf.line(), buffer[pf.line()]);\n  }}\n);\ntaskflow.composed_of(pl)\nexecutor.run(taskflow).wait();\n```\n\n\n# Supported Compilers\n\nTo use Taskflow v4.0.0, you need a compiler that supports C++20:\n\n  + GNU C++ Compiler at least v11.0 with -std=c++20\n  + Clang C++ Compiler at least v12.0 with -std=c++20\n  + Microsoft Visual Studio at least v19.29 (VS 2019) with /std:c++20\n  + Apple Clang (Xcode) at least v13.0 with -std=c++20\n  + NVIDIA CUDA Toolkit and Compiler (nvcc) at least v12.0 with host compiler supporting C++20\n  + Intel oneAPI DPC++/C++ Compiler at least v2022.0 with -std=c++20\n\nTaskflow works on Linux, Windows, and Mac OS X.\n\n# Learn More about Taskflow\n\nVisit our [project website][Project Website] and [documentation][documentation]\nto learn more about Taskflow. To get involved:\n\n  + See [release notes][release notes] to stay up-to-date with newest versions\n  + Read the step-by-step tutorial at [cookbook][cookbook]\n  + Submit an issue at [GitHub issues][GitHub issues]\n  + Find out our technical details at [references][references]\n  + Watch our technical talks at YouTube\n\n[![Taskflow Tutorials](https://img.youtube.com/vi/u4vaY0cjzos/0.jpg)](https://www.youtube.com/watch?v=u4vaY0cjzos)\n\nWe are committed to support trustworthy developments for \nboth academic and industrial research projects in parallel \nand heterogeneous computing. \nIf you are using Taskflow, please cite the following paper we published at 2021 IEEE TPDS:\n\n+ Tsung-Wei Huang, Dian-Lun Lin, Chun-Xun Lin, and Yibo Lin, \u0026quot;[Taskflow: A Lightweight Parallel and Heterogeneous Task Graph Computing System](https://tsung-wei-huang.github.io/papers/tpds21-taskflow.pdf),\u0026quot; \u003ci\u003eIEEE Transactions on Parallel and Distributed Systems (TPDS)\u003c/i\u003e, vol. 33, no. 6, pp. 1303-1320, June 2022\n\nMore importantly, we appreciate all Taskflow [contributors][contributors] and \nthe following organizations for sponsoring the Taskflow project!\n\n| \u003c!-- --\u003e | \u003c!-- --\u003e | \u003c!-- --\u003e | \u003c!-- --\u003e |\n|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|\n|\u003cimg src=\"doxygen/images/utah-ece-logo.png\"\u003e|\u003cimg src=\"doxygen/images/nsf.png\"\u003e | \u003cimg src=\"doxygen/images/darpa.png\"\u003e | \u003cimg src=\"doxygen/images/NumFocus.png\"\u003e|\n|\u003cimg src=\"doxygen/images/nvidia-logo.png\"\u003e | \u003cimg src=\"doxygen/images/uw-madison-ece-logo.png\"\u003e | | |\n\n[Taskflow](https://ads.fund/token/0xadf8c696719c904923504683d3f3f7d18774ac06) project is also supported by ADS.FUND.\n\n# License\n\nTaskflow is licensed with the [MIT License](./LICENSE). \nYou are completely free to re-distribute your work derived from Taskflow.\n\n* * *\n\n[Tsung-Wei Huang]:       https://tsung-wei-huang.github.io/\n[GitHub releases]:       https://github.com/taskflow/taskflow/releases\n[GitHub issues]:         https://github.com/taskflow/taskflow/issues\n[GitHub insights]:       https://github.com/taskflow/taskflow/pulse\n[GitHub pull requests]:  https://github.com/taskflow/taskflow/pulls\n[GraphViz]:              https://www.graphviz.org/\n[Project Website]:       https://taskflow.github.io/\n[cppcon20 talk]:         https://www.youtube.com/watch?v=MX15huP5DsM\n[contributors]:          https://taskflow.github.io/taskflow/contributors.html\n[totalgee]:              https://github.com/totalgee\n[NSF]:                   https://www.nsf.gov/\n[UIUC]:                  https://illinois.edu/\n[CSL]:                   https://csl.illinois.edu/\n[UofU]:                  https://www.utah.edu/\n[documentation]:         https://taskflow.github.io/taskflow/index.html\n[release notes]:         https://taskflow.github.io/taskflow/Releases.html\n[cookbook]:              https://taskflow.github.io/taskflow/pages.html\n[references]:            https://taskflow.github.io/taskflow/References.html\n[PayMe]:                 https://www.paypal.me/twhuang/10\n[email me]:              mailto:twh760812@gmail.com\n[Cpp Conference 2018]:   https://github.com/CppCon/CppCon2018\n[TPDS22]:                https://tsung-wei-huang.github.io/papers/tpds21-taskflow.pdf\n\n","funding_links":["https://github.com/sponsors/taskflow","https://www.paypal.me/twhuang/10"],"categories":["Projects (sorted by year)","Concurrency","C++","Software","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++"],"sub_categories":["2018","Trends"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskflow%2Ftaskflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaskflow%2Ftaskflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskflow%2Ftaskflow/lists"}