Registry / ai-ml / tcmlib

tcmlib

JSON →
library1.5.0pypypi✓ verified 22d ago

tcmlib is a Python library by Intel that implements the Thread Composability Manager. It coordinates CPU resource usage between Intel® oneAPI Threading Building Blocks (oneTBB) and Intel® OpenMP to prevent excessive oversubscription when both runtimes are used concurrently within a single process. This helps optimize performance for multi-threaded Python applications, particularly in AI/ML and scientific computing workloads. The library is currently at version 1.4.1 and is actively maintained by Intel.

pip install tcmlib
INSTALL
IMPORT
SIG · TCMLIB
T
tcmlib
ai-mlpythonv1.5.0
Install
1.6s avg
Import
Disk
16MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TCM
from tcmlib import TCM
from tcmlib import TCM

The primary way to enable the Thread Composability Manager's effects is by setting the `TCM_ENABLE` environment variable to `1` before running your Python application. This allows `tcmlib` to coordinate multi-threading runtimes like oneTBB and OpenMP used by underlying libraries (e.g., NumPy with Intel® oneAPI Math Kernel Library (oneMKL)). The Python package itself provides the necessary hooks and runtime components for this coordination.

import os import numpy as np import time # The Thread Composability Manager is often enabled via an environment variable. # For demonstration, we'll set it here, but typically it's set before the Python process starts. # Ensure Intel oneTBB and OpenMP runtimes are installed and configured for optimal effect. # NOTE: For actual use, set this environment variable BEFORE running your Python script, # e.g., in bash: export TCM_ENABLE=1 python your_script.py # Or in a system-wide environment configuration. os.environ['TCM_ENABLE'] = os.environ.get('TCM_ENABLE', '1') # Set to '1' to enable, '0' to disable if not already set. print(f"TCM_ENABLE is set to: {os.environ.get('TCM_ENABLE')}") def heavy_computation(size): # Simulate a compute-intensive task that might use OpenMP/oneTBB internally start_time = time.time() matrix_a = np.random.rand(size, size) matrix_b = np.random.rand(size, size) result = np.dot(matrix_a, matrix_b) end_time = time.time() return end_time - start_time if __name__ == '__main__': print("Starting heavy computation...") duration = heavy_computation(1000) # Adjust size based on your CPU/memory print(f"Computation finished in {duration:.4f} seconds.") print("To observe the effects of tcmlib, compare performance with and without TCM_ENABLE=1,") print("especially when other Intel-optimized libraries (like NumPy with oneMKL) are also used.") # Clean up environment variable for subsequent runs in the same shell/notebook session if needed # del os.environ['TCM_ENABLE']
Debug
Known issues
gotchaThe Thread Composability Manager's core functionality is largely activated by setting the `TCM_ENABLE=1` environment variable *before* your Python script executes, rather than through direct Python API calls within your code. Failing to set this environment variable will prevent the manager from coordinating resources.
fix
Ensure `export TCM_ENABLE=1` is set in your shell environment or configured at a system level before launching Python applications that use Intel-optimized libraries with concurrent threading.
affects: All versions
gotchatcmlib operates by coordinating Intel® oneAPI Threading Building Blocks (oneTBB) and Intel® OpenMP. Its benefits are most pronounced when your Python application, or the libraries it depends on (e.g., NumPy, SciPy if linked against oneMKL), utilize these underlying Intel runtimes. Without these components, the `tcmlib` package may have little to no discernible effect on performance.
fix
For maximum benefit, ensure you are using Intel-optimized Python distributions or libraries linked against Intel® oneAPI components (like oneMKL) in your environment.
affects: All versions
gotchaThe `tcmlib` package is distributed under an 'Other/Proprietary License (Intel Simplified Software License)'. Users should review the terms of this license to ensure compliance with their project requirements.
fix
Consult the license documentation provided with the `tcmlib` package or on its PyPI page for full details.
affects: All versions
gotchaAs `tcmlib` is an Intel-specific optimization library, its performance benefits are primarily targeted at Intel CPU architectures. While it may not cause issues on other architectures, its intended performance gains might not be realized without compatible Intel hardware and software stacks. The wheels available on PyPI target `manylinux` and `win_amd64` for `x86_64` architecture, supporting Python 2 and 3.
fix
Deploy on systems with Intel CPUs and recommended software stacks (e.g., Intel oneAPI Toolkits) to leverage the full benefits.
affects: All versions
Upgrade
Version history
1.5.0latest on PyPI · released Apr 24, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
26
OpenAI (training)
1
Resources