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.
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
using physical threads #641
base: master
Are you sure you want to change the base?
using physical threads #641
Changes from all commits
92823d6
52f278d
dfa3384
69809a1
739a7ab
39518a5
a05702f
dc49105
38030c6
35f5c5e
b3e5a64
1141dda
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 16 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 30 in include/finufft/finufft_utils.hpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
Check warning on line 270 in src/finufft_core.cpp
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.
Just a small word of caution: this will always report the full number of physical cores on the system, independent of possible restrictions on the executable itself. On computing center nodes, the system may limit a job to a part of the available hardware (e.g. via
taskset
); if this happens, the code here will overestimate the number of usable cores.On systems with power and efficiency cores the code will probably (this is just speculation, I haven't tested it) return the sum of both core counts, which may also be larger than the amount of cores that should actually be used.
I'm not saying that the code should be changed (I wouldn't know how...), but this could be worth remembering in case there are reports about weird behaviour in the future.
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.
Yeah, this emerged from some discussions with @blackwer yesterday. I'll see if I find a way to figure out the active cores.
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.
I was going to suggest looking at
hwloc
for inspiration, and it looks like you've found a very similar solution that they did. For posterity:https://github.com/open-mpi/hwloc/blob/1779eae26f2f55a510e9d73cb648b68e71d9e6d4/hwloc/topology-linux.c#L1036
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.
I was going to suggest
libpthreads
... it seems this functionality is available everywhere these days :-)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.
Where is the functionality in pthread? I didn't go the route of hwloc because I read somewhere that is an issue on maybe freebsd? This seemed more portable to me
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.
In
ducc
I'm usingwhich is very close to your
getAllowedCoreCount
function, but it gets the affinity masks fromlibpthreads
instead of the GNUlibc
. It might be more portable, but I'm not sure.Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp
Check warning on line 235 in src/finufft_utils.cpp