1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-27 22:33:29 -05:00

Merged v4.5.0-beta

This commit is contained in:
MoneroOcean
2019-11-02 12:09:14 -07:00
79 changed files with 3704 additions and 161 deletions

View File

@@ -48,6 +48,11 @@
#endif
#ifdef XMRIG_FEATURE_CUDA
# include "backend/cuda/CudaConfig.h"
#endif
namespace xmrig {
static const char *kCPU = "cpu";
@@ -60,6 +65,15 @@ static const char *kRandomX = "randomx";
static const char *kOcl = "opencl";
#endif
#ifdef XMRIG_FEATURE_CUDA
static const char *kCuda = "cuda";
#endif
#if defined(XMRIG_FEATURE_NVML)
static const char *kHealthPrintTime = "health-print-time";
#endif
class ConfigPrivate
{
@@ -73,6 +87,14 @@ public:
# ifdef XMRIG_FEATURE_OPENCL
OclConfig cl;
# endif
# ifdef XMRIG_FEATURE_CUDA
CudaConfig cuda;
# endif
# if defined(XMRIG_FEATURE_NVML)
uint32_t healthPrintTime = 60;
# endif
};
}
@@ -104,6 +126,14 @@ const xmrig::OclConfig &xmrig::Config::cl() const
#endif
#ifdef XMRIG_FEATURE_CUDA
const xmrig::CudaConfig &xmrig::Config::cuda() const
{
return d_ptr->cuda;
}
#endif
#ifdef XMRIG_ALGO_RANDOMX
const xmrig::RxConfig &xmrig::Config::rx() const
{
@@ -112,6 +142,14 @@ const xmrig::RxConfig &xmrig::Config::rx() const
#endif
#if defined(XMRIG_FEATURE_NVML)
uint32_t xmrig::Config::healthPrintTime() const
{
return d_ptr->healthPrintTime;
}
#endif
bool xmrig::Config::isShouldSave() const
{
if (!isAutoSave()) {
@@ -124,6 +162,12 @@ bool xmrig::Config::isShouldSave() const
}
# endif
# ifdef XMRIG_FEATURE_CUDA
if (cuda().isShouldSave()) {
return true;
}
# endif
return (m_upgrade || cpu().isShouldSave() || m_benchmark.isNewBenchRun());
}
@@ -147,6 +191,14 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
d_ptr->cl.read(reader.getValue(kOcl));
# endif
# ifdef XMRIG_FEATURE_CUDA
d_ptr->cuda.read(reader.getValue(kCuda));
# endif
# ifdef XMRIG_FEATURE_NVML
d_ptr->healthPrintTime = reader.getUint(kHealthPrintTime, d_ptr->healthPrintTime);
# endif
return true;
}
@@ -179,18 +231,25 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember(StringRef(kOcl), cl().toJSON(doc), allocator);
# endif
doc.AddMember("algo-perf", m_benchmark.toJSON(doc), allocator);
doc.AddMember("donate-level", m_pools.donateLevel(), allocator);
doc.AddMember("donate-over-proxy", m_pools.proxyDonate(), allocator);
doc.AddMember("log-file", m_logFile.toJSON(), allocator);
doc.AddMember("pools", m_pools.toJSON(doc), allocator);
doc.AddMember("print-time", printTime(), allocator);
doc.AddMember("retries", m_pools.retries(), allocator);
doc.AddMember("retry-pause", m_pools.retryPause(), allocator);
doc.AddMember("syslog", isSyslog(), allocator);
doc.AddMember("user-agent", m_userAgent.toJSON(), allocator);
doc.AddMember("watch", m_watch, allocator);
# ifdef XMRIG_FEATURE_CUDA
doc.AddMember(StringRef(kCuda), cuda().toJSON(doc), allocator);
# endif
doc.AddMember("rebench-algo", isRebenchAlgo(), allocator);
doc.AddMember("bench-algo-time", benchAlgoTime(), allocator);
doc.AddMember("donate-level", m_pools.donateLevel(), allocator);
doc.AddMember("donate-over-proxy", m_pools.proxyDonate(), allocator);
doc.AddMember("log-file", m_logFile.toJSON(), allocator);
doc.AddMember("pools", m_pools.toJSON(doc), allocator);
doc.AddMember("print-time", printTime(), allocator);
# if defined(XMRIG_FEATURE_NVML)
doc.AddMember(StringRef(kHealthPrintTime), healthPrintTime(), allocator);
# endif
doc.AddMember("retries", m_pools.retries(), allocator);
doc.AddMember("retry-pause", m_pools.retryPause(), allocator);
doc.AddMember("syslog", isSyslog(), allocator);
doc.AddMember("user-agent", m_userAgent.toJSON(), allocator);
doc.AddMember("watch", m_watch, allocator);
doc.AddMember("algo-perf", m_benchmark.toJSON(doc), allocator);
doc.AddMember("rebench-algo", isRebenchAlgo(), allocator);
doc.AddMember("bench-algo-time", benchAlgoTime(), allocator);
}

