std::thread::hardware_concurrency() does not return the correct number of Logical Processors in AMD Ryzen threadripper 3990x

  amd, c++, multithreading

I am using thread library in different machines (including Linux and Windows, and also both Intel and AMD CPUs and with clang++, GNU and MSVC). in all of them, std::thread::hardware_concurrency() returns what is called Logical Processors in Windows or the maximum number of threads including the hyper threads, however in a new machine which has AMD Ryzen threadripper 3990x CPU it returns only the number of cores which is half of the maximum number of threads (64 instead of 128). I read in the c++ reference that the return value depends on the implementation and it’s only a hint, but my question is that how can I find the implementation or is there an upper bound for the number of threads that this function returns or not. Since I was getting a similar behavior across all machines that I was testing I have no clue what is the reason for this different behavior.

Source: Windows Questions C++

LEAVE A COMMENT