Boost logo

Boost Users :

Subject: Re: [Boost-users] number cores / cpu
From: Damien (damien_at_[hidden])
Date: 2010-08-23 11:15:56


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 <TriumphSprint2000_at_[hidden]>
wrote:

> 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#thread.thread_management.thread.hardware_concurrency
>> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net