<div dir="ltr">On Tue, Jul 2, 2013 at 9:10 PM, Nico Rieck <span dir="ltr"><<a href="mailto:nico.rieck@gmail.com" target="_blank" class="cremed">nico.rieck@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 02.07.2013 23:55, Óscar Fuentes wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Nico and Howard,<br>
<br>
Nico Rieck <<a href="mailto:nico.rieck@gmail.com" target="_blank" class="cremed">nico.rieck@gmail.com</a>> writes:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 02.07.2013 19:53, Howard Hinnant wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+#elif defined(_WIN32)<br>
+ SYSTEM_INFO info;<br>
+ GetSystemInfo(&info);<br>
+ return info.dwNumberOfProcessors;<br>
#else // defined(CTL_HW) && defined(HW_NCPU)<br>
</blockquote>
<br>
I'm not that familiar with the implementation for the other platforms,<br>
but this snippet returns the number of logical processors. In my local<br>
Windows port I use the number of cores, as I think that's more<br>
appropriate. This is also what MSVCRT does on Windows.<br>
</blockquote>
<br>
As per my interpretation of the standard, returning the number of<br>
logical processors is the right thing.<br>
<br>
I checked VS2013 on a hyperthreaded machine and<br>
std::thread::hardware_<u></u>concurrency does just that. Same for<br>
boost::thread::hardware_<u></u>concurrency.<br>
</blockquote>
<br></div>
Did they change that? VS2012 uses GetLogicalProcessorInformation<u></u>/Ex for Vista/7+, and GetSystemInfo below. Boost seems to use the latter.<br>
And if people use this to (for example) determine the amount of threads to spawn, number of cores makes more sense to me.</blockquote><div><br></div><div>No, just the opposite. You want to spawn a number of software threads based on how many hardware threads your system can handle. For hyperthreaded systems each core can handle two hardware threads so that's how many should be spawned.</div>
</div></div></div>