diff options
author | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-10-28 21:20:19 +0200 |
---|---|---|
committer | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-10-28 21:20:19 +0200 |
commit | 7ecf4cec6ea1f6bfc0ff01b281b459115b1d4fca (patch) | |
tree | 0667caa4ba65e163e27ee74099da4a4d26bb6de7 /xmrstak/backend/cpu/hwlocMemory.cpp | |
parent | a7fb89bec2b88cc694bf88aed729451bb9bdd8a0 (diff) | |
download | xmr-stak-7ecf4cec6ea1f6bfc0ff01b281b459115b1d4fca.zip xmr-stak-7ecf4cec6ea1f6bfc0ff01b281b459115b1d4fca.tar.gz |
fix windows compile and broken aeon
- fix windows linker error during compile
- fix wrong parameter to call aeon (nvidia-backend)
Diffstat (limited to 'xmrstak/backend/cpu/hwlocMemory.cpp')
-rw-r--r-- | xmrstak/backend/cpu/hwlocMemory.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/xmrstak/backend/cpu/hwlocMemory.cpp b/xmrstak/backend/cpu/hwlocMemory.cpp new file mode 100644 index 0000000..94d2b53 --- /dev/null +++ b/xmrstak/backend/cpu/hwlocMemory.cpp @@ -0,0 +1,64 @@ +#include "xmrstak/backend/cpu/hwlocMemory.hpp" + +#ifndef CONF_NO_HWLOC + +#include "xmrstak/misc/console.hpp" + +#include <hwloc.h> + +/** pin memory to NUMA node + * + * Set the default memory policy for the current thread to bind memory to the + * NUMA node. + * + * @param puId core id + */ +void bindMemoryToNUMANode( size_t puId ) +{ + int depth; + hwloc_topology_t topology; + + hwloc_topology_init(&topology); + hwloc_topology_load(topology); + + if(!hwloc_topology_get_support(topology)->membind->set_thisthread_membind) + { + printer::inst()->print_msg(L0, "hwloc: set_thisthread_membind not supported"); + hwloc_topology_destroy(topology); + return; + } + + depth = hwloc_get_type_depth(topology, HWLOC_OBJ_PU); + + for( size_t 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( 0 > hwloc_set_membind_nodeset( + topology, + pu->nodeset, + HWLOC_MEMBIND_BIND, + HWLOC_MEMBIND_THREAD)) + { + printer::inst()->print_msg(L0, "hwloc: can't bind memory"); + } + else + { + printer::inst()->print_msg(L0, "hwloc: memory pinned"); + break; + } + } + } + + hwloc_topology_destroy(topology); +} +#else + +void bindMemoryToNUMANode( size_t ) +{ +} + +#endif |