MoBenchmark: use ifdefs to avoid bugs when algos are compiled out
This commit is contained in:
parent
adb372408a
commit
8c88ada9ea
2 changed files with 32 additions and 1 deletions
|
@ -118,10 +118,16 @@ double MoBenchmark::get_algo_perf(Algorithm::Id algo) const {
|
||||||
case Algorithm::CN_RWZ: return algo_perf[Algorithm::CN_R] / 3 * 4;
|
case Algorithm::CN_RWZ: return algo_perf[Algorithm::CN_R] / 3 * 4;
|
||||||
case Algorithm::CN_ZLS: return algo_perf[Algorithm::CN_R] / 3 * 4;
|
case Algorithm::CN_ZLS: return algo_perf[Algorithm::CN_R] / 3 * 4;
|
||||||
case Algorithm::CN_DOUBLE: return algo_perf[Algorithm::CN_R] / 2;
|
case Algorithm::CN_DOUBLE: return algo_perf[Algorithm::CN_R] / 2;
|
||||||
|
# ifdef XMRIG_ALGO_CN_LITE
|
||||||
case Algorithm::CN_LITE_0: return algo_perf[Algorithm::CN_LITE_1];
|
case Algorithm::CN_LITE_0: return algo_perf[Algorithm::CN_LITE_1];
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_ALGO_CN_PICO
|
||||||
case Algorithm::CN_PICO_TLO: return algo_perf[Algorithm::CN_PICO_0];
|
case Algorithm::CN_PICO_TLO: return algo_perf[Algorithm::CN_PICO_0];
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
case Algorithm::RX_SFX: return algo_perf[Algorithm::RX_0];
|
case Algorithm::RX_SFX: return algo_perf[Algorithm::RX_0];
|
||||||
case Algorithm::RX_XEQ: return algo_perf[Algorithm::RX_ARQ];
|
case Algorithm::RX_XEQ: return algo_perf[Algorithm::RX_ARQ];
|
||||||
|
# endif
|
||||||
default: return algo_perf[algo];
|
default: return algo_perf[algo];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,17 +153,21 @@ void MoBenchmark::start() {
|
||||||
m_bench_job = Job(false, Algorithm(bench_algos[m_bench_algo]), "benchmark");
|
m_bench_job = Job(false, Algorithm(bench_algos[m_bench_algo]), "benchmark");
|
||||||
m_bench_job.setId(algo.name()); // need to set different id so that workers will see job change
|
m_bench_job.setId(algo.name()); // need to set different id so that workers will see job change
|
||||||
switch (algo.id()) {
|
switch (algo.id()) {
|
||||||
|
# ifdef XMRIG_ALGO_KAWPOW
|
||||||
case Algorithm::KAWPOW_RVN:
|
case Algorithm::KAWPOW_RVN:
|
||||||
m_bench_job.setBlob("4c38e8a5f7b2944d1e4274635d828519b97bc64a1f1c7896ecdbb139989aa0e80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
m_bench_job.setBlob("4c38e8a5f7b2944d1e4274635d828519b97bc64a1f1c7896ecdbb139989aa0e80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
||||||
m_bench_job.setDiff(Job::toDiff(strtoull("000000639c000000", nullptr, 16)));
|
m_bench_job.setDiff(Job::toDiff(strtoull("000000639c000000", nullptr, 16)));
|
||||||
m_bench_job.setHeight(1500000);
|
m_bench_job.setHeight(1500000);
|
||||||
break;
|
break;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
case Algorithm::GHOSTRIDER_RTM:
|
case Algorithm::GHOSTRIDER_RTM:
|
||||||
case Algorithm::FLEX_KCN:
|
case Algorithm::FLEX_KCN:
|
||||||
m_bench_job.setBlob("000000208c246d0b90c3b389c4086e8b672ee040d64db5b9648527133e217fbfa48da64c0f3c0a0b0e8350800568b40fbb323ac3ccdf2965de51b9aaeb939b4f11ff81c49b74a16156ff251c00000000");
|
m_bench_job.setBlob("000000208c246d0b90c3b389c4086e8b672ee040d64db5b9648527133e217fbfa48da64c0f3c0a0b0e8350800568b40fbb323ac3ccdf2965de51b9aaeb939b4f11ff81c49b74a16156ff251c00000000");
|
||||||
m_bench_job.setDiff(1000);
|
m_bench_job.setDiff(1000);
|
||||||
break;
|
break;
|
||||||
|
# endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// 99 here to trigger all future bench_algo versions for auto veriant detection based on block version
|
// 99 here to trigger all future bench_algo versions for auto veriant detection based on block version
|
||||||
|
@ -215,11 +225,15 @@ void MoBenchmark::onJobResult(const JobResult& result) {
|
||||||
if (!(hashrate = t[1]))
|
if (!(hashrate = t[1]))
|
||||||
if (!(hashrate = t[0]))
|
if (!(hashrate = t[0]))
|
||||||
hashrate = static_cast<double>(m_hash_count) * result.diff / (now - m_bench_start) * 1000.0f;
|
hashrate = static_cast<double>(m_hash_count) * result.diff / (now - m_bench_start) * 1000.0f;
|
||||||
|
# ifdef XMRIG_ALGO_KAWPOW
|
||||||
if (algo.id() == Algorithm::KAWPOW_RVN) hashrate /= ((double)0xFFFFFFFFFFFFFFFF) / 0xFF000000;
|
if (algo.id() == Algorithm::KAWPOW_RVN) hashrate /= ((double)0xFFFFFFFFFFFFFFFF) / 0xFF000000;
|
||||||
|
# endif
|
||||||
algo_perf[algo.id()] = hashrate; // store hashrate result
|
algo_perf[algo.id()] = hashrate; // store hashrate result
|
||||||
LOG_INFO("%s " BRIGHT_BLACK_BG(WHITE_BOLD_S " Algo " MAGENTA_BOLD_S "%s" WHITE_BOLD_S " hashrate: " CYAN_BOLD_S "%f "), Tags::benchmark(), algo.name(), hashrate);
|
LOG_INFO("%s " BRIGHT_BLACK_BG(WHITE_BOLD_S " Algo " MAGENTA_BOLD_S "%s" WHITE_BOLD_S " hashrate: " CYAN_BOLD_S "%f "), Tags::benchmark(), algo.name(), hashrate);
|
||||||
run_next_bench_algo();
|
run_next_bench_algo();
|
||||||
} else switch (algo.id()) { // Update GhostRider algo job to produce more accurate perf results
|
}
|
||||||
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
|
else switch (algo.id()) { // Update GhostRider algo job to produce more accurate perf results
|
||||||
case Algorithm::GHOSTRIDER_RTM: {
|
case Algorithm::GHOSTRIDER_RTM: {
|
||||||
uint8_t* blob = m_bench_job.blob();
|
uint8_t* blob = m_bench_job.blob();
|
||||||
++ *reinterpret_cast<uint32_t*>(blob+4);
|
++ *reinterpret_cast<uint32_t*>(blob+4);
|
||||||
|
@ -228,6 +242,7 @@ void MoBenchmark::onJobResult(const JobResult& result) {
|
||||||
}
|
}
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t MoBenchmark::get_now() const { // get current time in ms
|
uint64_t MoBenchmark::get_now() const { // get current time in ms
|
||||||
|
|
|
@ -35,20 +35,36 @@ class Job;
|
||||||
class MoBenchmark : public IJobResultListener {
|
class MoBenchmark : public IJobResultListener {
|
||||||
|
|
||||||
const Algorithm::Id bench_algos[15] = {
|
const Algorithm::Id bench_algos[15] = {
|
||||||
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
Algorithm::FLEX_KCN,
|
Algorithm::FLEX_KCN,
|
||||||
Algorithm::GHOSTRIDER_RTM,
|
Algorithm::GHOSTRIDER_RTM,
|
||||||
|
# endif
|
||||||
Algorithm::CN_R,
|
Algorithm::CN_R,
|
||||||
|
# ifdef XMRIG_ALGO_CN_LITE
|
||||||
Algorithm::CN_LITE_1,
|
Algorithm::CN_LITE_1,
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_ALGO_CN_HEAVY
|
||||||
Algorithm::CN_HEAVY_XHV,
|
Algorithm::CN_HEAVY_XHV,
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_ALGO_CN_PICO
|
||||||
Algorithm::CN_PICO_0,
|
Algorithm::CN_PICO_0,
|
||||||
|
# endif
|
||||||
Algorithm::CN_CCX,
|
Algorithm::CN_CCX,
|
||||||
|
# ifdef XMRIG_ALGO_CN_GPU
|
||||||
Algorithm::CN_GPU,
|
Algorithm::CN_GPU,
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_ALGO_ARGON2
|
||||||
Algorithm::AR2_CHUKWA_V2,
|
Algorithm::AR2_CHUKWA_V2,
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_ALGO_KAWPOW
|
||||||
Algorithm::KAWPOW_RVN,
|
Algorithm::KAWPOW_RVN,
|
||||||
|
# endif
|
||||||
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
Algorithm::RX_0,
|
Algorithm::RX_0,
|
||||||
Algorithm::RX_GRAFT,
|
Algorithm::RX_GRAFT,
|
||||||
Algorithm::RX_ARQ,
|
Algorithm::RX_ARQ,
|
||||||
Algorithm::RX_XLA,
|
Algorithm::RX_XLA,
|
||||||
|
# endif
|
||||||
Algorithm::INVALID
|
Algorithm::INVALID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue