Threading Building Blocks

C++ programming library

This article may rely excessively on sources too closely associated with the subject, potentially preventing the article from being verifiable and neutral. Please help improve it by replacing them with more appropriate citations to reliable, independent, third-party sources. (January 2016) (Learn how and when to remove this template message)

|

Threading Building BlocksDeveloper(s)| Intel

|

Stable release|

2021.8 / February 17, 2023; 10 months ago (2023-02-17)[1]

Repository|

* github.com/oneapi-src/oneTBB

Written in| C++
Operating system| FreeBSD, Linux, Solaris, macOS, Windows, Android
Type| library or framework
License| dual: commercial / open source (Apache 2.0), plus Freeware[2]
Website| github.com/oneapi-src/oneTBB
intel.com/oneTBB

oneAPI Threading Building Blocks (oneTBB; formerly Threading Building Blocks or TBB), is a C++ template library developed by Intel for parallel programming on multi-core processors. Using TBB, a computation is broken down into tasks that can run in parallel. The library manages and schedules threads to execute these tasks.

## Overview[edit]

A oneTBB program creates, synchronizes, and destroys graphs of dependent tasks according to algorithms, i.e. high-level parallel programming paradigms (a.k.a. Algorithmic Skeletons). Tasks are then executed respecting graph dependencies. This approach groups TBB in a family of techniques for parallel programming aiming to decouple the programming from the particulars of the underlying machine.

oneTBB implements work stealing to balance a parallel workload across available processing cores in order to increase core utilization and therefore scaling. Initially, the workload is evenly divided among the available processor cores. If one core completes its work while other cores still have a significant amount of work in their queue, oneTBB reassigns some of the work from one of the busy cores to the idle core. This dynamic capability decouples the programmer from the machine, allowing applications written using the library to scale to utilize the available processing cores with no changes to the source code or the executable program file. In a 2008 assessment of the work stealing implementation in TBB, researchers from Princeton University found that it was suboptimal for large numbers of processors cores, causing up to 47% of computing time spent in scheduling overhead when running certain benchmarks on a 32-core system.[3]

oneTBB, like the STL (and the part of the C++ standard library based on it), uses templates extensively. This has the advantage of low-overhead polymorphism, since templates are a compile-time construct which modern C++ compilers can largely optimize away.

oneTBB is available commercially as a binary distribution with support,[4] and as open-source software in both source and binary forms.

oneTBB does not provide guarantees of determinism or freedom from data races.[5]

## Library contents[edit]

oneTBB is a collection of components for parallel programming:

* Basic algorithms: `parallel_for`, `parallel_reduce`, `parallel_scan`
* Advanced algorithms: `parallel_pipeline`, `parallel_sort`
* Containers: `concurrent_queue`, `concurrent_priority_queue`, `concurrent_vector`, `concurrent_hash_map`, `concurrent_unordered_map`, `concurrent_unordered_set`, `concurrent_map`, `concurrent_set`
* Memory allocation: `scalable_malloc`, `scalable_free`, `scalable_realloc`, `scalable_calloc`, `scalable_allocator`, `cache_aligned_allocator`
* Mutual exclusion: `mutex`, `spin_mutex`, `queuing_mutex`, `spin_rw_mutex`, `queuing_rw_mutex`, `recursive_mutex`
* Timing: portable fine grained global time stamp
* Task scheduler: direct access to control the creation and activation of tasks

## See also[edit]

* Intel oneAPI Base Toolkit
* Intel Integrated Performance Primitives (IPP)
* Intel oneAPI Data Analytics Library (oneDAL)
* Intel oneAPI Math Kernel Library (oneMKL)
* Intel Advisor
* Intel Inspector
* Intel VTune Profiler
* Intel Concurrent Collections (CnC)
* Algorithmic skeleton
* Parallel computing
* List of C++ multi-threading libraries
* List of C++ template libraries
* Parallel Patterns Library
* Grand Central Dispatch (GCD)
* Software Architecture Building Blocks

## Notes[edit]

1. ^ "oneAPI Threading Building Blocks Github Releases". GitHub.
2. ^ "No Cost Options for Intel Support yourself, Royalty-Free".
3. ^ Contreras, Gilberto; Martonosi, Margaret (2008). Characterizing and improving the performance of Intel Threading Building Blocks (PDF). IEEE Int'l Symp. on Workload Characterization.
4. ^ https://software.intel.com/en-us/intel-tbb Intel Threading Building Blocks Commercial Version Homepage
5. ^ Bocchino Jr., Robert L.; Adve, Vikram S.; Adve, Sarita V.; Snir, Marc (2009). Parallel Programming Must Be Deterministic by Default. USENIX Workshop on Hot Topics in Parallelism.

