• Advertisement
Sign in to follow this  

linux get Cpu Count?

This topic is 2885 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
You can read /proc/cpuinfo. This will have one entry for each core. If the processor has Hyper Threading you will see two for each core. Although I think the file has values that could be used to determine actual physical processors.

Share this post


Link to post
Share on other sites
OpenMP also has the omp_get_num_procs function, if OpenMP were an option.

Share this post


Link to post
Share on other sites
boost also has boost::thread::get_hardware_concurrency() or boost::thread::hardware_concurrency() or something like that

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement