omp-thread-count

A small utility to get the actual number of threads used by OpenMP via Cython bindings.


Keywords
openmp, threads
License
MIT
Install
pip install omp-thread-count==0.1.0

Documentation

OpenMP Thread Counter

Documentation Status

A small Python module to get the actual number of threads used by OMP via Cython bindings.

Why

Because GCC/Cython always returned 1 when calling openmp.get_thread_num or openmp.get_max_threads.

Installation

To install run:

pip install omp-thread-count

In OSX, and possibly other platforms, you may need to specify a compiler with OpenMP support, like this:

CC=gcc-4.8 pip install omp-thread-count

Usage

Importing from python code:

import omp_thread_count

n_threads = omp_thread_count.get_thread_count()

Importing from cython code:

from omp_thread_count._omp cimport get_thread_count

Use omp_thread_count.get_includes() in your extensions' include_dirs to use the header files.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.