## References[edit]

* Voss, Michael; Asenjo, Rafael; Reinders, James (2019), Pro TBB, Apress, doi:10.1007/978-1-4842-4398-5, ISBN 978-1-4842-4397-8, S2CID 195847637
* Reinders, James (July 2007), Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism (Paperback ed.), Sebastopol: O'Reilly Media, ISBN 978-0-596-51480-8
* Voss, M. (October 2006), Demystify Scalable Parallelism with Intel Threading Building Blocks' Generic Parallel Algorithms, archived from the original on 2012-02-05, retrieved 2007-06-06
* Voss, M. (December 2006), Enable Safe, Scalable Parallelism with Intel Threading Building Blocks' Concurrent Containers, archived from the original on 2012-02-05, retrieved 2007-06-06
* Hudson, Richard L.; Saha, Bratin; Adl-Tabatabai, Ali-Reza; Hertzberg, Benjamin C. (2006), "McRT-Malloc", Proceedings of the 2006 international symposium on Memory management - ISMM '06, pp. 74–83, doi:10.1145/1133956.1133967, ISBN 978-1595932211, S2CID 9120368

## External links[edit]

* oneTBB Industry Specification
* oneTBB on GitHub
* Official website at Intel

* v
* t
* e

Intel software

Items in italics are no longer maintained or have planned end-of-life dates.

Development|

* Parallel Studio
* C++ Compiler
* Fortran Compiler
* Advisor
* Inspector
* INTERP/80
* VTune

Components|

* Data Analytics Library (DAL)
* Integrated Performance Primitives (IPP)
* Math Kernel Library (MKL)
* Threading Building Blocks (TBB)

Open source|

* Data Analytics Library (DAL)
* Threading Building Blocks (TBB)
* Tizen
* OpenVINO

Software programs|

* Telekinesys Research1
* Havok1
* Vision1

Organizations|

* Developer Zone
* Research

* 1Sold to Microsoft

* v
* t
* e

Parallel computing

General|

* Distributed computing
* Parallel computing
* Massively parallel
* Cloud computing
* High-performance computing
* Multiprocessing
* Manycore processor
* GPGPU
* Computer network
* Systolic array

Levels|

* Bit
* Instruction
* Thread
* Task
* Data
* Memory
* Loop
* Pipeline

Multithreading|

* Temporal
* Simultaneous (SMT)
* Speculative (SpMT)
* Preemptive
* Cooperative
* Clustered multi-thread (CMT)
* Hardware scout

Theory|

* PRAM model
* PEM model
* Analysis of parallel algorithms
* Amdahl's law
* Gustafson's law
* Cost efficiency
* Karp–Flatt metric
* Slowdown
* Speedup

Elements|

* Process
* Thread
* Fiber
* Instruction window
* Array

Coordination|

* Multiprocessing
* Memory coherence
* Cache coherence
* Cache invalidation
* Barrier
* Synchronization
* Application checkpointing

Programming|

* Stream processing
* Dataflow programming
* Models
* Implicit parallelism
* Explicit parallelism
* Concurrency
* Non-blocking algorithm

Hardware|

* Flynn's taxonomy
* SISD
* SIMD
* Array processing (SIMT)
* Pipelined processing
* Associative processing
* MISD
* MIMD
* Dataflow architecture
* Pipelined processor
* Superscalar processor
* Vector processor
* Multiprocessor
* symmetric
* asymmetric
* Memory
* shared
* distributed
* distributed shared
* UMA
* NUMA
* COMA
* Massively parallel computer
* Computer cluster
* Beowulf cluster
* Grid computer
* Hardware acceleration

APIs|

* Ateji PX
* Boost
* Chapel
* HPX
* Charm++
* Cilk
* Coarray Fortran
* CUDA
* Dryad
* C++ AMP
* Global Arrays
* GPUOpen
* MPI
* OpenMP
* OpenCL
* OpenHMPP
* OpenACC
* Parallel Extensions
* PVM
* pthreads
* RaftLib
* ROCm
* UPC
* TBB
* ZPL

Problems|

* Automatic parallelization
* Deadlock
* Deterministic algorithm
* Embarrassingly parallel
* Parallel slowdown
* Race condition
* Software lockout
* Scalability
* Starvation

* Category: Parallel computing

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template