Numa abstraction¶
An abstraction over hwloc
.
-
struct hwloc_error : public std::runtime_error¶
An exception thrown when
hwloc
fails.
-
enum class lf::numa_strategy¶
Enum to control distribution strategy of workers among numa nodes.
Values:
-
enumerator fan¶
Put workers as far away from each other as possible (maximize cache.)
-
enumerator seq¶
Fill up each numa node sequentially (ignoring SMT).
-
enumerator fan¶
-
class numa_topology¶
A shared description of a computers topology.
Objects of this type have shared-pointer semantics.
Public Functions
-
inline numa_topology()¶
Construct a topology.
If
hwloc
is not installed this topology is empty.
Distribute a vector of objects over this topology.
This function returns a vector of
numa_node
s. Eachnuma_node
contains a hierarchical view of the elements indata
.
-
inline explicit operator bool() const noexcept¶
Test if this topology is empty.
-
inline auto split(std::size_t n, numa_strategy strategy = numa_strategy::fan) const -> std::vector<numa_handle>¶
Split a topology into
n
uniformly distributed handles to single processing units.Here the definition of “uniformly” depends on
strategy
. Ifstrategy == numa_strategy::seq
we try to use the minimum number of numa nodes then divided each node such that each PU has as much cache as possible. Ifstrategy == numa_strategy::fan
we try and maximize the amount of cache each PI gets.If this topology is empty then this function returns a vector of
n
empty handles.
-
class numa_handle¶
A handle to a single processing unit in a NUMA computer.
Subclassed by lf::ext::numa_topology::numa_node< T >
Public Functions
-
inline void bind() const¶
Bind the calling thread to the set of processing units in this
cpuset
.If
hwloc
is not installed both handles are null and this is a noop.
-
inline void bind() const¶
-
template<typename T>
struct numa_node : public lf::ext::numa_topology::numa_handle¶ A single-threads hierarchical view of a set of objects.
This is a
numa_handle
augmented with list of neighbors-lists each neighbors-list has equidistant neighbors. The first neighbors-list always exists and contains only one element, the one “owned” by the thread. Each subsequent neighbors-list has elements that are topologically more distant from the element in the first neighbour-list.
-
inline numa_topology()¶