summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'xmrstak/backend/cpu')
-rw-r--r--xmrstak/backend/cpu/autoAdjust.hpp5
-rw-r--r--xmrstak/backend/cpu/autoAdjustHwloc.hpp5
-rw-r--r--xmrstak/backend/cpu/crypto/cryptonight_common.cpp11
3 files changed, 17 insertions, 4 deletions
diff --git a/xmrstak/backend/cpu/autoAdjust.hpp b/xmrstak/backend/cpu/autoAdjust.hpp
index 79c0fc2..579bf48 100644
--- a/xmrstak/backend/cpu/autoAdjust.hpp
+++ b/xmrstak/backend/cpu/autoAdjust.hpp
@@ -31,7 +31,10 @@ public:
bool printConfig()
{
- const size_t hashMemSizeKB = cn_select_memory(::jconf::inst()->GetMiningAlgo()) / 1024u;
+ const size_t hashMemSizeKB = std::max(
+ cn_select_memory(::jconf::inst()->GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ ) / 1024u;
const size_t halfHashMemSizeKB = hashMemSizeKB / 2u;
configEditor configTpl{};
diff --git a/xmrstak/backend/cpu/autoAdjustHwloc.hpp b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
index 20bbb54..fd84504 100644
--- a/xmrstak/backend/cpu/autoAdjustHwloc.hpp
+++ b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
@@ -28,7 +28,10 @@ public:
autoAdjust()
{
- hashMemSize = cn_select_memory(::jconf::inst()->GetMiningAlgo());
+ hashMemSize = std::max(
+ cn_select_memory(::jconf::inst()->GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ );
halfHashMemSize = hashMemSize / 2u;
}
diff --git a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
index 8c30e2c..5899744 100644
--- a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
+++ b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
@@ -35,6 +35,7 @@ extern "C"
#include "xmrstak/jconf.hpp"
#include <stdio.h>
#include <stdlib.h>
+#include <algorithm>
#include <malloc.h>
@@ -69,7 +70,10 @@ 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 = cn_select_memory(::jconf::inst()->GetMiningAlgo());
+ size_t hashMemSize = std::max(
+ cn_select_memory(::jconf::inst()->GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ );
cryptonight_ctx* ptr = (cryptonight_ctx*)malloc(sizeof(cryptonight_ctx));
@@ -108,7 +112,10 @@ 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 = cn_select_memory(::jconf::inst()->GetMiningAlgo());
+ size_t hashMemSize = std::max(
+ cn_select_memory(::jconf::inst()->GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ );
if(ctx->ctx_info[0] != 0)
{
OpenPOWER on IntegriCloud