Skip to main content
Ctrl+K

oneTBB Documentation

About

  • Getting Help and Support
  • Notational Conventions
  • Introduction
  • oneTBB Benefits
  • Testing Approach
  • Known Limitations
  • API and ABI Change Log

Get Started

  • Get Started with oneAPI Threading Building Blocks (oneTBB)
  • System Requirements
  • Installation
  • Next Steps
  • Integrate oneTBB
  • oneTBB Samples

Developer Guide

  • oneTBB Developer Guide
    • Package Contents
      • Debug Versus Release Libraries
      • Scalable Memory Allocator
      • Windows*
      • Linux*
      • macOS*
    • Parallelizing Simple Loops
      • Initializing and Terminating the Library
      • parallel_for
        • Lambda Expressions
        • Automatic Chunking
        • Controlling Chunking
        • Bandwidth and Cache Affinity
        • Partitioner Summary
      • parallel_reduce
        • Advanced Example
        • Use of r-Values for Reduction
      • Advanced Topic: Other Kinds of Iteration Spaces
    • Parallelizing Complex Loops
      • Cook Until Done: parallel_for_each
      • Working on the Assembly Line: parallel_pipeline
        • Using Circular Buffers
        • Throughput of pipeline
        • Non-Linear Pipelines
      • Summary of Loops and Pipelines
    • Parallelizing with Tasks
      • Creating Tasks with parallel_invoke
      • Creating Tasks with task_group
      • task_group Thread Safety
    • Parallelizing Data Flow and Dependence Graphs
      • Parallelizing Data Flow and Dependency Graphs
      • Basic Flow Graph Concepts
        • Flow Graph Basics: Graph Object
        • Flow Graph Basics: Nodes
        • Flow Graph Basics: Edges
        • Flow Graph Basics: Mapping Nodes to Tasks
        • Flow Graph Basics: Message Passing Protocol
        • Flow Graph Basics: Single-push vs. Broadcast-push
        • Flow Graph Basics: Buffering and Forwarding
        • Flow Graph Basics: Reservation
      • Graph Application Categories
        • Data Flow Graph
        • Dependence Graph
      • Predefined Node Types
      • Flow Graph Tips and Tricks
        • Flow Graph Tips for Waiting for and Destroying a Flow Graph
        • Flow Graph Tips on Making Edges
        • Flow Graph Tips on Nested Parallelism
        • Flow Graph Tips for Limiting Resource Consumption
        • Flow Graph Tips for Exception Handling and Cancellation
      • Estimating Flow Graph Performance
      • Class Template Argument Deduction for Flow Graph Nodes
    • Work Isolation
    • Exceptions and Cancellation
      • Cancellation Without An Exception
      • Cancellation and Nested Parallelism
    • Floating-point Settings
    • Containers
      • concurrent_hash_map
        • More on HashCompare
      • concurrent_vector
      • Concurrent Queue Classes
        • Iterating Over a Concurrent Queue for Debugging
        • When Not to Use Queues
      • Summary of Containers
    • Mutual Exclusion
      • Mutex Flavors
      • Reader Writer Mutexes
      • Upgrade/Downgrade
      • Lock Pathologies
    • Timing
    • Memory Allocation
      • Which Dynamic Libraries to Use
      • Configuring the Memory Allocator
      • Automatically Replacing malloc and Other C/C++ Functions for Dynamic Memory Allocation
        • Windows* OS C/C++ Dynamic Memory Interface Replacement
        • Linux* OS C/C++ Dynamic Memory Interface Replacement
    • The Task Scheduler
      • Task-Based Programming
      • When Task-Based Programming Is Inappropriate
      • How Task Scheduler Works
      • Task Scheduler Bypass
      • Guiding Task Scheduler Execution
    • Design Patterns
      • Agglomeration
      • Elementwise
      • Odd-Even Communication
      • Wavefront
      • Reduction
      • Divide and Conquer
      • GUI Thread
      • Non-Preemptive Priorities
      • Lazy Initialization
      • Local Serializer
      • Fenced Data Transfer
      • Reference Counting
      • General References
    • Migrating from Threading Building Blocks (TBB)
      • Migrating from tbb::task_scheduler_init
      • Migrating from low-level task API
      • Mixing two runtimes
    • Constrained APIs
    • Invoke a Callable Object
    • Appendix A Costs of Time Slicing
    • Appendix B Mixing With Other Threading Packages
    • References

