Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for TBB introspection and set_num_thread #43

Open
ogrisel opened this issue Oct 22, 2019 · 4 comments
Open

Add support for TBB introspection and set_num_thread #43

ogrisel opened this issue Oct 22, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@ogrisel
Copy link
Contributor

ogrisel commented Oct 22, 2019

It's possible to get a CI env with Threading Building Blocks as follows. At the moment threadpoolctl cannot detect TBB loaded by MKL itself loaded by numpy when MKL_THREADING_LAYER=TBB is set:

$ conda create -n numpy-tbb numpy tbb
$ conda activate numpy-tbb
$ MKL_THREADING_LAYER=TBB python -c "import numpy; from pprint import pprint; from threadpoolctl import threadpool_info; pprint(threadpool_info())"
[{'filepath': '/home/ogrisel/miniconda3/envs/mkl-threading-layer/lib/libmkl_rt.so',
  'internal_api': 'mkl',
  'num_threads': 2,
  'prefix': 'libmkl_rt',
  'user_api': 'blas',
  'version': '2019.0.4'}]

@ogrisel ogrisel added the enhancement New feature or request label Oct 22, 2019
@ogrisel
Copy link
Contributor Author

ogrisel commented Oct 22, 2019

The TBB file prefix should probably one of the following (tested under Linux):

$ MKL_THREADING_LAYER="TBB" strace python -c "import numpy" 2>&1 | grep open | grep tbb
openat(AT_FDCWD, "/home/ogrisel/miniconda3/envs/mkl-threading-layer/lib/python3.7/site-packages/mkl/../../../libtbb.so.2", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/home/ogrisel/miniconda3/envs/mkl-threading-layer/lib/python3.7/site-packages/mkl/../../../libmkl_tbb_thread.so", O_RDONLY|O_CLOEXEC) = 4

@jeremiedbb
Copy link
Collaborator

conda create -n numpy-tbb numpy tbb

tbb should not be needed

@ogrisel
Copy link
Contributor Author

ogrisel commented Oct 22, 2019

It is needed on my environment, see: ContinuumIO/anaconda-issues#11389

@ogrisel ogrisel changed the title Add support for TBB introspection Add support for TBB introspection and set_num_thread Oct 22, 2019
@jeremiedbb
Copy link
Collaborator

Ah ok. It's weird that I don't need it and you do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants