Merged v4.5.0-beta
This commit is contained in:
commit
c208f8eb8f
79 changed files with 3704 additions and 161 deletions
|
@ -56,6 +56,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
# include "backend/cuda/CudaBackend.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
# include "crypto/rx/RxConfig.h"
|
||||
#endif
|
||||
|
@ -270,12 +275,17 @@ xmrig::Miner::Miner(Controller *controller)
|
|||
|
||||
d_ptr->timer = new Timer(this);
|
||||
|
||||
d_ptr->backends.reserve(3);
|
||||
d_ptr->backends.push_back(new CpuBackend(controller));
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
d_ptr->backends.push_back(new OclBackend(controller));
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_CUDA
|
||||
d_ptr->backends.push_back(new CudaBackend(controller));
|
||||
# endif
|
||||
|
||||
d_ptr->rebuild();
|
||||
}
|
||||
|
||||
|
@ -318,6 +328,34 @@ xmrig::Job xmrig::Miner::job() const
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Miner::execCommand(char command)
|
||||
{
|
||||
switch (command) {
|
||||
case 'h':
|
||||
case 'H':
|
||||
printHashrate(true);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
case 'P':
|
||||
setEnabled(false);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
case 'R':
|
||||
setEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto backend : d_ptr->backends) {
|
||||
backend->execCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Miner::pause()
|
||||
{
|
||||
d_ptr->active = false;
|
||||
|
@ -383,7 +421,7 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
|
|||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
if (d_ptr->algorithm.family() == Algorithm::RANDOM_X && job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) {
|
||||
if (job.algorithm().family() == Algorithm::RANDOM_X && !Rx::isReady(job)) {
|
||||
stop();
|
||||
}
|
||||
# endif
|
||||
|
@ -456,7 +494,8 @@ void xmrig::Miner::onTimer(const Timer *)
|
|||
|
||||
d_ptr->maxHashrate[d_ptr->algorithm] = std::max(d_ptr->maxHashrate[d_ptr->algorithm], maxHashrate);
|
||||
|
||||
if ((d_ptr->ticks % (d_ptr->controller->config()->printTime() * 2)) == 0) {
|
||||
auto seconds = d_ptr->controller->config()->printTime();
|
||||
if (seconds && (d_ptr->ticks % (seconds * 2)) == 0) {
|
||||
printHashrate(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
const Algorithms &algorithms() const;
|
||||
const std::vector<IBackend *> &backends() const;
|
||||
Job job() const;
|
||||
void execCommand(char command);
|
||||
void pause();
|
||||
void printHashrate(bool details);
|
||||
void setEnabled(bool enabled);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 }
|
||||
};
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue