summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'xmrstak/backend/cpu')
-rw-r--r--xmrstak/backend/cpu/autoAdjust.hpp4
-rw-r--r--xmrstak/backend/cpu/autoAdjustHwloc.hpp4
-rw-r--r--xmrstak/backend/cpu/crypto/cryptonight_common.cpp8
-rw-r--r--xmrstak/backend/cpu/minethd.cpp40
4 files changed, 36 insertions, 20 deletions
diff --git a/xmrstak/backend/cpu/autoAdjust.hpp b/xmrstak/backend/cpu/autoAdjust.hpp
index ed96d8b..518721a 100644
--- a/xmrstak/backend/cpu/autoAdjust.hpp
+++ b/xmrstak/backend/cpu/autoAdjust.hpp
@@ -37,8 +37,8 @@ public:
{
const size_t hashMemSizeKB = std::max(
- cn_select_memory(::jconf::inst()->GetMiningAlgo()),
- cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot())
) / 1024u;
const size_t halfHashMemSizeKB = hashMemSizeKB / 2u;
diff --git a/xmrstak/backend/cpu/autoAdjustHwloc.hpp b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
index f110ee3..b1f3914 100644
--- a/xmrstak/backend/cpu/autoAdjustHwloc.hpp
+++ b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
@@ -29,8 +29,8 @@ public:
autoAdjust()
{
hashMemSize = std::max(
- cn_select_memory(::jconf::inst()->GetMiningAlgo()),
- cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot())
);
halfHashMemSize = hashMemSize / 2u;
}
diff --git a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
index 3ff3cb9..ee3b663 100644
--- a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
+++ b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
@@ -204,8 +204,8 @@ size_t cryptonight_init(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg)
cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg)
{
size_t hashMemSize = std::max(
- cn_select_memory(::jconf::inst()->GetMiningAlgo()),
- cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot())
);
cryptonight_ctx* ptr = (cryptonight_ctx*)_mm_malloc(sizeof(cryptonight_ctx), 4096);
@@ -283,8 +283,8 @@ cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, al
void cryptonight_free_ctx(cryptonight_ctx* ctx)
{
size_t hashMemSize = std::max(
- cn_select_memory(::jconf::inst()->GetMiningAlgo()),
- cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot())
);
if(ctx->ctx_info[0] != 0)
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index 263c83a..f8f70f9 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -231,7 +231,7 @@ bool minethd::self_test()
bool bResult = true;
- if(::jconf::inst()->GetMiningAlgo() == cryptonight)
+ if(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() == cryptonight)
{
unsigned char out[32 * MAX_N];
cn_hash_fun hashf;
@@ -276,13 +276,13 @@ bool minethd::self_test()
"\xa0\x84\xf0\x1d\x14\x37\xa0\x9c\x69\x85\x40\x1b\x60\xd4\x35\x54\xae\x10\x58\x02\xc5\xf5\xd8\xa9\xb3\x25\x36\x49\xc0\xbe\x66\x05"
"\xa0\x84\xf0\x1d\x14\x37\xa0\x9c\x69\x85\x40\x1b\x60\xd4\x35\x54\xae\x10\x58\x02\xc5\xf5\xd8\xa9\xb3\x25\x36\x49\xc0\xbe\x66\x05", 160) == 0;
}
- else if(::jconf::inst()->GetMiningAlgo() == cryptonight_lite)
+ else if(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() == cryptonight_lite)
{
}
- else if(::jconf::inst()->GetMiningAlgo() == cryptonight_monero)
+ else if(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() == cryptonight_monero)
{
}
- else if(::jconf::inst()->GetMiningAlgo() == cryptonight_aeon)
+ else if(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() == cryptonight_aeon)
{
}
@@ -424,7 +424,7 @@ void minethd::work_main()
job_result result;
// start with root algorithm and switch later if fork version is reached
- auto miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ auto miner_algo = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot();
cn_hash_fun hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
ctx = minethd_alloc_ctx();
@@ -434,6 +434,7 @@ void minethd::work_main()
result.iThreadId = iThreadNo;
uint8_t version = 0;
+ size_t lastPoolId = 0;
while (bQuit == 0)
{
@@ -461,13 +462,20 @@ void minethd::work_main()
result.iNonce = *piNonce;
uint8_t new_version = oWork.getVersion();
- if(new_version != version)
+ if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion())
+ coinDescription coinDesc = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(oWork.iPoolId);
+ if(new_version >= coinDesc.GetMiningForkVersion())
{
- miner_algo = ::jconf::inst()->GetMiningAlgo();
+ miner_algo = coinDesc.GetMiningAlgo();
hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
}
+ else
+ {
+ miner_algo = coinDesc.GetMiningAlgoRoot();
+ hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
+ }
+ lastPoolId = oWork.iPoolId;
version = new_version;
}
@@ -689,9 +697,10 @@ void minethd::multiway_work_main()
globalStates::inst().iConsumeCnt++;
// start with root algorithm and switch later if fork version is reached
- auto miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ auto miner_algo = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot();
cn_hash_fun_multi hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
uint8_t version = 0;
+ size_t lastPoolId = 0;
while (bQuit == 0)
{
@@ -718,13 +727,20 @@ void minethd::multiway_work_main()
iNonce = *piNonce[0];
uint8_t new_version = oWork.getVersion();
- if(new_version != version)
+ if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion())
+ coinDescription coinDesc = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(oWork.iPoolId);
+ if(new_version >= coinDesc.GetMiningForkVersion())
+ {
+ miner_algo = coinDesc.GetMiningAlgo();
+ hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
+ }
+ else
{
- miner_algo = ::jconf::inst()->GetMiningAlgo();
+ miner_algo = coinDesc.GetMiningAlgoRoot();
hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
}
+ lastPoolId = oWork.iPoolId;
version = new_version;
}
OpenPOWER on IntegriCloud