Calibrate and save algo-perf and threads automatically
This commit is contained in:
parent
98f95584a0
commit
30a4f53c8f
5 changed files with 13 additions and 11 deletions
|
@ -130,7 +130,7 @@ int App::exec()
|
||||||
Workers::start(m_controller);
|
Workers::start(m_controller);
|
||||||
|
|
||||||
// run benchmark before pool mining or not?
|
// run benchmark before pool mining or not?
|
||||||
if (m_controller->config()->isCalibrateAlgo()) {
|
if (m_controller->config()->get_algo_perf(xmrig::PA_CN) == 0.0f || m_controller->config()->isCalibrateAlgo()) {
|
||||||
benchmark.set_controller(m_controller); // we need controller there to access config and network objects
|
benchmark.set_controller(m_controller); // we need controller there to access config and network objects
|
||||||
Workers::setListener(&benchmark); // register benchmark as job reault listener to compute hashrates there
|
Workers::setListener(&benchmark); // register benchmark as job reault listener to compute hashrates there
|
||||||
// write text before first benchmark round
|
// write text before first benchmark round
|
||||||
|
@ -141,7 +141,7 @@ int App::exec()
|
||||||
benchmark.start_perf_bench(xmrig::PerfAlgo::PA_CN); // start benchmarking from first PerfAlgo in the list
|
benchmark.start_perf_bench(xmrig::PerfAlgo::PA_CN); // start benchmarking from first PerfAlgo in the list
|
||||||
} else {
|
} else {
|
||||||
// save config here to have option to store automatically generated "threads"
|
// save config here to have option to store automatically generated "threads"
|
||||||
if (m_controller->config()->isSaveConfig()) m_controller->config()->save();
|
if (m_controller->config()->isShouldSave() || m_controller->config()->isSaveConfig()) m_controller->config()->save();
|
||||||
m_controller->network()->connect();
|
m_controller->network()->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,7 @@
|
||||||
"retry-pause": 5,
|
"retry-pause": 5,
|
||||||
"safe": false,
|
"safe": false,
|
||||||
"threads": null,
|
"threads": null,
|
||||||
"algo-perf": {
|
"algo-perf": null,
|
||||||
"cn": 1000.0,
|
|
||||||
"cn-fast": 2000.0,
|
|
||||||
"cn-lite": 2000.0,
|
|
||||||
"cn-heavy": 700.0
|
|
||||||
},
|
|
||||||
"user-agent": null,
|
"user-agent": null,
|
||||||
"watch": false
|
"watch": false
|
||||||
}
|
}
|
|
@ -46,6 +46,7 @@ static char affinity_tmp[20] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
xmrig::Config::Config() : xmrig::CommonConfig(),
|
xmrig::Config::Config() : xmrig::CommonConfig(),
|
||||||
|
m_shouldSave(false),
|
||||||
m_aesMode(AES_AUTO),
|
m_aesMode(AES_AUTO),
|
||||||
m_algoVariant(AV_AUTO),
|
m_algoVariant(AV_AUTO),
|
||||||
m_hugePages(true),
|
m_hugePages(true),
|
||||||
|
@ -56,7 +57,7 @@ xmrig::Config::Config() : xmrig::CommonConfig(),
|
||||||
// not defined algo performance is considered to be 0
|
// not defined algo performance is considered to be 0
|
||||||
for (int a = 0; a != xmrig::PerfAlgo::PA_MAX; ++ a) {
|
for (int a = 0; a != xmrig::PerfAlgo::PA_MAX; ++ a) {
|
||||||
const xmrig::PerfAlgo pa = static_cast<xmrig::PerfAlgo>(a);
|
const xmrig::PerfAlgo pa = static_cast<xmrig::PerfAlgo>(a);
|
||||||
m_algo_perf[pa] = 0;
|
m_algo_perf[pa] = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ bool xmrig::Config::finalize()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse "threads" into m_threads
|
// auto configure m_threads
|
||||||
for (int a = 0; a != xmrig::PerfAlgo::PA_MAX; ++ a) {
|
for (int a = 0; a != xmrig::PerfAlgo::PA_MAX; ++ a) {
|
||||||
const xmrig::PerfAlgo pa = static_cast<xmrig::PerfAlgo>(a);
|
const xmrig::PerfAlgo pa = static_cast<xmrig::PerfAlgo>(a);
|
||||||
if (!m_threads[pa].cpu.empty()) {
|
if (!m_threads[pa].cpu.empty()) {
|
||||||
|
@ -205,6 +206,8 @@ bool xmrig::Config::finalize()
|
||||||
for (size_t i = 0; i < m_threads[pa].count; ++i) {
|
for (size_t i = 0; i < m_threads[pa].count; ++i) {
|
||||||
m_threads[pa].list.push_back(CpuThread::createFromAV(i, xmrig::Algorithm(pa).algo(), av, m_threads[pa].mask, m_priority));
|
m_threads[pa].list.push_back(CpuThread::createFromAV(i, xmrig::Algorithm(pa).algo(), av, m_threads[pa].mask, m_priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_shouldSave = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +349,8 @@ void xmrig::Config::parseJSON(const rapidjson::Document &doc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_algo_perf[xmrig::PA_CN] == 0.0f) m_shouldSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ public:
|
||||||
|
|
||||||
void getJSON(rapidjson::Document &doc) const override;
|
void getJSON(rapidjson::Document &doc) const override;
|
||||||
|
|
||||||
|
inline bool isShouldSave() const { return m_shouldSave; }
|
||||||
inline AesMode aesMode() const { return m_aesMode; }
|
inline AesMode aesMode() const { return m_aesMode; }
|
||||||
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
||||||
inline bool isHugePages() const { return m_hugePages; }
|
inline bool isHugePages() const { return m_hugePages; }
|
||||||
|
@ -131,6 +132,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool m_shouldSave;
|
||||||
AesMode m_aesMode;
|
AesMode m_aesMode;
|
||||||
AlgoVariant m_algoVariant;
|
AlgoVariant m_algoVariant;
|
||||||
bool m_hugePages;
|
bool m_hugePages;
|
||||||
|
|
|
@ -80,7 +80,7 @@ void Benchmark::onJobResult(const JobResult& result) {
|
||||||
start_perf_bench(next_pa);
|
start_perf_bench(next_pa);
|
||||||
} else { // end of benchmarks and switching to jobs from the pool (network)
|
} else { // end of benchmarks and switching to jobs from the pool (network)
|
||||||
m_pa = xmrig::PA_INVALID;
|
m_pa = xmrig::PA_INVALID;
|
||||||
m_controller->config()->save(); // save config with measured algo-perf
|
if (m_controller->config()->isShouldSave() || m_controller->config()->isSaveConfig()) m_controller->config()->save(); // save config with measured algo-perf
|
||||||
Workers::pause(); // do not compute anything before job from the pool
|
Workers::pause(); // do not compute anything before job from the pool
|
||||||
m_controller->network()->connect();
|
m_controller->network()->connect();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue