![]() |
alpaka
Abstraction Library for Parallel Kernel Acceleration
|
Implement functions required to set thread affinity and pin memory. More...
Functions | |
| size_t | getFreeGlobalMemBytes (uint32_t cpuDomainIdx) |
| Return the number of free bytes in a CPU domain. | |
| size_t | getMemCapacityBytes (uint32_t cpuDomainIdx) |
| Return the memory capacity of a CPU domain. | |
| uint32_t | getNumCores (uint32_t cpuDomainIdx) |
| Return the number of cores in a CPU domain. | |
| uint32_t | getNumCpuDomains () |
| Get the number of alpaka host CPU domains. | |
| std::optional< size_t > | parseNodeMemInfoValueBytes (unsigned osNodeIndex, std::string_view key) |
| Parse the OS NUMA information. | |
| template<typename T> | |
| void | pinPointer (T *const ptr, size_t bytes, uint32_t cpuDomainIdx) |
| Set the default NUMA memory node for a CPU-domain memory range. | |
| void | setThreadAffinity (uint32_t cpuDomainIdx) |
| Set the affinity of the current thread to all cores of a CPU domain. | |
Variables | |
| constexpr uint32_t | allDomains = std::numeric_limits<uint32_t>::max() |
| Constant to select all CPU domains. | |
Implement functions required to set thread affinity and pin memory.
There is always a fallback implementation to be able to run without hwloc. In this case domain selection is not possible and all cores will be taken into account.
Domain model:
This avoids duplicating the same CPU cores as multiple alpaka devices on systems where DDR and HBM are modeled as separate NUMA nodes below the same Group.
|
inline |
Return the number of free bytes in a CPU domain.
Linux-only implementation via /sys/devices/system/node/nodeX/meminfo. If the CPU domain has multiple attached NUMA memory nodes, e.g. DDR and HBM, the returned value is the sum of all attached memory nodes.
| cpuDomainIdx | Index of the cpu group. |
Definition at line 504 of file utility.hpp.
|
inline |
Return the memory capacity of a CPU domain.
If the CPU domain has multiple attached NUMA memory nodes, e.g. DDR and HBM, the returned value is the sum of all attached memory nodes.
| cpuDomainIdx | Index of the cpu group. |
Definition at line 474 of file utility.hpp.
|
inline |
Return the number of cores in a CPU domain.
Here "cores" means logical CPUs / processing units, so SMT siblings are counted too.
| cpuDomainIdx | Index of the cpu group. |
Definition at line 442 of file utility.hpp.
|
inline |
Get the number of alpaka host CPU domains.
Definition at line 243 of file utility.hpp.
|
inline |
Parse the OS NUMA information.
hwloc is not providing the available free memory in a NUMA domain. Therefore we fall back to check the NUMA node information in the OS directly.
| osNodeIndex | The index of the NUMA node in the OS. |
| key | The key value you want to read out e.g. 'MemFree:' or 'HugePages_Total:'. |
Definition at line 261 of file utility.hpp.
|
inline |
Set the default NUMA memory node for a CPU-domain memory range.
| ptr | pointer address to pin, nullptr is valid input. |
| bytes | the number of bytes to pin starting from the ptr address. |
| cpuDomainIdx | Index of the cpu group. |
Definition at line 410 of file utility.hpp.
|
inline |
Set the affinity of the current thread to all cores of a CPU domain.
| cpuDomainIdx | Legacy name: CPU-domain index starting with zero, or 'allDomains' to use all cores. |
Definition at line 301 of file utility.hpp.
|
constexpr |
Constant to select all CPU domains.
Definition at line 40 of file utility.hpp.