.. _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 <https://github.com/uxlfoundation/oneTBB/tree/master/examples/concurrent_hash_map>`_ 
  * `concurrent_priority_queue <https://github.com/uxlfoundation/oneTBB/tree/master/examples/concurrent_priority_queue>`_ 

* `Flow Graph <https://github.com/uxlfoundation/oneTBB/tree/master/examples/graph>`_ 
   * `A solution to the binpacking problem using a queue_node, a buffer_node, and function_node. <https://github.com/uxlfoundation/oneTBB/tree/master/examples/graph/binpack>`_ 
   * `Cholesky Factorization algorithm <https://github.com/uxlfoundation/oneTBB/tree/master/examples/graph/cholesky>`_
   * `An implementation of dining philosophers in graph using the reserving join_node <https://github.com/uxlfoundation/oneTBB/tree/master/examples/graph/dining_philosophers>`_
   * `A parallel implementation of bzip2 block-sorting file compressor <https://github.com/uxlfoundation/oneTBB/tree/master/examples/graph/fgbzip2>`_
   * `An example of a collection of digital logic gates that can be easily composed into larger circuits <https://github.com/uxlfoundation/oneTBB/tree/master/examples/graph/logic_sim>`_
   * `An example of a Kohonen Self-Organizing Map using cancellation <https://github.com/uxlfoundation/oneTBB/tree/master/examples/graph/som>`_
   * `Split computational kernel for execution between CPU and GPU <https://github.com/uxlfoundation/oneTBB/tree/master/examples/sycl/tbb-async-sycl>`_

* **Algorithms**

  * `parallel_for <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_for>`_
     * `Game of life overlay <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_for/game_of_life>`_
     * `Polygon overlay <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_for/polygon_overlay>`_
     * `Parallel seismic wave simulation <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_for/seismic>`_
     * `Parallel 2-D raytracer/renderer <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_for/tachyon>`_
     * `Find largest matching substrings <https://github.com/uxlfoundation/oneTBB/tree/master/examples/getting_started>`_
     * `Resumable task: Split computational kernel for execution between CPU and GPU <https://github.com/uxlfoundation/oneTBB/tree/master/examples/sycl/tbb-resumable-tasks-sycl>`_
  * `parallel_for_each <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_for_each>`_
  * `parallel_pipeline <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_pipeline>`_
  * `parallel_reduce <https://github.com/uxlfoundation/oneTBB/tree/master/examples/parallel_reduce>`_

* **Task Scheduler**

  * `task_arena <https://github.com/uxlfoundation/oneTBB/tree/master/examples/task_arena>`_
  * `task_group <https://github.com/uxlfoundation/oneTBB/tree/master/examples/task_group>`_
  * `Execute similar computational kernels, with one task executing the SYCL* code and the other task executing the oneTBB code <https://github.com/uxlfoundation/oneTBB/tree/master/examples/sycl/tbb-task-sycl>`_

* **Other**

  * `Compute Fibonacci numbers in different ways <https://github.com/uxlfoundation/oneTBB/tree/master/examples/test_all>`_


.. note:: You can also refer to the `oneAPI Samples <https://oneapi-src.github.io/oneAPI-samples/>`_ to learn more about the ecosystem. 