Developer Reference

  • oneTBB API Reference
    • Feature-test Macros
    • TBB_malloc_replacement_log Function
    • Custom Assertion Handler
    • Type-specified message keys for join_node
    • Scalable Memory Pools
      • memory_pool
      • fixed_pool
      • memory_pool_allocator
    • Helper Functions for Expressing Graphs
      • Constructors for Flow Graph nodes
      • follows and precedes function templates
      • make_node_set function template
      • make_edges function template
    • concurrent_lru_cache
    • task_group extensions
      • Task Bypass Support for task_group
      • task_completion_handle Class
      • task_group Dynamic Dependencies
      • Waiting for Individual Tasks in task_group
    • The customizing mutex type for concurrent_hash_map
    • Waiting for Single Messages in Flow Graph
    • parallel_phase Interface for Task Arena
    • Resource Limiting in the Flow Graph
      • ResourceLimitedNodeBody Named Requirement
      • resource_limiter Class
      • resource_limited_node Class
    • Core Type Selector for Task Arena Constraints

Specification

  • oneAPI Threading Building Blocks Specification
    • Introduction
    • Notational Conventions
    • Identifiers
    • Named Requirements
      • Range
      • Splittable
      • ParallelForBody
      • ParallelForFunc
      • ParallelForIndex
      • ParallelReduceBody
      • ParallelReduceFunc
      • ParallelReduceReduction
      • ParallelForEachBody
      • ContainerBasedSequence
      • ParallelScanBody
      • ParallelScanCombine
      • ParallelScanFunc
      • BlockedRangeValue
      • FilterBody
      • Mutex
      • ReaderWriterMutex
      • HashCompare
      • ContainerRange
      • SuspendFunc
      • AsyncNodeBody
      • ContinueNodeBody
      • GatewayType
      • FunctionNodeBody
      • JoinNodeFunctionObject
      • InputNodeBody
      • MultifunctionNodeBody
      • Sequencer
    • Thread Safety
    • Configuration
      • Namespaces
      • Version Information
      • Enabling Debugging Features
      • Feature Macros
    • Algorithms
      • collaborative_call_once
        • collaborative_once_flag
      • parallel_for
      • parallel_reduce
      • parallel_deterministic_reduce
      • parallel_scan
        • pre_scan_tag and final_scan_tag
      • parallel_for_each
        • feeder
      • parallel_invoke
      • parallel_pipeline
        • filter
        • flow_control
      • parallel_sort
      • blocked_range
      • blocked_range2d
      • blocked_range3d
      • blocked_nd_range
      • auto_partitioner
      • affinity_partitioner
      • static_partitioner
      • simple_partitioner
      • proportional split
      • split
    • Flow Graph
      • graph
        • reset_flags Enumeration
      • graph_node
      • sender
      • receiver
      • Forwarding and Buffering
      • continue_node
      • function_node
      • input_node
      • multifunction_node
      • async_node
      • Function Nodes Policies
      • Nodes Priorities
      • Predefined Concurrency Limits
      • copy_body
      • overwrite_node
      • write_once_node
      • buffer_node
      • queue_node
      • priority_queue_node
      • sequencer_node
      • limiter_node
      • broadcast_node
      • join_node
        • join_node Policies
      • split_node
      • indexer_node
      • composite_node
      • input_port
      • output_port
      • make_edge
      • remove_edge
      • continue_msg
      • tagged_msg
      • Dependency Flow Graph Example
      • Message Flow Graph Example
    • Task Scheduler
      • task_group_context
      • global_control
      • Resumable tasks
      • task_scheduler_handle
      • task_group
      • task_group_status
      • task_handle
      • task_arena
      • this_task_arena
      • task_scheduler_observer
      • attach tag type
    • Containers
      • concurrent_vector
        • Construction, destruction, copying
        • Concurrent growth
        • Element access
        • Iterators
        • Size and capacity
        • Concurrently unsafe operations
        • Parallel iteration
        • Non-member binary comparisons
        • Non-member lexicographical comparisons
        • Non-member swap
        • Deduction guides
      • concurrent_queue
        • Construction, destruction, copying
        • Concurrently safe member functions
        • Concurrently unsafe member functions
        • Iterators
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_bounded_queue
        • Construction, destruction, copying
        • Concurrently safe member functions
        • Concurrently unsafe member functions
        • Iterators
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_priority_queue
        • Construction, destruction, copying
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_hash_map
        • accessor and const_accessor
        • Construction, destruction, copying
        • Concurrently unsafe modifiers
        • Hash policy
        • Size and capacity
        • Lookup
        • Concurrently safe modifiers
        • Iterators
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_unordered_map
        • Construction, destruction, copying
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Element access
        • Lookup
        • Bucket interface
        • Hash policy
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_unordered_multimap
        • Construction, destruction, copying
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Lookup
        • Bucket interface
        • Hash policy
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_unordered_set
        • Construction, destruction, copying
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Lookup
        • Bucket interface
        • Hash policy
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_unordered_multiset
        • Construction, destruction, copying
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Lookup
        • Bucket interface
        • Hash policy
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Deduction guides
      • concurrent_map
        • value_compare
        • Construction, destruction, copying
        • Element access
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Lookup
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Non-member lexicographical comparisons
        • Deduction guides
      • concurrent_multimap
        • value_compare
        • Construction, destruction, copying
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Lookup
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Non-member lexicographical comparisons
        • Deduction guides
      • concurrent_set
        • Construction, destruction, copying
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Lookup
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Non-member lexicographical comparisons
        • Deduction guides
      • concurrent_multiset
        • Construction, destruction, copying
        • Iterators
        • Size and capacity
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Lookup
        • Observers
        • Parallel iteration
        • Non-member swap
        • Non-member binary comparisons
        • Non-member lexicographical comparisons
        • Deduction guides
      • tbb_hash_compare
      • Node handles
    • Thread Local Storage
      • combinable
      • enumerable_thread_specific
        • Construction, destruction, copying
        • Concurrently safe modifiers
        • Concurrently unsafe modifiers
        • Size and capacity
        • Iteration
        • Combining
      • flattened2d
    • Memory Allocation
      • tbb_allocator
      • scalable_allocator
      • cache_aligned_allocator
      • cache_aligned_resource
      • scalable_memory_resource
      • C Interface to Scalable Allocator
    • Mutual Exclusion
      • mutex
      • rw_mutex
      • spin_mutex
      • spin_rw_mutex
      • speculative_spin_mutex
      • speculative_spin_rw_mutex
      • queuing_mutex
      • queuing_rw_mutex
      • null_mutex
      • null_rw_mutex
    • Timing
      • tick_count class
    • info Namespace
    • task_arena::attach
  • Suggest edit
  • Open issue
  • .rst

