Boost logo

Boost :

Subject: Re: [boost] cache size runtime detection
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-08-17 13:08:37


On 17.08.2015 19:56, Joel FALCOU wrote:
>>> It should definitely be a dedicated library. What I was thinking of
>>> for quite some time is a bit broader. My idea is a system capabilities
>>> library (Boost.SystemCaps) which would offer a generic interface for
>>> querying the current system properties such as:
>>>
>>> - Number of CPU cores/threads.
>
> Doesn't Bosot.Thread has that already ?

If you mean thread::hardware_concurrency() then it doesn't allow to
differentiate HT threads from the real cores. Plus, as suggested,
support for NUMA topology would be good as well.

>>> - Current CPU core capabilities (vendor string, instruction set
>>> extensions, cache properties, etc.). Probably, this would need to
>>> support heterogenous systems as well.
>
> We currently have a wrapper for CPUID(EX) like calls so it may just fit
> there.

Yes, we can use cpuid on x86, and /proc/cpuinfo on other architectures.
There must be alternatives on Windows as well.

>>> - System RAM size.
>>> - OS version string.
>
> Those I dunno except it's non-trivial.

/proc/meminfo, uname().

> Well, as far as creep goes, we can have a basic system put together adn
> expand it later.

Yes, that's my thought as well. Such a library can never be complete. :)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk