joblib/joblib#1871
cp3xxt
RandomizedSearchCV(blas_pipeline, param_grid).fit(X, y)
The search runs fits in worker threads or processes
Pure Python code, run once per worker
Matrix products and solvers call into the BLAS library
run in its own pool of native threads
with joblib.parallel_config(backend="sequential"): RandomizedSearchCV(blas_pipeline, param_grid).fit(X, y)
n_jobs=1
with joblib.parallel_config(backend="loky", n_jobs=8): RandomizedSearchCV(blas_pipeline, param_grid).fit(X, y)
n_jobs=8
OMP_NUM_THREADS
with joblib.parallel_config(backend="threading", n_jobs=8): RandomizedSearchCV(blas_pipeline, param_grid).fit(X, y)
Thread count is a per-thread setting: must be set from inside each worker thread
One process-wide pool and limit: needs a single “controlling thread” and restoring afterwards
Global and thread-local limit APIs, with different semantics
threadpoolctl
RandomizedSearchCV
joblib