oneTBB Samples

oneTBB Samples#

To become an expert in using oneTBB, explore its samples and examples to learn how to properly utilize the features and functionality of oneTBB and avoid common mistakes that may impede your performance.

The following samples are available:

  • Containers

    • concurrent_hash_map

    • concurrent_priority_queue

  • Flow Graph
    • A solution to the binpacking problem using a queue_node, a buffer_node, and function_node.

    • Cholesky Factorization algorithm

    • An implementation of dining philosophers in graph using the reserving join_node

    • A parallel implementation of bzip2 block-sorting file compressor

    • An example of a collection of digital logic gates that can be easily composed into larger circuits

    • An example of a Kohonen Self-Organizing Map using cancellation

    • Split computational kernel for execution between CPU and GPU

  • Algorithms

    • parallel_for
      • Game of life overlay

      • Polygon overlay

      • Parallel seismic wave simulation

      • Parallel 2-D raytracer/renderer

      • Find largest matching substrings

      • Resumable task: Split computational kernel for execution between CPU and GPU

    • parallel_for_each

    • parallel_pipeline

    • parallel_reduce

  • Task Scheduler

    • task_arena

    • task_group

    • Execute similar computational kernels, with one task executing the SYCL* code and the other task executing the oneTBB code

  • Other

    • Compute Fibonacci numbers in different ways

Note

You can also refer to the oneAPI Samples to learn more about the ecosystem.

previous

Integrate oneTBB

next

oneTBB Developer Guide

© Copyright UXL Foundation Contributors.