summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend
diff options
context:
space:
mode:
Diffstat (limited to 'xmrstak/backend')
-rw-r--r--xmrstak/backend/amd/amd_gpu/gpu.cpp12
-rw-r--r--xmrstak/backend/amd/autoAdjust.hpp6
-rw-r--r--xmrstak/backend/amd/minethd.cpp9
-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.cpp26
-rw-r--r--xmrstak/backend/nvidia/minethd.cpp9
-rw-r--r--xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu12
9 files changed, 47 insertions, 43 deletions
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp
index 9a4ba73..b3d36e7 100644
--- a/xmrstak/backend/amd/amd_gpu/gpu.cpp
+++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp
@@ -309,8 +309,8 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
}
size_t scratchPadSize = 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())
);
size_t g_thd = ctx->rawIntensity;
@@ -376,8 +376,8 @@ size_t InitOpenCLGpu(cl_context opencl_ctx, GpuContext* ctx, const char* source_
}
xmrstak_algo miner_algo[2] = {
- ::jconf::inst()->GetMiningAlgo(),
- ::jconf::inst()->GetMiningAlgoRoot()
+ ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo(),
+ ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgoRoot()
};
int num_algos = miner_algo[0] == miner_algo[1] ? 1 : 2;
@@ -936,7 +936,7 @@ size_t InitOpenCL(GpuContext* ctx, size_t num_gpus, size_t platform_idx)
size_t XMRSetJob(GpuContext* ctx, uint8_t* input, size_t input_len, uint64_t target, xmrstak_algo miner_algo)
{
// switch to the kernel storage
- int kernel_storage = miner_algo == ::jconf::inst()->GetMiningAlgo() ? 0 : 1;
+ int kernel_storage = miner_algo == ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() ? 0 : 1;
cl_int ret;
@@ -1101,7 +1101,7 @@ size_t XMRSetJob(GpuContext* ctx, uint8_t* input, size_t input_len, uint64_t tar
size_t XMRRunJob(GpuContext* ctx, cl_uint* HashOutput, xmrstak_algo miner_algo)
{
// switch to the kernel storage
- int kernel_storage = miner_algo == ::jconf::inst()->GetMiningAlgo() ? 0 : 1;
+ int kernel_storage = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() ? 0 : 1;
cl_int ret;
cl_uint zero = 0;
diff --git a/xmrstak/backend/amd/autoAdjust.hpp b/xmrstak/backend/amd/autoAdjust.hpp
index e7e98d4..685890b 100644
--- a/xmrstak/backend/amd/autoAdjust.hpp
+++ b/xmrstak/backend/amd/autoAdjust.hpp
@@ -84,8 +84,8 @@ private:
constexpr size_t byteToMiB = 1024u * 1024u;
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())
);
std::string conf;
@@ -128,7 +128,7 @@ private:
}
// increase all intensity limits by two for aeon
- if(::jconf::inst()->GetMiningAlgo() == cryptonight_lite)
+ if(::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo() == cryptonight_lite)
maxThreads *= 2u;
// keep 128MiB memory free (value is randomly chosen)
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp
index f5de2fe..5391759 100644
--- a/xmrstak/backend/amd/minethd.cpp
+++ b/xmrstak/backend/amd/minethd.cpp
@@ -195,7 +195,7 @@ void minethd::work_main()
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
// 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 = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
globalStates::inst().iConsumeCnt++;
@@ -222,14 +222,15 @@ void minethd::work_main()
uint8_t new_version = oWork.getVersion();
if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
+ coinDescription coinDesc = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(oWork.iPoolId);
+ if(new_version >= coinDesc.GetMiningForkVersion())
{
- miner_algo = ::jconf::inst()->GetMiningAlgo();
+ miner_algo = coinDesc.GetMiningAlgo();
hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
else
{
- miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ miner_algo = coinDesc.GetMiningAlgoRoot();
hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
lastPoolId = oWork.iPoolId;
diff --git a/xmrstak/backend/cpu/autoAdjust.hpp b/xmrstak/backend/cpu/autoAdjust.hpp
index 579bf48..4e06c4b 100644
--- a/xmrstak/backend/cpu/autoAdjust.hpp
+++ b/xmrstak/backend/cpu/autoAdjust.hpp
@@ -32,8 +32,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 fd84504..097ce2b 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 0aebfb5..8b84b9a 100644
--- a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
+++ b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
@@ -71,8 +71,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*)malloc(sizeof(cryptonight_ctx));
@@ -113,8 +113,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 e2bb979..a6a9e2f 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)
{
}
@@ -420,7 +420,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();
@@ -460,14 +460,15 @@ void minethd::work_main()
uint8_t new_version = oWork.getVersion();
if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
+ 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 = ::jconf::inst()->GetMiningAlgoRoot();
+ miner_algo = coinDesc.GetMiningAlgoRoot();
hash_fun = func_selector(::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
}
lastPoolId = oWork.iPoolId;
@@ -692,7 +693,7 @@ 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;
@@ -724,14 +725,15 @@ void minethd::multiway_work_main()
uint8_t new_version = oWork.getVersion();
if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
+ coinDescription coinDesc = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(oWork.iPoolId);
+ if(new_version >= coinDesc.GetMiningForkVersion())
{
- miner_algo = ::jconf::inst()->GetMiningAlgo();
+ miner_algo = coinDesc.GetMiningAlgo();
hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
}
else
{
- miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ miner_algo = coinDesc.GetMiningAlgoRoot();
hash_fun_multi = func_multi_selector(N, ::jconf::inst()->HaveHardwareAes(), bNoPrefetch, miner_algo);
}
lastPoolId = oWork.iPoolId;
diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp
index b9c1d24..8e66f34 100644
--- a/xmrstak/backend/nvidia/minethd.cpp
+++ b/xmrstak/backend/nvidia/minethd.cpp
@@ -239,7 +239,7 @@ void minethd::work_main()
cpu_ctx = cpu::minethd::minethd_alloc_ctx();
// 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 = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
uint32_t iNonce;
@@ -267,14 +267,15 @@ void minethd::work_main()
uint8_t new_version = oWork.getVersion();
if(new_version != version || oWork.iPoolId != lastPoolId)
{
- if(new_version >= ::jconf::inst()->GetMiningForkVersion() || oWork.iPoolId == 0)
+ coinDescription coinDesc = ::jconf::inst()->GetCurrentCoinSelection().GetDescription(oWork.iPoolId);
+ if(new_version >= coinDesc.GetMiningForkVersion())
{
- miner_algo = ::jconf::inst()->GetMiningAlgo();
+ miner_algo = coinDesc.GetMiningAlgo();
hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
else
{
- miner_algo = ::jconf::inst()->GetMiningAlgoRoot();
+ miner_algo = coinDesc.GetMiningAlgoRoot();
hash_fun = cpu::minethd::func_selector(::jconf::inst()->HaveHardwareAes(), true /*bNoPrefetch*/, miner_algo);
}
lastPoolId = oWork.iPoolId;
diff --git a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu
index f016ef4..f192f01 100644
--- a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu
+++ b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu
@@ -280,14 +280,14 @@ extern "C" int cryptonight_extra_cpu_init(nvid_ctx* ctx)
CUDA_CHECK(ctx->device_id, cudaDeviceSetCacheConfig(cudaFuncCachePreferL1));
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())
);
size_t wsize = ctx->device_blocks * ctx->device_threads;
CUDA_CHECK(ctx->device_id, cudaMalloc(&ctx->d_ctx_state, 50 * sizeof(uint32_t) * wsize));
size_t ctx_b_size = 4 * sizeof(uint32_t) * wsize;
- if(cryptonight_heavy == ::jconf::inst()->GetMiningAlgo())
+ if(cryptonight_heavy == ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo())
{
// extent ctx_b to hold the state of idx0
ctx_b_size += sizeof(uint32_t) * wsize;
@@ -580,8 +580,8 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx)
ctx->free_device_memory = freeMemory;
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())
);
#ifdef WIN32
@@ -612,7 +612,7 @@ extern "C" int cuda_get_deviceinfo(nvid_ctx* ctx)
// up to 16kibyte extra memory is used per thread for some kernel (lmem/local memory)
// 680bytes are extra meta data memory per hash
size_t perThread = hashMemSize + 16192u + 680u;
- if(cryptonight_heavy == ::jconf::inst()->GetMiningAlgo())
+ if(cryptonight_heavy == ::jconf::inst()->GetCurrentCoinSelection().GetDescription(1).GetMiningAlgo())
perThread += 50 * 4; // state double buffer
size_t max_intensity = limitedMemory / perThread;
OpenPOWER on IntegriCloud