View File

@@ -40,9 +40,10 @@ namespace xmrig {
class ConfigPrivate;
class CudaConfig;
class IThread;
class RxConfig;
class OclConfig;
class RxConfig;
class Config : public BaseConfig
@@ -60,10 +61,18 @@ public:
# endif
inline Benchmark &benchmark() { return m_benchmark; }
# ifdef XMRIG_FEATURE_CUDA
const CudaConfig &cuda() const;
# endif
# ifdef XMRIG_ALGO_RANDOMX
const RxConfig &rx() const;
# endif
# if defined(XMRIG_FEATURE_NVML)
uint32_t healthPrintTime() const;
# endif
bool isShouldSave() const;
bool read(const IJsonReader &reader, const char *fileName) override;
void getJSON(rapidjson::Document &doc) const override;

View File

@@ -47,6 +47,10 @@ static const char *kRandomX = "randomx";
static const char *kOcl = "opencl";
#endif
#ifdef XMRIG_FEATURE_CUDA
static const char *kCuda = "cuda";
#endif
static inline uint64_t intensity(uint64_t av)
{
@@ -181,6 +185,22 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
return set(doc, kOcl, "platform", arg);
# endif
# ifdef XMRIG_FEATURE_CUDA
case IConfig::CudaKey: /* --cuda */
return set(doc, kCuda, "enabled", true);
case IConfig::CudaLoaderKey: /* --cuda-loader */
return set(doc, kCuda, "loader", arg);
# endif
# ifdef XMRIG_FEATURE_NVML
case IConfig::NvmlKey: /* --no-nvml */
return set(doc, kCuda, "nvml", false);
case IConfig::HealthPrintTimeKey: /* --health-print-time */
return set(doc, "health-print-time", static_cast<uint64_t>(strtol(arg, nullptr, 10)));
# endif
default:
break;
}

View File

@@ -72,6 +72,13 @@ R"===(
"cn/0": false,
"cn-lite/0": false
},
"cuda": {
"enabled": false,
"loader": null,
"nvml": true,
"cn/0": false,
"cn-lite/0": false
},
"donate-level": 5,
"donate-over-proxy": 1,
"log-file": null,
@@ -93,6 +100,7 @@ R"===(
}
],
"print-time": 60,
"health-print-time": 60,
"retries": 5,
"retry-pause": 5,
"syslog": false,

View File

@@ -105,6 +105,14 @@ static const option options[] = {
{ "opencl-platform", 1, nullptr, IConfig::OclPlatformKey },
{ "opencl-loader", 1, nullptr, IConfig::OclLoaderKey },
{ "opencl-no-cache", 0, nullptr, IConfig::OclCacheKey },
# endif
# ifdef XMRIG_FEATURE_CUDA
{ "cuda", 0, nullptr, IConfig::CudaKey },
{ "cuda-loader", 1, nullptr, IConfig::CudaLoaderKey },
# endif
# ifdef XMRIG_FEATURE_NVML
{ "no-nvml", 0, nullptr, IConfig::NvmlKey },
{ "health-print-time", 1, nullptr, IConfig::HealthPrintTimeKey },
# endif
{ nullptr, 0, nullptr, 0 }
};

View File

@@ -103,11 +103,20 @@ static inline const std::string &usage()
u += " --opencl enable OpenCL mining backend\n";
u += " --opencl-devices=N list of OpenCL devices to use\n";
u += " --opencl-platform=N OpenCL platform index or name\n";
u += " --opencl-loader=N path to OpenCL-ICD-Loader (OpenCL.dll or libOpenCL.so)\n";
u += " --opencl-loader=PATH path to OpenCL-ICD-Loader (OpenCL.dll or libOpenCL.so)\n";
u += " --opencl-no-cache disable OpenCL cache\n";
u += " --print-platforms print available OpenCL platforms and exit\n";
# endif
# ifdef XMRIG_FEATURE_CUDA
u += "\nCUDA backend:\n";
u += " --cuda enable CUDA mining backend\n";
u += " --cuda-loader=PATH path to CUDA plugin (xmrig-cuda.dll or libxmrig-cuda.so)\n";
# endif
# ifdef XMRIG_FEATURE_NVML
u += " --no-nvml disable NVML (NVIDIA Management Library) support\n";
# endif
u += "\nLogging:\n";
# ifdef HAVE_SYSLOG_H
@@ -116,6 +125,9 @@ static inline const std::string &usage()
u += " -l, --log-file=FILE log all output to a file\n";
u += " --print-time=N print hashrate report every N seconds\n";
# ifdef XMRIG_FEATURE_NVML
u += " --health-print-time=N print health report every N seconds\n";
# endif
u += " --no-color disable colored output\n";
u += "\nMisc:\n";