JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
773 stars 545 forks source link

--cpu-affinity option being ignored #117

Closed monkeyguy closed 6 years ago

monkeyguy commented 6 years ago

I'm running cpuminer-avx2-sha.exe on Widnows 10, in both 3.8.3.3 and 3.8.4, the text "Binding process to cpu mask a0fcb0" appears at start regardless of whether I've input a different --cpu-affinity argument and the threads' hash rates seem to reflect any affinity argument I input being ignored. Is there a better way to configure the cpu-mask?

JayDDee commented 6 years ago

Due to the lack of info provided my best advice is don't use affinity.

PapaChealio commented 6 years ago

My .02c: Assuming you are using a single-processor system, my advice is to map the threads and affinity settings to the number of physical cores on the CPU (NOT logical processors).

--threads = <# of cores> --cpu-affinity = 0x5 (with an extra "5" added for every additional 2 cores in the system)

e.g. For a CPU with a 6-core CPU, use:

--threads=6 --cpu-affinity=0x555

This will ensure that all the threads are mapped to physical cores, which will generally give better overall performance. It will also leave the other hyper-threaded cores for use by the system, so you don't max out the CPU on the machine. If you've disabled hyper-threading (or using CPUs that don't support it), you don't need to use the affinity setting.

JayDDee commented 6 years ago

No further data provided.

ghost commented 6 years ago

This is from my understanding of cpu-affininty usage and hope to provide you with more information with an live example i'm running in right now.

I'm running an 8 core cpu, core 0-3 runs at 1.5ghz and core 4-7 runs at 2ghz, If i run the miner with the -t 7 to run 7 cores and keep one for everything else the miner will grab cpu 0-6 leaving an 2ghz core idle.

To disable the 1st core instead i would use --cpu-afffinity 0xFE that represent 1111 1110 where the 1's are the cpu enabled and the 0 the cpu disabled (From right to left). ei an 2 core cpu would use 11 to enable both, 10 to enable the 2nd and 1 to enable the first

In my particular case, if i start the miner with -t 7 --cpu-affinity 0xFE -D i still get

Thread 0 priority 0 (nice 18) [2018-04-30 01:17:03] Binding thread 0 to cpu 0 (mask 1) [2018-04-30 01:17:03] Thread 1 priority 0 (nice 18) [2018-04-30 01:17:03] Binding thread 1 to cpu 1 (mask 2) [2018-04-30 01:17:03] Thread 2 priority 0 (nice 18) [2018-04-30 01:17:03] Binding thread 2 to cpu 2 (mask 4) [2018-04-30 01:17:03] Thread 3 priority 0 (nice 18) [2018-04-30 01:17:03] Binding thread 3 to cpu 3 (mask 8) [2018-04-30 01:17:03] Thread 4 priority 0 (nice 18) [2018-04-30 01:17:03] Binding thread 4 to cpu 4 (mask 10) [2018-04-30 01:17:03] Thread 5 priority 0 (nice 18) [2018-04-30 01:17:03] Binding thread 5 to cpu 5 (mask 20) [2018-04-30 01:17:03] 7 miner threads started, using 'lyra2rev2' algorithm. [2018-04-30 01:17:03] Thread 6 priority 0 (nice 18) [2018-04-30 01:17:03] Binding thread 6 to cpu 6 (mask 40)

Not quite sure of my understanding of cpu masking so maybe it'S just me. Hope this helps, ty for your time

FreeTime42 commented 7 months ago

It use Json in opsion "niceHash"


"miner_command": [ [ "--cpu-priority", "0" ], [ "--cpu-affinity", "0x00000000005FFFFF" ], [ "--cpu-max-threads-hint", "92" ] ],