Sunday, May 14, 2017

Monero (XMR) mining with Ryzen 5 1600 and RX 460


Update June 2017: reached 510 H/S with a different configuration file.

As I discussed earlier, I recently bought a new machine for my home. After assembled the machine and booted up, I discovered I had to make a  BIOS update to be able to run with DDR4 in 2400 MHz. I also tried to increase the frequency to 2600, but no luck. At least I was able to decrease the latency of the memory. Anyway, after some tuning, I was able to overclock the CPU to 3700 without any voltage increase and without any serious increase in power consumption. The Ryzen comes with a nice cooler that allows basic overclocking without any need for additional cooling, although the summer is here, and maybe if few days I will have to take care it.

Anyway, saw in some forums that the people were having bad performance with XMR (Monero) mining and I decided to give a try. I was able with mild overclocking (to 3700) to achieve 450-480 H/s in contrast to their reports of 360 H/s.  You have manually to download the source and compile the files. So here is my instructions/tips to achieve better performance :

1. Use linux: I noticed better support and scheduling of processes. The performance of miners in windows was really bad!

2. Update the BIOS: This will allow you to decrease the DRAM latency and increase the DDR4 frequency. I noticed a significant increase from 380 H/s to 410 H/s.

3. Use large pages: In Linux is easy, just write sudo sysctl -w vm.nr_hugepages=256.

4. Use the proper miners: I 'm using the https://github.com/OhGodAPet/cpuminer-multi for the CPU and https://github.com/fireice-uk/xmr-stak-amd for the GPU. Note: switched to XMR-stak-ryzen (500 H/s), more information here
Update May 2018: Due to new fork use the latest xmr-stak from here: https://github.com/fireice-uk/xmr-stak

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

6. Use 8 threads: Although Ryzen 5 1600 has 6 physical cores after the BIOS update using 8 threads seems to benefit the overall performance.

7. Remove donation by editing the source files: In most open source miners you can modify the files responsible. For example, the xmr-stak you have to edit the donate-level.hpp file.

To compile efficiency you have to edit the CPU miner and make the following changes:

1. Remove preferch instruction from the cryptonight_aesni.c: Inside the function cryptonight_hash_ctx, the prefetch instruction limits the unroll. This will allow increasing the performance by a small margin.

2. Compile with gcc-6 and -march=znver1: To achieve the best performance you have to use the latest version of the compiler that supports microarchitecture optimizations.

I will cover the GPU optimization in Linux in a future post. Until then, mine...




Due to high cost of RX 4XX/5XX cards i would suggest to search also Ebay for possible cheaper solutions for RX 560. It is not worth it paying more than 160$.

Tuesday, May 2, 2017

Ryzen 5 1600 first thoughts

Spend one day to install and modify my new PC. I selected a Ryzen 5 1600 with 16 GB of RAM with an ASRock AB350 PRO4. I also installed a 850 SSD to speedup the IO. First impressions: really fast. The Linux part (Ubuntu 16.04) was mature enough, but the windows was not working out of the box. The only downside was that i had to update the BIOS of the motherboard to 2.5 to make the DDR4 to work in 2400 Mhz. The second issue was that i had to use the AMD pro drivers for my RX 460 to use the full potential of OpenCL.



Played a bit with XMR (monero) mining. Despite what people are saying for bad performance in mining, i discovered 400-430 H/s with 7 threads and huge pages.