Skip to main content

Set the number of threads for OpenBLAS, MKL, OMP, NumExpr, and Accelerate.

Project description

numthreads

Set the number of threads used by OpenBLAS, MKL, OMP, NumExpr, and Accelerate

PyPI Build Status CodeCov GitHub Repo stars Documentation

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.

  • 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).
  • No dependencies.

:books: Table of Contents

: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

numthreads-0.3.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

numthreads-0.3.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file numthreads-0.3.0.tar.gz.

File metadata

  • Download URL: numthreads-0.3.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for numthreads-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4b9332731309eb6fc4d8d5bc18f82f6a46a5d1ef10b007b2b69aa531c5efe3a4
MD5 1f0263499f0b63671254d1305e24cc85
BLAKE2b-256 e73a39067d164ef1d1950ef251ef38a36ea9ad7293522448d3513f62db59c592

See more details on using hashes here.

File details

Details for the file numthreads-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: numthreads-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for numthreads-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d9d63716919513c9bd6fdba9d8c4b83e702781fb544b8dcdd1cb2445eedfbf2
MD5 fd5c1f657ce3b83764bb20a762712b48
BLAKE2b-256 260cfb1b2d2a466db100c6e7a37aa9b5e46d6907c445432f4e7f6499d4725326

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page