Skip to content

ENH over-subscription mitigation + MTN vendor loky 2.6 #940

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 24 commits into from
Sep 25, 2019

Conversation

tomMoral
Copy link
Contributor

@tomMoral tomMoral commented Sep 19, 2019

Vendor the version 2.6 of loky in joblib. This version introduce a way to set the environment variables in the child process before loading any module. This PR intend to use it to specify the maximal number of inner threads max_inner_num_threads in the child processes. This would fix #880 and #913 .

@codecov
Copy link

codecov bot commented Sep 19, 2019

Codecov Report

Merging #940 into master will decrease coverage by 0.66%.
The diff coverage is 95.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #940      +/-   ##
==========================================
- Coverage   95.42%   94.76%   -0.67%     
==========================================
  Files          45       45              
  Lines        6497     6857     +360     
==========================================
+ Hits         6200     6498     +298     
- Misses        297      359      +62
Impacted Files Coverage Δ
joblib/executor.py 100% <100%> (ø) ⬆️
joblib/_parallel_backends.py 95.96% <100%> (-1.27%) ⬇️
joblib/parallel.py 97.01% <100%> (-0.33%) ⬇️
joblib/__init__.py 100% <100%> (ø) ⬆️
joblib/test/test_parallel.py 95.94% <93.05%> (-1.12%) ⬇️
joblib/backports.py 39.58% <0%> (-54.17%) ⬇️
joblib/_multiprocessing_helpers.py 82.35% <0%> (-2.95%) ⬇️
joblib/test/test_dask.py 96.05% <0%> (-2.47%) ⬇️
joblib/pool.py 89.65% <0%> (-1.73%) ⬇️
joblib/test/common.py 86.44% <0%> (-1.7%) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 470a637...0cb312a. Read the comment docs.

@ogrisel
Copy link
Contributor

ogrisel commented Sep 19, 2019

Here is the workaround for the intel-openmp issue:

import os

# Workaround issue discovered in intel-openmp 2019.5:
# https://github.com/ContinuumIO/anaconda-issues/issues/11294
os.environ.setdefault("KMP_INIT_AT_FORK", "FALSE")

@tomMoral tomMoral requested a review from ogrisel September 20, 2019 12:41
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.

First batch of comments:

@tomMoral tomMoral changed the title MTN vendor loky 2.6 ENH over-subscription mitigation + MTN vendor loky 2.6 Sep 25, 2019
@tomMoral tomMoral merged commit a41bd5a into joblib:master Sep 25, 2019
@tomMoral tomMoral deleted the MTN_vendor_loky_2.6 branch September 25, 2019 07:49
@ogrisel
Copy link
Contributor

ogrisel commented Sep 25, 2019

Yeah!

@tomMoral
Copy link
Contributor Author

Just catch a typo in the doc, I did push commit 1940e57 on master to fix it.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Oct 31, 2019
Release 0.14.0
Improved the load balancing between workers to avoid stranglers caused by an excessively large batch size when the task duration is varying significantly (because of the combined use of joblib.Parallel and joblib.Memory with a partially warmed cache for instance). joblib/joblib#899
Add official support for Python 3.8: fixed protocol number in Hasher and updated tests.
Fix a deadlock when using the dask backend (when scattering large numpy arrays). joblib/joblib#914
Warn users that they should never use joblib.load with files from untrusted sources. Fix security related API change introduced in numpy 1.6.3 that would prevent using joblib with recent numpy versions. joblib/joblib#879
Upgrade to cloudpickle 1.1.1 that add supports for the upcoming Python 3.8 release among other things. joblib/joblib#878
Fix semaphore availability checker to avoid spawning resource trackers on module import. joblib/joblib#893
Fix the oversubscription protection to only protect against nested Parallel calls. This allows joblib to be run in background threads. joblib/joblib#934
Fix ValueError (negative dimensions) when pickling large numpy arrays on Windows. joblib/joblib#920
Upgrade to loky 2.6.0 that add supports for the setting environment variables in child before loading any module. joblib/joblib#940
Fix the oversubscription protection for native libraries using threadpools (OpenBLAS, MKL, Blis and OpenMP runtimes). The maximal number of threads is can now be set in children using the inner_max_num_threads in parallel_backend. It defaults to cpu_count() // n_jobs.
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.

Oversubscription protection done by setting environment variables in worker initializer is not effective
3 participants