Saturday, June 17, 2017

Monero (XMR) mining with Ryzen 5 1600 Optimizations - How to reach 510 H/s

Recently I created a post describing the best configuration for mining XMR. After some experimentation, I transformed the famous version of the XMR-stak-cpu miner to improve slightly the performance.

The source code is available here: https://github.com/malvanos/xmr-stak-ryzen

Update May 2018: Due to new fork use the latest xmr-stak from here: https://github.com/fireice-uk/xmr-stak

After you clone the source code, you only have to write make to compile. I removed all the donation of the developers and improved 2-3% the performance in Ryzen 5 1600. To achieve the best performance with Ryzen 1600:

1. Use mild CPU overclocking: Ovecklocking from 3200 to 3700 adds only 8W in Monero mining, but gives you +50 H/s.

2. Use 8 threads: Here is the configuration for the best performance:

    "cpu_threads_conf" : 
    [ 
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 0 },
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 2 },
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 4 },
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 6 },
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 8 },
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 10 },
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 12 },
{ "low_power_mode" : false, "no_prefetch" : false, "affine_to_cpu" : 14 },

    ],

I have already modified the file in the repository. Note that the threads with affinity 12 and 14 actually jump all over the place, but the final out come is quite nice.

3. Use huge pages: I include the huge.sh script. You have to run as root. The command to allocate large pages is sudo sysctl -w vm.nr_hugepages=256

4. Run as root to enable the memory locking.

Some minor optimizations are underway, I will try to schedule them in the future. Here is the result:

Ryzen 1600 XMR Mining
Ryzen 1600 OC 3.7GHz - 510 H/s XMR