4template <
class F,
class... Args>
5auto MakePinnedThread(
int cpu, std::string_view name, F&& f, Args... args) -> std::thread {
11 if (!node.has_value()) {
12 throw std::invalid_argument(
"cpu invalid");
15 return MakeThread(name, policies, std::forward<F>(f), std::forward<Args>(args)...);
static CpuAffinity MakeBindCpu(int cpu)
Create CpuAffinity bound to the specified CPU.
static MemPolicy MakeBindNode(int node)
Creates a strict policy (using MPOL_BIND) to allocate all memory to the specified node.
Combines the the available NUMA policy types in one object.
void SetCpuAffinity(std::optional< CpuAffinity > affinity) noexcept
Set CPU affinity.
void SetMemPolicy(std::optional< MemPolicy > policy) noexcept
Set memory policy.
std::optional< int > GetNodeOfCpu(int cpu) noexcept
Get NUMA node of the given CPU.
std::thread MakeThread(std::string_view thread_name, NumaPolicies const &policies, Func &&func, Args &&... args)
Primary overload accepting string-view for thread_name.
Contains memory function declarations.
Contains declarations for numapp thread utilities.