Added support for allocate RandomX dataset on each NUMA node.

This commit is contained in:
XMRig 2019-07-27 19:41:59 +07:00
parent e53ae0c15e
commit 828fc065b0
11 changed files with 178 additions and 70 deletions

View file

@ -38,6 +38,7 @@
namespace xmrig {
std::vector<uint32_t> HwlocCpuInfo::m_nodeIndexes;
uint32_t HwlocCpuInfo::m_features = 0;
@ -151,8 +152,17 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
m_nodes = std::max<size_t>(countByType(m_topology, HWLOC_OBJ_NUMANODE), 1);
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
if (nodes() > 1 && hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
m_features |= SET_THISTHREAD_MEMBIND;
if (m_nodes > 1) {
if (hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
m_features |= SET_THISTHREAD_MEMBIND;
}
m_nodeIndexes.reserve(m_nodes);
hwloc_obj_t node = nullptr;
while ((node = hwloc_get_next_obj_by_type(m_topology, HWLOC_OBJ_NUMANODE, node)) != nullptr) {
m_nodeIndexes.emplace_back(node->os_index);
}
}
}

View file

@ -47,7 +47,8 @@ public:
HwlocCpuInfo();
~HwlocCpuInfo() override;
static inline bool has(Feature feature) { return m_features & feature; }
static inline bool has(Feature feature) { return m_features & feature; }
static inline const std::vector<uint32_t> &nodeIndexes() { return m_nodeIndexes; }
protected:
CpuThreads threads(const Algorithm &algorithm) const override;
@ -62,6 +63,7 @@ protected:
private:
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads) const;
static std::vector<uint32_t> m_nodeIndexes;
static uint32_t m_features;
char m_backend[20];