Fedora 27 with AMD GPU and xmr-stak

This post describes Fedora 27 AMD driver installation and xmr-stak compile steps. In scenario without GUI, “worker” will be launched in runlevel3 and therefore only OpenCL is needed to install from AMD driver package.

If you are on this page, you already know what is Monero and xmr-stak. xmr-stak is a universal Stratum pool miner ready for the POW change of Monero-v7, Aeon-v7 and Sumukoin-v3. After short introduction, let’s move onto technical details of how to prepare Fedora 27 to become mining worker. Before everything else, check kernel version on your Linux system. Newer kernels have changed too much and 17.50 AMD driver cannot successfully compile its modules yet. For Fedora 27 use 4.13.9 kernel version.

1) Install kernel-devel package

> dnf install kernel-devel

Kernel development package is needed to compile kernel modules and it should be 4.13.9 version – the same version as is running kernel.

2) Download AMD Linux driver version 17.50

Linux Driver Version 17.50 for RHEL 7.4 / CentOS 7.4

3) Unpack tar archive

> tar -Jxvf amdgpu-pro-17.50-511655.tar.xz

4) Install amdgpu driver

> cd amdgpu-pro-17.50-511655
> ./amdgpu-install --compute

Driver installation is with “compute” option. It’s sufficient for headless installation because only OpenCL support is needed. Anyway, at this step AMD driver should be installed and Linux computer can be rebooted. After reboot, you can test if drivers are loaded correctly. Type command “lsmod | grep amdgpu” to see amdgpu in kernel module chain list.

> lsmod | grep amdgpu

amdgpu               3047424  1
amdttm                102400  1 amdgpu
amdkcl                 24576  3 amdttm,amdgpu,amdkfd
i2c_algo_bit           16384  1 amdgpu
drm_kms_helper        159744  1 amdgpu
drm                   352256  5 amdttm,amdgpu,amdkcl,drm_kms_helper

In case where amd-pro driver should be uninstalled, just create symbolic link “amdgpu-pro-uninstall” and run it.

> ln -s amdgpu-install amdgpu-pro-uninstall
> ./amdgpu-pro-uninstall


Next part is compiling xmr-stak miner with AMD support

1) Download AMD APP SDK

Download SDK installer AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2

2) Unpack SDK installer tar.bz2 package

> tar jxf AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2

3) Run extracted SDK

> ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh

By default, SDK will be installed in /opt/AMDAPPSDK-3.0 directory.

4) Set AMDAPPSDKROOT environment variable


After AMD APP SDK is installed, set AMDAPPSDKROOT environment variable for “cmake” to find SDK when xmr-stak will be compiled.

5) Install needed tools to compile xmr-stak

> dnf install gcc gcc-c++ hwloc-devel libmicrohttpd-devel libstdc++-static make openssl-devel cmake

6) Get xmr-stak from Git repository

> git clone https://github.com/fireice-uk/xmr-stak.git

7) Create build directory inside cloned xmr-stak source code

> cd xmr-stak
> mkdir build
> cd build

8) Run cmake

> cmake .. -DCUDA_ENABLE=OFF -DOpenCL_LIBRARY=/opt/amdgpu-pro/lib64/libOpenCL.so

CUDA is for Nvidia and is disabled with “-DCUDA_ENABLE=OFF”. I had a problem finding OpenCL library in Fedora 27 even though it was installed. -DOpenCL_LIBRARY option helped cmake to finish configuration.

9) Run make and make install

> make
> make install

10) Start xmr-stak

> bin/xmr-stak

Finally, set large page support to get better results with “sysctl -w vm.nr_hugepages=128” command. For permanent settings add “vm.nr_hugepages=128” to the /etc/sysctl.conf file:



Happy mining :)

Leave a Comment