-
Notifications
You must be signed in to change notification settings - Fork 30
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
Conversation
@ogrisel, finally I chose to allow |
From a user point of view, I would find more natural to have: from threadpoolctl import ThreadpoolController
controller = ThreadpoolController()
with controller.limited_context(1):
# do stuff here We can keep the top-level |
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.
To me ctl
is a shortcut for "control" rather than "controller". And here the "old" modules are controllers, so I would explicitly name them as such.
While we are at it, it the longer _controller
local variable names make it a hell to reformat to PEP8 manually, feel free to blackify everything while we are at it :)
I extracted the blackify part in another PR to distinguish between the 2 big source of diff. Review will be easier starting by #96 |
We can ignore the lint issues because they will be fixed in the black PR. @jeremiedbb this PR is still WIP, do you still have changes to implement in mind, or is it ready for review? |
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.
Thank you very much for this PR. I like the design and naming.
In addition to the changelog, I think the new extended object oriented public API should be presented in a code snippet in the README.md
of the project.
For the record, I am fine with renaming |
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.
LGTM once the conflicts have been solved and the suggestions below have been handled.
Merged! Thank you very much @jeremiedbb . Could you please try to leverage this in a PR in scikit-learn using a dummy backward compat wrapper in |
Fixes #94
In addition, makes some stuff public and get rid of the "module" naming, as suggested by @ogrisel
_ThreadpoolInfo
->ThreadpoolController
_Module
->LibController
_<Lib>Module
-><Lib>Controller
The possibility to pass an existing controller (which has already loaded the libraries) to threadpool_limits makes it much faster (like 100x faster):
Although it's already quite short, it's not negligible in some situations (I already experienced that in scikit-learn).
TODO