Cache Size

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cache Size

Boost - Dev mailing list
A recurring discussion in Boost.Math has been needing a cross-platform way to query the L1D cache size of a machine. I have most of a solution in a [personal repo](https://github.com/mborland/cache). It did not make sense to us to have this in Boost.Math because it would be useful outside of that scope, but we did not know where it should go. Is there an existing library where this would fit? If necessary I can roll it into a library submission that exposes the functionality of CPUID.

Matt

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Cache Size

Boost - Dev mailing list
I recommend https://www.open-mpi.org/projects/hwloc/ as a widely portable
library for querying L1D size and many other architectural properties.
Clearly, this isn't in the Boost family, nor is it even C++, but it seems
imprudent to try reimplement hwloc in Boost.

Jeff

On Wed, Sep 30, 2020 at 2:30 PM Matt Borland via Boost <
[hidden email]> wrote:

> A recurring discussion in Boost.Math has been needing a cross-platform way
> to query the L1D cache size of a machine. I have most of a solution in a
> [personal repo](https://github.com/mborland/cache). It did not make sense
> to us to have this in Boost.Math because it would be useful outside of that
> scope, but we did not know where it should go. Is there an existing library
> where this would fit? If necessary I can roll it into a library submission
> that exposes the functionality of CPUID.
>
> Matt
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


--
Jeff Hammond
[hidden email]
http://jeffhammond.github.io/

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Cache Size

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 1/10/2020 07:04, Matt Borland wrote:
> A recurring discussion in Boost.Math has been needing a cross-platform way to query the L1D cache size of a machine. I have most of a solution in a [personal repo](https://github.com/mborland/cache). It did not make sense to us to have this in Boost.Math because it would be useful outside of that scope, but we did not know where it should go. Is there an existing library where this would fit? If necessary I can roll it into a library submission that exposes the functionality of CPUID.

C++17 already provides these [1]; this is determined at compile time
based on typical values for the platform rather than the precise values
for a particular machine, but since the most common usage for this
information in my experience is to decide strides in data structures,
that's usually when you need to know it.

[1]:
https://en.cppreference.com/w/cpp/thread/hardware_destructive_interference_size

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Cache Size

Boost - Dev mailing list
On Thu, 2020-10-01 at 12:39 +1300, Gavin Lambert via Boost wrote:
> C++17 already provides these [1]; this is determined at compile time
> based on typical values for the platform rather than the precise
> values
> for a particular machine, but since the most common usage for this
> information in my experience is to decide strides in data structures,
> that's usually when you need to know it.
>
> [1]:
> https://en.cppreference.com/w/cpp/thread/hardware_destructive_interference_size

Unfortunately, there is currently limited compiler support[1] for
those.

Jeff, I will take a look at hwloc. I had not seen that before.

[1]: https://en.cppreference.com/w/cpp/compiler_support P0154R1

Matt




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost