Skip to content

TST Avoid side effects in test suite #124

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

Merged
merged 4 commits into from
Apr 20, 2022

Conversation

jeremiedbb
Copy link
Contributor

test_threadpool_controller_limit had a side effect when using OpenBLAS with the OpenMP threading layer.

There must have been a change in the numpy or openblas init, such that now openblas num_threads is 1 after numpy import and only switches to the number of cores after the openmp threadpool is initialized (doing a big matrix multiplication for instance). So what's going on is:

initially:
Openblas num_threads: 1
OpenMP num_threads: 4

with blas_controller.limit(limits=1)
Openblas num_threads: 1
OpenMP num_threads: 1 # set both limits to 1 even if it's only the openblas controller (see OpenMathLib/OpenBLAS#2985)

finally:
Openblas num_threads: 1
OpenMP num_threads: 1 # instead of 4 because the ctx only reset for OpenBLAS to its original value which also set's the OpenMP limit for the same reason as above.

This PR: skip the test when OpenBLAS with the OpenMP threading layer to avoid the side effect that impacts following tests. The assertion of the test was already not tested in this case anyway.

Copy link
Contributor

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeremiedbb jeremiedbb merged commit a33819e into joblib:master Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants