JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
765 stars 543 forks source link

Benchmark mode dies with scrypt algo and some binaries (with random wrong affinity) #369

Closed mann1x closed 2 years ago

mann1x commented 2 years ago

Using this command line:

cpuminer-sse2.exe --no-color --benchmark --time-limit=15 --threads=1 --cpu-affinity 64 --debug --no-redirect --no-extranonce --no-stratum --no-gbt --no-getwork --no-longpoll --stratum-keepalive --algo=scrypt:512

Works fine for sse2, aes-sse42, avx.

For avx2 dies at:

[2022-03-26 11:31:13] Threads restarted for new work.

Same for avx2-sha-vaes binary. Same for avx2-sha and on top of that the affinity instead of CPU thread 7 ends up running randomly on on CPU threads 15 and 16.

Cannot test AVX512 binaries.

JayDDee commented 2 years ago

I have reproduced it. The important factors seem to be benchmark, time-limit, threads=1 and an algo that supports AVX2. The build did not seem to have an effect, just the algo. AVX2 build works with algos that don't support AVX2.

The process seems to keep running but there is no output and no exit after the time limit expired.

I should note there should not be any thread restart signals during benchmark. I did not test with time-limit mining one thread in a stratum pool.

I will investigate.

mann1x commented 2 years ago

Thanks, I can reproduce it only with some algo, didn't took a note about the algo features. There's always a thread restart and indeed I was a bit puzzled. When it's restarting the threads the CPU load goes down a bit. I'm developing a benchmark tool so it'd be really nice to use always the same algo with the different binaries. Most of them don't load fully the cores, scrypt it's the most reliable.

JayDDee commented 2 years ago

I've got a fix but I still don't understand why the process hung. The time limit code was a mess so I rewrote it and it works. I also fixed the spurrious thread restart during benchmark.

I'm working on another fix before a new release.

mann1x commented 2 years ago

Awesome, thanks a lot! I'll let you know my findings with the new release.

mann1x commented 2 years ago

Let me know when you release the new version, in the meantime I've released the first Alpha of my bench tool:

https://github.com/mann1x/BenchMaestro

JayDDee commented 2 years ago

cpuminer-opt-3.19.7 is released with a fix for --time-limit. Please retest.

mann1x commented 2 years ago

seems to work perfectly!