std::thread::hardware_concurrency on Threadripper #1230
|
AMD Threadripper has 128 hardware threads. |
Replies: 8 comments 1 reply
|
It reports number of hardware threads that are within processor group, so it is capped by 64. To utilize more hardware threads need to manage groups. See Processor Groups as a starting point. The value does not take into account affinity. |
|
Thanks Alex Guteniev (@AlexGuteniev), Seem an explication of OS implementation details that caused new standard compliance issue. Thanks, |
|
Yeah, C++ standard is apparently not the right place to include processor groups, and currently it deliberately limits CPU management by only having
Not very seamless way is access to it as non-standard extension. It is available already for Billy O'Neal (@BillyONeal) may have more thoughts on that |
|
A problem I see with making it process group aware is that if you use Sure, making the STL aware of processor groups might be doable, but consider the case where you use I don't think it's a standards violation, as the standard says the value should only be considered as a hint. In this case, you're being hinted at how much threads are supported by default without additional configuration. |
|
Fun fact:
It is capped by whatever number of processor the process group has. So on your Last time I tested looking at the cpu selection overview for a multiprocessgroup application the task-manager crashed. Don't know if this has been fixed in windows by now.
|
|
Like the above commentators have pointed out |
|
Put another way, |
|
We later merged #5459 to fix this, after the OS changed behavior. |
Like the above commentators have pointed out
std::hardware_concurrencyis only a hint.The reason it makes sense to return the number of threads in the processor group is for the reason that Charles Milette (@sylveon) gives. Without using Windows API calls there isn't a way to use all the threads you expect to be able to use if we returned the true number of processors on the system.