BLD Enable parallel cythonization#14203
Merged
adrinjalali merged 5 commits intoscikit-learn:masterfrom Jun 28, 2019
Merged
Conversation
jeremiedbb
reviewed
Jun 27, 2019
sklearn/_build_utils/__init__.py
Outdated
| try: | ||
| import joblib | ||
| n_jobs = getattr(joblib, "effective_n_jobs")() | ||
| except (ImportError, AttributeError): |
Member
There was a problem hiding this comment.
why not just n_jobs = joblib.effective_n_jobs() ?
Member
Author
There was a problem hiding this comment.
Joblib 0.11 doesn't have effective_n_jobs I believe
Member
There was a problem hiding this comment.
I mean why do you need to use getattr ? An AttributeError would be raised also by trying to call joblib.effective_n_jobs.
Member
Author
There was a problem hiding this comment.
Nevermind, it exists. My concern was that prior to joblib 0.13.0 (that included this fix https://github.com/tomMoral/loky/pull/114) was over-estimated in some cases such as CI that has 32 CPU cores, but actually only 2 can be used.
Changed this PR accordingly.
jeremiedbb
approved these changes
Jun 27, 2019
thomasjpfan
approved these changes
Jun 27, 2019
adrinjalali
approved these changes
Jun 28, 2019
Member
adrinjalali
left a comment
There was a problem hiding this comment.
This made me very happy :) Thanks @rth
koenvandevelde
pushed a commit
to koenvandevelde/scikit-learn
that referenced
this pull request
Jul 12, 2019
* Parallel cythonization by default * Address review comment * Fix * Better comment wording * Use contextlib.supress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cythonization during build takes a while (~1 min on my laptop). This enables parallel cythonization by default when
joblib.effective_n_jobsis available (older versions don't have it, and we don't want to make it a mandatory build dependency).The scaling with CPU cores is almost ideal (I imagine up to 8-10 cores).
This should improve CI build time a bit, since most CI agents have 2 CPU cores that we can use.