How do I find the number of CPUs in C++11?


Below is the code snippet that helps to get the number CPUs in C++11:


-------------------------------------------------------------------------------------------------------
// Get the number of parallel threads possible. Just an hint to create number of threads
unsigned int n = std::thread::hardware_concurrency();
std::cout << n << " concurrent threads are supported.\n";
-------------------------------------------------------------------------------------------------------

Comments

Popular posts from this blog

Graylog - an easy solution for log management

Comparing C and Go Lang - My first impression