-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Introduce a helper returning the system CPUs #1018
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
Conversation
core/base/inc/TROOT.h
Outdated
| UInt_t GetImplicitMTPoolSize(); | ||
|
|
||
| /// Get the number of system CPUs. | ||
| UInt_t GetNCPUs(); |
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.
(Especially since) this is not configurable, this routine belongs in TSystem. Thanks.
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.
Sure!
|
Starting build on |
|
Hi @xvallspl , what problem is this change solving? |
|
It's a proposal, totally open to discussion. I found myself in need of this piece of code several times and I always thought it would be cool to have it as a single call instead of having to remember those three lines. You can see it a nicer and useful way for writing nCPUs dependent, processor-agnostic code. I would say it's better than replicating the current process of getting the number of CPUs all over the place. This function will be helpful when parallelizing without IMT/tbb, where you may still be in need of knowing the number of threads you can use. |
...refactoring the old way of obtaining it.
|
Starting build on |
|
Moved it to TSystem. |
|
Just remembered std::thread::hardware_concurrency. Closing the PR. |
...refactoring the old way of obtaining it.
Just for convenience.