Skip to content

Make OpenBLAS's usage of OpenMP respect openblas_set_num_threads()#5808

Open
nh2 wants to merge 3 commits into
OpenMathLib:developfrom
nh2:issue-5806-openblas_set_num_threads-openmp
Open

Make OpenBLAS's usage of OpenMP respect openblas_set_num_threads()#5808
nh2 wants to merge 3 commits into
OpenMathLib:developfrom
nh2:issue-5806-openblas_set_num_threads-openmp

Conversation

@nh2

@nh2 nh2 commented May 12, 2026

Copy link
Copy Markdown

Fixes #5806.

Also

Reviewing by commit is recommended.

nh2 added 3 commits May 12, 2026 05:18
…ixes OpenMathLib#5806.

Until now, the code in `num_cpu_avail()`,

    if (blas_cpu_number != openmp_nthreads) {
      goto_set_num_threads(openmp_nthreads);
    }

would just always set the threads back to OpenMP's thread count.
@itamarst

Copy link
Copy Markdown

Would be nice to get a fix merged, if someone has time to review.

@ngoldbaum

Copy link
Copy Markdown
Contributor

@frbg - @itamarst is working with me and @kumaraditya303 on improving support for free-threading in Python packages. He's identified the issue this PR in particular fixes as the cause of substantial CPU oversubscription in scikit-learn using the threading joblib backend. We'd appreciate your eyes on this and the original issue.

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.

openblas_set_num_threads() is silently overridden when built with USE_OPENMP

3 participants