mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 12:09:22 +00:00
Simplified VirtualMemory::bindToNUMANode.
This commit is contained in:
parent
35d9c755e0
commit
e53ae0c15e
1 changed files with 3 additions and 11 deletions
|
@ -46,21 +46,13 @@ void xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
|
|||
hwloc_topology_init(&topology);
|
||||
hwloc_topology_load(topology);
|
||||
|
||||
const int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_PU);
|
||||
const unsigned puId = static_cast<unsigned>(affinity);
|
||||
|
||||
for (unsigned i = 0; i < hwloc_get_nbobjs_by_depth(topology, depth); i++) {
|
||||
hwloc_obj_t pu = hwloc_get_obj_by_depth(topology, depth, i);
|
||||
|
||||
if (pu->os_index == puId) {
|
||||
if (hwloc_set_membind_nodeset(topology, pu->nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD) < 0) {
|
||||
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, puId);
|
||||
if (pu == nullptr || hwloc_set_membind_nodeset(topology, pu->nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD) < 0) {
|
||||
LOG_WARN("CPU #%02u warning: \"can't bind memory\"", puId);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hwloc_topology_destroy(topology);
|
||||
# endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue