diff options
author | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-10-27 16:55:58 +0200 |
---|---|---|
committer | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-10-27 16:59:44 +0200 |
commit | b5a7e4eb7f271cf0ae6a6085ee6e2a4466013e17 (patch) | |
tree | 21699d40d44090a4012b8d7791871402849025c6 /xmrstak | |
parent | b685c90fc2d9d76017565d84a73b92a64ca4843c (diff) | |
download | xmr-stak-b5a7e4eb7f271cf0ae6a6085ee6e2a4466013e17.zip xmr-stak-b5a7e4eb7f271cf0ae6a6085ee6e2a4466013e17.tar.gz |
check if affinity must be set
- check if affinity vale before calling `thd_setaffinity`
Diffstat (limited to 'xmrstak')
-rw-r--r-- | xmrstak/backend/amd/minethd.cpp | 5 | ||||
-rw-r--r-- | xmrstak/backend/cpu/minethd.cpp | 6 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/minethd.cpp | 5 |
3 files changed, 9 insertions, 7 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index e71838b..8bf43f3 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -64,8 +64,9 @@ minethd::minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::th order_guard.wait(); - if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity)) - printer::inst()->print_msg(L1, "WARNING setting affinity failed."); + if(affinity >= 0) //-1 means no affinity + if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity)) + printer::inst()->print_msg(L1, "WARNING setting affinity failed."); } extern "C" { diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index ca6d321..1524eca 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -110,8 +110,9 @@ minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefet order_guard.wait(); - if(!thd_setaffinity(oWorkThd.native_handle(), affinity)) - printer::inst()->print_msg(L1, "WARNING setting affinity failed."); + if(affinity >= 0) //-1 means no affinity + if(!thd_setaffinity(oWorkThd.native_handle(), affinity)) + printer::inst()->print_msg(L1, "WARNING setting affinity failed."); } cryptonight_ctx* minethd::minethd_alloc_ctx() @@ -270,7 +271,6 @@ std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work else printer::inst()->print_msg(L1, "Starting %s thread, no affinity.", cfg.bDoubleMode ? "double" : "single"); - // \todo need thread offset minethd* thd = new minethd(pWork, i + threadOffset, cfg.bDoubleMode, cfg.bNoPrefetch, cfg.iCpuAff); pvThreads.push_back(thd); } diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp index b9ad549..cf58a21 100644 --- a/xmrstak/backend/nvidia/minethd.cpp +++ b/xmrstak/backend/nvidia/minethd.cpp @@ -82,8 +82,9 @@ minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg) order_guard.wait(); - if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity)) - printer::inst()->print_msg(L1, "WARNING setting affinity failed."); + if(affinity >= 0) //-1 means no affinity + if(!cpu::minethd::thd_setaffinity(oWorkThd.native_handle(), affinity)) + printer::inst()->print_msg(L1, "WARNING setting affinity failed."); } |