Hello, can I determine how many physical cpu and cores are installed in a system with the boost lib? Under *nix I would read /proc but I would like to do that with boost, because of "os-less". Thanks Phil
On Mon, Aug 23, 2010 at 02:57:49PM +0200, Kraus Philipp wrote:
can I determine how many physical cpu and cores are installed in a system with the boost lib?
There's thread::hardware_concurrency() which will give you a count of hardware threads. Personally, if I wanted more specific knowledge, I'd use /proc on Linux, WMI on Windows, etc., conditionally compiled. [1] http://www.boost.org/doc/libs/1_44_0/doc/html/thread/thread_management.html#... -- Lars Viklund | zao@acc.umu.se
Am 23.08.2010 um 15:02 schrieb Lars Viklund:
On Mon, Aug 23, 2010 at 02:57:49PM +0200, Kraus Philipp wrote:
can I determine how many physical cpu and cores are installed in a system with the boost lib?
There's thread::hardware_concurrency() which will give you a count of hardware threads.
Personally, if I wanted more specific knowledge, I'd use /proc on Linux, WMI on Windows, etc., conditionally compiled.
[1] http://www.boost.org/doc/libs/1_44_0/doc/html/thread/thread_management.html#...
Thank. I need exactlly this number
Kraus Philipp wrote:
Am 23.08.2010 um 15:02 schrieb Lars Viklund:
On Mon, Aug 23, 2010 at 02:57:49PM +0200, Kraus Philipp wrote:
can I determine how many physical cpu and cores are installed in a system with the boost lib?
There's thread::hardware_concurrency() which will give you a count of hardware threads.
Personally, if I wanted more specific knowledge, I'd use /proc on Linux, WMI on Windows, etc., conditionally compiled.
[1] http://www.boost.org/doc/libs/1_44_0/doc/html/thread/thread_management.html#...
Thank. I need exactlly this number
Just beware, IIUC, that the returned count includes hyperthreads(intel). Which if used to set up a thread pool may lead to surprisingly poor performance. Getting the true core count is more involved. Jeff
Mathias Gaunard wrote:
On 23/08/10 15:00, Jeff Flinn wrote:
Just beware, IIUC, that the returned count includes hyperthreads(intel). Which if used to set up a thread pool may lead to surprisingly poor performance.
What makes you think so?
Experience with our application using 2 calculation-threads on a hyperthreaded dual core was 80% faster than using 4 calculation-threads. What makes you ask? :-) Jeff
On Mon, Aug 23, 2010 at 8:32 AM, Jeff Flinn
Mathias Gaunard wrote:
On 23/08/10 15:00, Jeff Flinn wrote:
Just beware, IIUC, that the returned count includes hyperthreads(intel). Which if used to set up a thread pool may lead to surprisingly poor performance.
What makes you think so?
Experience with our application using 2 calculation-threads on a hyperthreaded dual core was 80% faster than using 4 calculation-threads.
What makes you ask? :-)
I also have to pipe in on this, I have learned to truly *hate* the Intel hyper-threading, it hobbles my threaded programs severely, severely enough that I put in an override configuration option so the user can specify how many *real* cores they have... I still know not the purpose of them, other then to slow everything down... (Well yes I do know the purpose, but only in poorly written threaded apps anyway.)
Hi there, does the environment variable "NUMBER_OF_PROCESSORS" still include hyperthreading? Thanks, Christian
Why don't you use the OpenMP API? That's cross-platform.
Damien
Sent from my iPhone
On 2010-08-23, at 8:00 AM, Jeff Flinn
Kraus Philipp wrote:
Am 23.08.2010 um 15:02 schrieb Lars Viklund:
On Mon, Aug 23, 2010 at 02:57:49PM +0200, Kraus Philipp wrote:
can I determine how many physical cpu and cores are installed in a system with the boost lib?
There's thread::hardware_concurrency() which will give you a count of hardware threads.
Personally, if I wanted more specific knowledge, I'd use /proc on Linux, WMI on Windows, etc., conditionally compiled.
[1] http://www.boost.org/doc/libs/1_44_0/doc/html/thread/thread_management.html#... Thank. I need exactlly this number
Just beware, IIUC, that the returned count includes hyperthreads (intel). Which if used to set up a thread pool may lead to surprisingly poor performance. Getting the true core count is more involved.
Jeff
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Yeah, good point. Been bitten by that myself. On 23/08/2010 9:21 AM, Joel Falcou wrote:
On 23/08/10 17:15, Damien wrote:
Why don't you use the OpenMP API? That's cross-platform.
only if your compiler support it and no user played around the OMP environment variables _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (9)
-
Christian Henning
-
Damien
-
Damien
-
Jeff Flinn
-
Joel Falcou
-
Kraus Philipp
-
Lars Viklund
-
Mathias Gaunard
-
OvermindDL1