Set the number of threads for OpenBLAS, MKL, OMP, NumExpr, and Accelerate.
Project description
numthreads
is a concise, easy-to-use tool designed to set the number of threads for various computing libraries including OpenBLAS, Intel's Math Kernel Library (MKL), OpenMP, NumExpr, and Accelerate.
This Python-based utility aids in optimizing the performance of numerical and scientific computing applications by allowing users to efficiently control the threading behavior of these key libraries.
:books: Table of Contents
:sparkles: Features
- Simple and straightforward command-line interface.
- Sets thread count for OpenBLAS, MKL, OpenMP, NumExpr, and Accelerate.
- Context manager support for temporary thread setting in Python code.
- Cross-platform compatibility (Linux, macOS, Windows).
:package: Installation
To install numthreads
, run the following command:
pip install "numthreads"
:rocket: Quick Start
After installing numthreads
, you can easily set the number of threads used by supported libraries via the command line. For example, to set the number of threads to 4, run:
numthreads 4
Unix-like Systems (Linux, macOS, WSL)
To apply the settings in your shell:
eval $(numthreads <number_of_threads>)
Windows (PowerShell)
In PowerShell, use:
Invoke-Expression $(numthreads <number_of_threads>)
Using as a Python Module
You can also use numthreads
as a Python module:
from numthreads import set_num_threads
set_num_threads(4)
or
from numthreads import num_threads
with num_threads(4):
# Your code here will run with the specified number of threads
pass
:question: Getting Help
For more information, or to report issues, please visit numthreads GitHub repository.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file numthreads-0.1.0.tar.gz
.
File metadata
- Download URL: numthreads-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fca7143be5a61ef19410dada2f0d87ef43021e4df8c7ed7e7071745144a37d8 |
|
MD5 | 830f0f63148e11c97bdd69035fbd46ac |
|
BLAKE2b-256 | 13591ab088be3c1658225460449fbe857614ba60cc056ce9141681a141b7722b |
File details
Details for the file numthreads-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: numthreads-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec4a21ac97ec8bf4634935bfd37f4e53cb8533bca9ce0be2fb5dd5d64956bbae |
|
MD5 | 08f733f44a272952bd01637540b424ce |
|
BLAKE2b-256 | db26ab3056204e5f33aaf749e60d95cb6b37ae44fbe7f03c0f16a8e3f6893e17 |