#1385 "max-threads-hint" option now also limit RandomX dataset initialization threads.
This commit is contained in:
parent
3a75f39935
commit
e9e747f0d1
8 changed files with 21 additions and 14 deletions
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "crypto/rx/Rx.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/cpu/CpuConfig.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "crypto/rx/RxConfig.h"
|
||||
#include "crypto/rx/RxQueue.h"
|
||||
|
@ -60,7 +61,7 @@ const char *xmrig::rx_tag()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Rx::init(const Job &job, const RxConfig &config, bool hugePages, bool oneGbPages, int priority)
|
||||
bool xmrig::Rx::init(const Job &job, const RxConfig &config, const CpuConfig &cpu)
|
||||
{
|
||||
if (job.algorithm().family() != Algorithm::RANDOM_X) {
|
||||
return true;
|
||||
|
@ -70,7 +71,7 @@ bool xmrig::Rx::init(const Job &job, const RxConfig &config, bool hugePages, boo
|
|||
return true;
|
||||
}
|
||||
|
||||
d_ptr->queue.enqueue(job, config.nodeset(), config.threads(), hugePages, oneGbPages, config.mode(), priority);
|
||||
d_ptr->queue.enqueue(job, config.nodeset(), config.threads(cpu.limit()), cpu.isHugePages(), cpu.isOneGbPages(), config.mode(), cpu.priority());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace xmrig
|
|||
|
||||
|
||||
class Algorithm;
|
||||
class CpuConfig;
|
||||
class IRxListener;
|
||||
class Job;
|
||||
class RxConfig;
|
||||
|
@ -46,7 +47,7 @@ class RxDataset;
|
|||
class Rx
|
||||
{
|
||||
public:
|
||||
static bool init(const Job &job, const RxConfig &config, bool hugePages, bool oneGbPages, int priority);
|
||||
static bool init(const Job &job, const RxConfig &config, const CpuConfig &cpu);
|
||||
static bool isReady(const Job &job);
|
||||
static RxDataset *dataset(const Job &job, uint32_t nodeId);
|
||||
static std::pair<uint32_t, uint32_t> hugePages();
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -52,9 +53,17 @@ const char *xmrig::RxConfig::modeName() const
|
|||
}
|
||||
|
||||
|
||||
uint32_t xmrig::RxConfig::threads() const
|
||||
uint32_t xmrig::RxConfig::threads(uint32_t limit) const
|
||||
{
|
||||
return m_threads < 1 ? static_cast<uint32_t>(Cpu::info()->threads()) : static_cast<uint32_t>(m_threads);
|
||||
if (m_threads > 0) {
|
||||
return m_threads;
|
||||
}
|
||||
|
||||
if (limit < 100) {
|
||||
return std::max(static_cast<uint32_t>(round(Cpu::info()->threads() * (limit / 100.0))), 1U);
|
||||
}
|
||||
|
||||
return Cpu::info()->threads();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
# endif
|
||||
|
||||
const char *modeName() const;
|
||||
uint32_t threads() const;
|
||||
uint32_t threads(uint32_t limit = 100) const;
|
||||
|
||||
inline Mode mode() const { return m_mode; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue