From aeb2c6e8ecb573ddbd82d2d650a9e7e5f8f9fcf3 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 15 Nov 2019 03:10:58 +0700 Subject: [PATCH] #1285 Added command line options --cuda-bfactor-hint and --cuda-bsleep-hint. --- README.md | 2 ++ src/backend/cuda/CudaConfig.cpp | 4 ++++ src/core/config/ConfigTransform.cpp | 6 ++++++ src/core/config/Config_platform.h | 2 ++ src/core/config/usage.h | 2 ++ 5 files changed, 16 insertions(+) diff --git a/README.md b/README.md index cf286f86..814f927b 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ CUDA backend: --cuda enable CUDA mining backend --cuda-loader=PATH path to CUDA plugin (xmrig-cuda.dll or libxmrig-cuda.so) --cuda-devices=N comma separated list of CUDA devices to use + --cuda-bfactor-hint=N bfactor hint for autoconfig (0-12) + --cuda-bsleep-hint=N bsleep hint for autoconfig --no-nvml disable NVML (NVIDIA Management Library) support Logging: diff --git a/src/backend/cuda/CudaConfig.cpp b/src/backend/cuda/CudaConfig.cpp index 8f26c14c..dbad4220 100644 --- a/src/backend/cuda/CudaConfig.cpp +++ b/src/backend/cuda/CudaConfig.cpp @@ -36,6 +36,8 @@ namespace xmrig { static bool generated = false; +static const char *kBfactorHint = "bfactor-hint"; +static const char *kBsleepHint = "bsleep-hint"; static const char *kDevicesHint = "devices-hint"; static const char *kEnabled = "enabled"; static const char *kLoader = "loader"; @@ -116,6 +118,8 @@ void xmrig::CudaConfig::read(const rapidjson::Value &value) if (value.IsObject()) { m_enabled = Json::getBool(value, kEnabled, m_enabled); m_loader = Json::getString(value, kLoader); + m_bfactor = std::min(Json::getUint(value, kBfactorHint, m_bfactor), 12u); + m_bsleep = Json::getUint(value, kBsleepHint, m_bsleep); setDevicesHint(Json::getString(value, kDevicesHint)); diff --git a/src/core/config/ConfigTransform.cpp b/src/core/config/ConfigTransform.cpp index 4ece6186..d0264258 100644 --- a/src/core/config/ConfigTransform.cpp +++ b/src/core/config/ConfigTransform.cpp @@ -195,6 +195,12 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const case IConfig::CudaDevicesKey: /* --cuda-devices */ set(doc, kCuda, kEnabled, true); return set(doc, kCuda, "devices-hint", arg); + + case IConfig::CudaBFactorKey: /* --cuda-bfactor-hint */ + return set(doc, kCuda, "bfactor-hint", static_cast(strtol(arg, nullptr, 10))); + + case IConfig::CudaBSleepKey: /* --cuda-bsleep-hint */ + return set(doc, kCuda, "bsleep-hint", static_cast(strtol(arg, nullptr, 10))); # endif # ifdef XMRIG_FEATURE_NVML diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index 6ab03267..80fcf87f 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -108,6 +108,8 @@ static const option options[] = { { "cuda", 0, nullptr, IConfig::CudaKey }, { "cuda-loader", 1, nullptr, IConfig::CudaLoaderKey }, { "cuda-devices", 1, nullptr, IConfig::CudaDevicesKey }, + { "cuda-bfactor-hint", 1, nullptr, IConfig::CudaBFactorKey }, + { "cuda-bsleep-hint", 1, nullptr, IConfig::CudaBSleepKey }, # endif # ifdef XMRIG_FEATURE_NVML { "no-nvml", 0, nullptr, IConfig::NvmlKey }, diff --git a/src/core/config/usage.h b/src/core/config/usage.h index bcc3abd1..48b34b81 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -113,6 +113,8 @@ static inline const std::string &usage() u += " --cuda enable CUDA mining backend\n"; u += " --cuda-loader=PATH path to CUDA plugin (xmrig-cuda.dll or libxmrig-cuda.so)\n"; u += " --cuda-devices=N comma separated list of CUDA devices to use\n"; + u += " --cuda-bfactor-hint=N bfactor hint for autoconfig (0-12)\n"; + u += " --cuda-bsleep-hint=N bsleep hint for autoconfig\n"; # endif # ifdef XMRIG_FEATURE_NVML u += " --no-nvml disable NVML (NVIDIA Management Library) support\n";