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

[MRG] FEA Make it possible to pass pre-inspected modules to threadpool_limit #95

Merged
merged 20 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
8 changes: 4 additions & 4 deletions tests/_openmp_test_helper/nested_prange_blas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ IF USE_BLIS:
ELSE:
from scipy.linalg.cython_blas cimport dgemm

from threadpoolctl import _ThreadpoolInfo, _ALL_USER_APIS
from threadpoolctl import ThreadpoolController


def check_nested_prange_blas(double[:, ::1] A, double[:, ::1] B, int nthreads):
Expand All @@ -43,12 +43,12 @@ def check_nested_prange_blas(double[:, ::1] A, double[:, ::1] B, int nthreads):
int prange_num_threads
int *prange_num_threads_ptr = &prange_num_threads

inner_info = [None]
inner_ctl = [None]

with nogil, parallel(num_threads=nthreads):
if openmp.omp_get_thread_num() == 0:
with gil:
inner_info[0] = _ThreadpoolInfo(user_api=_ALL_USER_APIS)
inner_ctl[0] = ThreadpoolController()

prange_num_threads_ptr[0] = openmp.omp_get_num_threads()

Expand All @@ -62,4 +62,4 @@ def check_nested_prange_blas(double[:, ::1] A, double[:, ::1] B, int nthreads):
&alpha, &B[0, 0], &k, &A[i * chunk_size, 0], &k,
&beta, &C[i * chunk_size, 0], &n)

return np.asarray(C), prange_num_threads, inner_info[0]
return np.asarray(C), prange_num_threads, inner_ctl[0]
Loading