MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
cache_info.hpp File Reference
#include <cstddef>
#include <cstdlib>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include <mtl/util/cpuid.hpp>

Classes

struct  mtl::util::cache_info
 Detected data-cache hierarchy, in bytes. More...

Namespaces

namespace  mtl
namespace  mtl::util
namespace  mtl::util::detail

Functions

std::size_t mtl::util::detail::parse_size (const std::string &s)
 Parse the kernel's cache size spelling: a decimal with an optional K/M/G.
std::vector< int > mtl::util::detail::parse_cpu_list (const std::string &s)
 Expand a sysfs cpu list ("0-3,8" or "0,6") to the ids it names.
template<typename Read>
std::size_t mtl::util::detail::distinct_cores (const std::vector< int > &cpus, Read &&read)
 How many distinct PHYSICAL cores appear in a cpu list.
template<typename Read>
void mtl::util::detail::fill_caches_sysfs (cache_info &c, const std::vector< int > &cpus, Read &&read)
 The sysfs walk behind fill_caches_sysfs, over the CPUs cpus, reading through read (a path to its first line; empty if absent), so a test can serve a synthetic tree.
cache_info mtl::util::detect_caches ()
 Detect the data-cache hierarchy.
const cache_info & mtl::util::cached_cache_info ()
 Detect once per process and reuse.