Intel® oneAPI Threading Building Blocks (oneTBB)

2022.3.1 · active · verified Sat Apr 11

The `tbb` library provides Intel® oneAPI Threading Building Blocks (oneTBB), a C++ template library for parallel programming. The Python package primarily distributes the oneTBB C++ runtime libraries and headers, enabling other Python packages (e.g., NumPy, SciPy) to leverage TBB for parallelization. It is currently at version 2022.3.1 and sees regular updates, typically a few times per year, to introduce new features and address issues.

Warnings

Install

Imports

Quickstart

Demonstrates how to import the `tbb` package to retrieve information about the installed Intel oneTBB C++ library, such as its version and file system paths. This is useful for verifying installation or for C++/Python interoperability projects.

import tbb
import os

# The 'tbb' Python package primarily provides access to the underlying
# C++ library paths and version, not direct Python parallel computing APIs.
# Other Python libraries (e.g., NumPy, SciPy) might be built to use TBB
# and will detect it automatically if installed.

print(f"TBB package version: {tbb.version_info}")

# Paths useful for C++ projects or Python extensions that link against TBB
print(f"TBB C++ include directory: {tbb.include_dir()}")
print(f"TBB C++ library directory: {tbb.lib_dir()}")

# Example of checking if TBB-enabled features are available in another library
# (Conceptual, 'some_tbb_enabled_lib' is a placeholder)
# try:
#     import some_tbb_enabled_lib
#     if hasattr(some_tbb_enabled_lib, 'is_tbb_enabled') and some_tbb_enabled_lib.is_tbb_enabled():
#         print("A TBB-enabled Python library is detected and can use TBB.")
# except ImportError:
#     print("No specific TBB-enabled Python library found for direct usage example.")

view raw JSON →