Possible duplicate:Programmatically find the number of cores on a machine
I have a multithreaded C ++ program that runs on Windows, MacOS, and Linux. Is there an easy way to find out how many kernels I'm currently working on? My system works best when it has 1 thread for each core.
I believe this question may contain your answer:
Programmatically find the number of cores on a machine
Edit: I just voted for ybungalobill's answer. I love you boost!
boost
Use boost::thread::hardware_concurrency()or std::thread::hardware_concurrency()if you have a C ++ 0x compiler.
boost::thread::hardware_concurrency()
std::thread::hardware_concurrency()
In the linux system cat / proc / cpuinfo and analyze the output in one way. Dunno if it is most effective or not.
Source: https://habr.com/ru/post/1778529/More articles:Проблема 98 - Project Euler - anagramR5RS Scheme: Passing by Link - pass-by-referenceXNA and multitouch - xnaiphone NSNumberFormatter runs on simulator not on os 4.2 device during parsing - iphoneSaving stream (mp4) on iphone - streamhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1778530/user-has-to-login-again-when-i-redirect-from-http-to-https&usg=ALkJrhiBu3RM7jeg00EBrIcIo337hzDyHgHow to get a list of all tokens from the Solr / Lucene index? - luceneAdvanced use of the msg * command in a batch file? - windows-7Get rid of document.write? - javascriptLooking for combinations that are up to 15 in a hand card - javaAll Articles