MoneroOcean / xmrig

Monero (rx/0, rx/wow, rx/loki, defyx, rx/arq, rx/sfx, rx/keva, cn/0, cn/1, cn/2, cn/r, cn/fast, cn/half, cn/xao, cn/rto, cn/rwz, cn/zls, cn/double, cn/gpu, cn-lite/0, cn-lite/1, cn-heavy/0, cn-heavy/tube, cn-heavy/xhv, cn-pico, cn-pico/tlo, argon2/chukwa, argon2/wrkz, astrobwt) CPU/GPU miner
https://moneroocean.stream
GNU General Public License v3.0
274 stars 84 forks source link

Algo-perf is wrongly calculated #25

Closed jfikar closed 4 years ago

jfikar commented 4 years ago

Describe the bug The initial benchmark of the algorithms algo-perf is wrongly calculated, especially on slow devices.

To Reproduce Run initial benchmark with the default bench-algo-time 10s and look for example at rx/0 hashrate. I'm getting only 21H/s instead of 220H/s. It is on 4 cores ARMv8 with Linux. If I press H during the rx/0 benchmark, I'll get the correct 220H/s from xmrig.

[2020-06-10 14:10:42.831] speed 10s/60s/15m 225.1 225.3 n/a H/s max 226.1 H/s

Increasing bench-algo-time increases slowly the measured hashrate, but it does not reach the correct value of 220.

bench-allgo-time (s) rx/0 (H/s)
10 21.758
20 81.867
40 132.082
80 164.095
160 183.984
320 200.829

It looks like the hashrate is wrongly calculated in your src/core/Benchmark.cpp and includes the dataset initialization time, which is in my case 26s. For faster computers it is less, so the error is smaller. But it should be corrected anyway. Otherwise the algorithms with longer dataset initialization are underestimated.

[2020-06-10 14:04:28.112]  rx   init dataset algo rx/0 (6 threads) seed 0000000000000000...
[2020-06-10 14:04:28.112]  rx   allocated 2336 MB (2080+256) huge pages 0% 0/1168 +JIT (0 ms)
[2020-06-10 14:04:54.110]  rx   dataset ready (25998 ms)

Expected behavior The dataset initialization time should not be included, otherwise the algo benchmark is not correct and then algo-switching is not working as intended.

If I try to correct the hashrates by multiplying them by (bench-allgo-time + initialization)/bench-allgo-time, I'm getting better results:

bench-allgo-time s rx/0 H/s corrected H/s
10 21.758 78.324
20 81.867 188.286
40 132.082 217.929
80 164.095 217.421
160 183.984 213.879
320 200.829 217.145

Required data

  ABOUT        XMRig/5.11.2-mo2 gcc/8.3.0
  LIBS         libuv/1.38.0 OpenSSL/1.1.1g hwloc/2.2.0
  HUGE PAGES   disabled
  1GB PAGES    unavailable
  CPU          ARMv8 (2) x64 AES
                L2:0.0 MB L3:0.0 MB 6C/6T NUMA:1
  MEMORY       0.3/3.6 GB (8%)
  DONATE       1%
  POOL #1      stratum+tcp://gulf.moneroocean.stream:10008 algo auto
  COMMANDS     hashrate, pause, resume
  OPENCL       disabled
[2020-06-10 14:25:54.060] >>>>> STARTING ALGO PERFORMANCE CALIBRATION (with 10 seconds round)
[2020-06-10 14:25:54.060]  cpu  use argon2 implementation default
[2020-06-10 14:25:54.060]  cpu  use profile  argon2  (8 threads) scratchpad 512 KB
[2020-06-10 14:25:54.214]  cpu  READY threads 8/8 (8) huge pages 0% 0/8 memory 4096 KB (154 ms)
[2020-06-10 14:25:54.309]  ===> Starting benchmark of argon2/chukwa algo
[2020-06-10 14:26:04.310]  ===> argon2/chukwa hasrate: 1259.174072
[2020-06-10 14:26:04.314]  cpu  stopped (4 ms)
[2020-06-10 14:26:04.314]  rx   init dataset algo rx/0 (6 threads) seed 0000000000000000...
[2020-06-10 14:26:04.315]  rx   allocated 2336 MB (2080+256) huge pages 0% 0/1168 +JIT (1 ms)
[2020-06-10 14:26:30.524]  rx   dataset ready (26208 ms)
[2020-06-10 14:26:30.537]  cpu  use profile  rx  (4 threads) scratchpad 2048 KB
[2020-06-10 14:26:30.903]  cpu  READY threads 4/4 (4) huge pages 0% 0/4 memory 8192 KB (365 ms)
[2020-06-10 14:26:31.031]  ===> Starting benchmark of rx/0 algo
[2020-06-10 14:26:41.049]  ===> rx/0 hasrate: 23.058495
[2020-06-10 14:26:41.150]  cpu  stopped (96 ms)
Spudz76 commented 4 years ago

This has already been fixed (use a newer version)

jfikar commented 4 years ago

I can confirm it has been fixed in 6.3.1-mo2. Good job!