Kaspa mining increase hash rate

Kaspa mining increase hash rate

pashqq

How to increase hash rate up to 20-60% ?!!

Ryzen 5950x hashrate (it can be even bigger). 1.205V 4400 MHz 72*C. Before optimization it was something like 14000 Khash/s 85*C


1. Use elichai/kaspa-miner instead of the "official" miner

https://github.com/elichai/kaspa-miner/releases


2. Set proper number of miner's threads

Set "-t" (number of threads) equal to <= your "logical processors" count (see in "Task manager" -> "Performance" or google it) for miner. You should leave free core if node or other stuff is running on the same machine. Do experiments with that number, you can also play with affinity. 

Ex, for Ryzen 3700 it may be something like "kaspa-miner.exe -t 14 --mining-address kaspa:qrug9kefug0tj62k789kv067dw8fh6e50f0vsacmuwnznxz9ratc62hxlzr46"

Ryzen 3700x (8 cores, 16 logical cores) hashrates with different thread numbers (I had node and other stuff running so tests are somewhat dirty):

24 threads - 9450 Khash/s (but unstable hashrate), 18 threads - 9450 Khash/s, 16 threads - 9500 Khash/s, 14 threads - 9100, 12 threads - 8400 Khash/s, 10 threads - 7700 Khash/s, 8 threads - 6900 Khash/s, 8 threads with affinity - 8000 Khash/s

There are reports from Intel users - close to the best thread number = physical cores count.

On my 10c20t 10900 machine, if I set it to -t 10, I get 12200 hash and 50% CPU usage. If I set it to -t 15, I get 12300 hash and 75% CPU usage

2.1. Play with multiple processes and affinity.

Looks like CPUs with chiplets (like Ryzens, Epics, etc.) can gain 5-10% boost if we run multiple processes and set affinity for each to run on separate chiplets.

You can do it with starting multiple miners and "Task Manager" - "Details" - "Set Afinity" or create BAT file like this:

start /affinity 0x000000000000FFFF "kaspaMiner1" kaspa-miner -t 16 --mining-address kaspa:qrug9kefug0tj62k789kv067dw8fh6e50f0vsacmuwnznxz9ratc62hxlzr46

start /affinity 0x00000000FFFF0000 "kaspaMiner2" kaspa-miner -t 16 --mining-address kaspa:qrug9kefug0tj62k789kv067dw8fh6e50f0vsacmuwnznxz9ratc62hxlzr46

It is example for Ryzen 5950x. Hashrate with 1 process: 24000 Khash/s

Hashrate with 2 processes with and without affinity


Affinity mask can be calculated here https://bitsum.com/tools/cpu-affinity-calculator/


3. Compiling miner for your CPU increases hashrate for 15-30%!

Optimized vs non optimized hashrates reports


3.1. Download and extract "Source code" from https://github.com/elichai/kaspa-miner/releases

3.2. Update [profile.release] section in Cargo.toml


[profile.release]

opt-level = 3

debug = false

split-debuginfo = '...' # Platform-specific.

debug-assertions = false

overflow-checks = false

lto = true

panic = 'unwind'

incremental = false

codegen-units = 1

rpath = false



3.3. Install Rust compiler: https://www.rust-lang.org/tools/install (don't forget to install  Visual Studio C++ Build tools and reboot PC)

Here is instruction for windows and Visual Studio code (but you can do it with other OS too): https://docs.microsoft.com/en-us/windows/dev-environment/rust/setup


3.4 Go to "KASPA-MINER-{version}" and run

cargo rustc --release -- -C target-cpu=native

Win CMD


(For VS Code select View > Terminal, or alternatively use the shortcut Ctrl+` (using the backtick character))


"target-cpu=native", "native" means that it will be optimized for the CURRRENT CPU.

You can set different values and build on another machine. Ex: for Zen2 cargo rustc --release -- -C target-cpu=znver2 -Z tune-cpu=znver2. List: rustc --print target-cpus

Note: I've discovered strange thing, for me, compilation in Zen2 mode gives the best hashrate for Zen3 CPUs.


You can also try:

cargo rustc --release -- -C target-cpu=native -Z tune-cpu=native

Install rust nightly in before:

rustup toolchain install nightly

rustup default nightly


Mac OS commands:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

brew install git

brew install rust

git clone https://github.com/elichai/kaspa-miner

cd kaspa-miner

Replace [profile.release]

cargo rustc --release -- -C target-cpu=native



Feel free to google it if you are stuck with compiling. 


3.4. Grab kaspa-miner.exe from \target\release


Here is kaspa-miner-0.1.3 compiled for Ryzen 3xxx (should also increase hashrate for 5xxx Ryzens)

https://drive.google.com/file/d/1OS0GfcQ5_LvA_v8bK4HlWwhCPh1LTYVK/view?usp=sharing

The same with -Z tune-cpu=native flag

https://drive.google.com/file/d/12O7J8Cod9AXEP-TY4V9tvsEd-t7T868D/view?usp=sharing


4. Optimize you CPU

Warn: playing with CPU clock speed\voltage can damage the computer and should be done with discretion

Kaspa algo likes CPU clock speed and mostly ignores RAM capacity/timings (but set at least available XMP profile for your RAM, I noticed smoother system behavior under the load).

Shitty RAM hashrate
Good RAM hashrate


Try to under volt your CPU.

If you have Ryzen CPU I recommend to use "ClockTuner for Ryzen (CTR)".

I was able to decrease temperature from 85C to 72C with the same (or even higher) hashrate by locking max voltage to 1.2 and clock speed to 4400 on Ryzen 5950x.


5. Misc

5.1. You may have to tell windows defender/antivirus the miner or program you compiled is safe.

5.2. Checking a power plan may be something else good to do (especially with a laptop).

5.6. Check the priority of the program.


If it helped, you can send some coins

to me 

kaspawallet send -t kaspa:qqslzrlfcn2e7z6mflqum70se3g53sa2yhn9td5tawufjsadl4zlsy993suje -v amount

to guy who noticed CPU native compiling originally

kaspawallet send -t kaspa:qzk0upcc2athellg3vds7tnra5t0r0mxe0gwmsmtls46wdruh68t6uny709es -v amount

to AlexG from Discord who adviced to run multiple processes to increase hashrate up to 10%

send -t kaspa:qzeym9jupqcpse2yuwduy06s07mw4q5edrtl04nzjxv8qk9kgxax5sfmtq2cf -v amount

Report Page