All Projects → JoelFilho → Tdp

JoelFilho / Tdp

Licence: bsl-1.0
The Darkest Pipeline - Multithreaded pipelines for modern C++

Programming Languages

cpp
1120 projects
cpp17
186 projects

Projects that are alternatives of or similar to Tdp

Taskflow
A General-purpose Parallel and Heterogeneous Task Programming System
Stars: ✭ 6,128 (+9046.27%)
Mutual labels:  multithreading, multi-threading, concurrent-programming
myconcurrent
Java并发的系统性学习
Stars: ✭ 25 (-62.69%)
Mutual labels:  multithreading, concurrent-programming
pipeline-editor
Cloud Pipelines Editor is a web app that allows the users to build and run Machine Learning pipelines without having to set up development environment.
Stars: ✭ 22 (-67.16%)
Mutual labels:  pipeline, pipelines
Atomic queue
C++ lockless queue.
Stars: ✭ 373 (+456.72%)
Mutual labels:  multithreading, multi-threading
java-multithread
Códigos feitos para o curso de Multithreading com Java, no canal RinaldoDev do YouTube.
Stars: ✭ 24 (-64.18%)
Mutual labels:  multithreading, concurrent-programming
TAOMP
《多处理器编程的艺术》一书中的示例代码实现,带有注释与单元测试
Stars: ✭ 39 (-41.79%)
Mutual labels:  multi-threading, concurrent-programming
Pipelines
An experimental programming language for data flow
Stars: ✭ 354 (+428.36%)
Mutual labels:  pipeline, pipelines
Aff3ct
A fast simulator and a library dedicated to the channel coding.
Stars: ✭ 240 (+258.21%)
Mutual labels:  multithreading, multi-threading
Go Streams
A lightweight stream processing library for Go
Stars: ✭ 615 (+817.91%)
Mutual labels:  pipeline, pipelines
Javamtp
《Java多线程编程实战指南(设计模式篇)》源码
Stars: ✭ 575 (+758.21%)
Mutual labels:  multithreading, multi-threading
Master-Thesis
Deep Reinforcement Learning in Autonomous Driving: the A3C algorithm used to make a car learn to drive in TORCS; Python 3.5, Tensorflow, tensorboard, numpy, gym-torcs, ubuntu, latex
Stars: ✭ 33 (-50.75%)
Mutual labels:  multi-threading, multithreading
Ppipe
A simple and lightweight Rust library for making iterator pipelines concurrent
Stars: ✭ 13 (-80.6%)
Mutual labels:  multithreading, pipeline
thread-pool
BS::thread_pool: a fast, lightweight, and easy-to-use C++17 thread pool library
Stars: ✭ 1,043 (+1456.72%)
Mutual labels:  multi-threading, multithreading
MemoryAllocator.KanameShiki
Fast multi-threaded memory allocator
Stars: ✭ 73 (+8.96%)
Mutual labels:  multi-threading, multithreading
dolphinnext
A graphical user interface for distributed data processing of high throughput genomics
Stars: ✭ 92 (+37.31%)
Mutual labels:  pipeline, pipelines
Concurrencpp
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all
Stars: ✭ 340 (+407.46%)
Mutual labels:  multithreading, concurrent-programming
Chymyst Core
Declarative concurrency in Scala - The implementation of the chemical machine
Stars: ✭ 142 (+111.94%)
Mutual labels:  multithreading, concurrent-programming
Sobjectizer
An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.
Stars: ✭ 172 (+156.72%)
Mutual labels:  multithreading, concurrent-programming
Hamsters.js
100% Vanilla Javascript Multithreading & Parallel Execution Library
Stars: ✭ 517 (+671.64%)
Mutual labels:  multithreading, multi-threading
Fucking Java Concurrency
🎏 Simple show cases of java concurrency problems, seeing 🙈 is believing 🐵
Stars: ✭ 779 (+1062.69%)
Mutual labels:  multi-threading, concurrent-programming

TDP: The Darkest Pipeline

The Darkest Pipeline is a header-only library for building multi-threaded software pipelines on modern C++.

Built on C++17, it allows static declaration of processing pipelines using an embedded DSL (Domain-Specific Language):

auto world = [](std::string s){ return s + " World!\n"; };
auto print = [](auto msg){ std::cout << msg; };

// Pipeline declaration
auto pipeline = tdp::input<std::string> >> world >> tdp::consumer{print};

// Usage: provide an arbitrary amount of data, let TDP do the rest.
pipeline.input("Hello");
pipeline.input("Salutations");
pipeline.input("Ahoy");

Jump to Overview for a quick overlook at the DSL API. See the examples for use cases and deeper details.

Note: TDP is still under development, so instabilities may exist, and functionality may be missing. See the TODO file for the roadmap. For feature requests or bug reports, submit an issue or contact me on Twitter.

Index:

Features

Why pipelines?

We can't always parallelize a process. Some algorithms are inherently sequential. Sometimes we depend on blocking I/O.

For example, video capture from a USB camera can't be parallel, neither can displaying that video:

auto frame = camera.capture();
auto output = process(frame);
display(output);

In this example, even if we can parallelize process(), the throughput of the system is limited by the accumulated latency of all three stages. Using a pipeline, the latency should be similar, but the throughput is limited by the highest latency among the three stages.

In short, use a pipeline where throughput matters, but it can't be reached by reducing latency.

Getting Started

The Darkest Pipeline is a header-only library. You can copy the contents of the include folder anywhere into your project!

TDP also utilizes CMake, so it allows:

  • Using this repository as a subdirectory, with add_subdirectory
    • You can use this git repository as a submodule!
  • Installing, with the CMake install interface
    • e.g. on Linux, a sudo make install will make it globally available in the system

Then, include tdp/pipeline.hpp in your code, and enjoy a life of easier pipelining!

Overview

auto pipeline = input_type >> [stage1 >> ... stageN >>] >> output_type [/policy] [/wrapper];

Input Types

  • tdp::input<Args...>: User-provided input. Can be provided from main thread with pipeline.input(args...).
  • tdp::producer{functor}: A thread that automatically calls functor() to generate data for the pipeline. Allows control with the pause()/resume() interface.

Output Types

  • tdp::output: User-polled output. Can be obtained from main thread with wait_get() (blocking) or the non-blocking member function try_get().
  • tdp::consumer{functor}: A thread that processes the pipeline output and returns void, removing the output interface from the pipeline.

Stages

The additional pipeline stages are functions that operate on input data and return data for the next pipeline stage.

They can be:

  • Function pointers/references
  • Lambdas
  • Function objects, e.g. std::function
  • Pointers to member functions

Policies

Execution policies define the internal data structure utilized for communication between stages. TDP currently provides these policies:

  • tdp::policy::queue (default): A blocking unbounded queue
  • tdp::policy::triple_buffer: Utilizes triple-buffering, for applications where the latest value is more important than processing all values
  • tdp::policy::triple_buffer_lockfree: A lock-free implementation of triple buffering, for applications with high throughput

Wrappers

By default, a pipeline is constructed on the stack. Due to its internals, it can't be copy-constructed, nor move-constructed.

For applications where move operations are required, or shared ownership is desired, TDP allows using smart pointer wrappers:

  • tdp::as_unique_ptr: Returns an std::unique_ptr containing the pipeline
  • tdp::as_shared_ptr: Returns an std::shared_ptr containing the pipeline

License

Copyright © 2020 Joel P. C. Filho

This software is released under the Boost Software License - Version 1.0. Refer to the License file for more details.

The software in the examples folder is on public domain, released under The Unlicense.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].