-
Notifications
You must be signed in to change notification settings - Fork 28
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
ENH: use joblib instead of multiprocessing #227
Conversation
The threading backend seems to both fix our issues, and give proper stdout, so using that now. |
@scottclowe as this is a rather heavy update to how we handle multiprocessing, can you have a good look and then merge if you're okay with it? Especially in how it interacts with the changes you had made before. |
Codecov Report
@@ Coverage Diff @@
## master #227 +/- ##
==========================================
- Coverage 93.18% 93.05% -0.13%
==========================================
Files 8 8
Lines 939 922 -17
Branches 197 196 -1
==========================================
- Hits 875 858 -17
Misses 33 33
Partials 31 31
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Ah. The usage of
Additionally, supposedly no multiprocessing code is used at all if |
Handle ncores=None as one-per-CPU thread like with multiprocessing.Pool for backward compatibility. Handle ncores<0 correctly as per joblib.Parallel n_jobs<0, i.e. -1 = all cores -2 = 1 less than all cores etc
I changed our code to map
I'd rather avoid going through at all joblib when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, with changes I pushed.
Multiprocessing was giving several issues (such as #147). This PR changes it to using joblib instead.
As a bonus, the code is now much more readable, and the same code is used for Python 2 and 3.
For now it's a draft request as there currently is a bug (known from joblib for a while) that stdout from jupyter notebooks only show up in the terminal, not the notebooks themselves. (See ipython/ipykernel#402 and jupyter/notebook#700).
It can be fixed by using a different backend, but the whole point is to use the standard joblib backend which fixes our issues.