Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
``"prefix"`` was checked first.
https://github.com/joblib/threadpoolctl/pull/278

- Fixed `limits="sequential_blas_under_openmp"`, which left all BLAS libraries
unlimited as soon as OpenBLAS was loaded, whatever its threading layer, or a
library used the OpenMP threading layer (e.g. BLIS). The limit is now only
skipped when OpenBLAS uses the OpenMP threading layer, as documented.
https://github.com/joblib/threadpoolctl/pull/283


3.7.0 (2026-09-15)
==================
Expand Down
8 changes: 5 additions & 3 deletions tests/test_threadpoolctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,11 @@ def test_get_params_for_sequential_blas_under_openmp():

params = controller._get_params_for_sequential_blas_under_openmp()

if controller.select(
internal_api="openblas", threading_layer="openmp"
).lib_controllers:
if any(
lib_info["internal_api"] == "openblas"
and lib_info.get("threading_layer") == "openmp"
for lib_info in original_info
):
assert params["limits"] is None
assert params["user_api"] is None

Expand Down
9 changes: 6 additions & 3 deletions threadpoolctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,12 @@ def _get_params_for_sequential_blas_under_openmp(self):
This function takes into account the unexpected behavior of OpenBLAS with the
OpenMP threading layer.
"""
if self.select(
internal_api="openblas", threading_layer="openmp"
).lib_controllers:
# select() matches any of its kwargs: chain two calls to require both.
if (
self.select(internal_api="openblas")
.select(threading_layer="openmp")
.lib_controllers
):
# Don't change anything: OpenBLAS is already sequential by default when it
# is called from an OpenMP parallel region, and limiting it would also
# limit the OpenMP parallel regions of the calling thread.
Expand Down
Loading