I finally figured out how to get OpenCL working on my RX 580 for Folding@Home and I wanted to document the process.
My goals were to get a working OpenCL situation but still use the open source video drivers. So some of this is retrospective and from memory so hopefully I remember everything.
First you need to install the AMDGPU drivers for OpenCL. The best candidate right now are the ones for RHEL/CentOS 8.1:
At the time of writing this the driver link is:
Download the archive and expand it into /var/local:
cd /var/local tar xf /path/to/amdgpu-pro-19.50-967956-rhel-8.1.tar.xz mv amdgpu-pro-19.50-967956-rhel-8.1 amdgpu
Now you can download the repo file I made for it:
cd /etc/yum.repo.d/ curl -LO https://hobbes1069.fedorapeople.org/amdgpu/amdgpu.repo
If everything is correct you should see AMDGPU in your repolist:
Now you don’t need many of the packages to just get OpenCL support, here’s what I have installed:
# rpm -qa | grep amdgpu libdrm-amdgpu-2.4.99-967956.el8.x86_64 libdrm-amdgpu-common-1.0.0-967956.el8.noarch clinfo-amdgpu-pro-19.50-967956.el8.x86_64 opencl-amdgpu-pro-comgr-19.50-967956.el8.x86_64 amdgpu-pro-core-19.50-967956.el8.noarch opencl-orca-amdgpu-pro-icd-19.50-967956.el8.x86_64 libopencl-amdgpu-pro-19.50-967956.el8.x86_64
Since my card is the the previous generation I have “opencl-orca-amdgpu-pro-icd” installed, if you have the latest cards you want opencl-amdgpu-pro-icd.
NOTE: it may want to pull in dkms and dkms-firmware and build the module. It should fail as it hasn’t been updated for 5.x.x kernels and you can dnf erase the dkms packages afterwards.
No here’s where it gets stupid. Every library that supports an OpenCL pathway will install a file into /etc/OpenCL/vendors. Most programs are too stupid to try all of them and see which one works so when the first one fails, it just gives up, as is the case with Folding@Home.
So here’s what you need to do, go into /etc/OpenCL/vendors and rename the files you don’t want to use. Here’s what mine looks like now:
# ll /etc/OpenCL/vendors/ -rw-r--r--. 1 root root 20 Dec 17 23:11 amdocl-orca64.icd -rw-r--r--. 1 root root 29 Jul 21 2018 intel-beignet.icd_backup -rw-r--r--. 1 root root 19 Dec 18 15:58 mesa.icd_backup -rw-r--r--. 1 root root 16 Sep 26 2019 pocl.icd_backup
So now the amdocl-ora64 is the only “supplier” of OpenCL on my system. At this point running clinfo should work and only show one platform:
# clinfo -l Platform #0: AMD Accelerated Parallel Processing `-- Device #0: Ellesmere
Now we’re ready to install Folding@Home (but we’re not done yet!)
Go here and download/install all three packages of the latest version for RHEL/CentOS/Fedora (hint: it’s really for EL and we have to fix that):
After installing all 3 packages there’s a few things we need to do before starting FAHControl.
It’s not compatible with Python3 which is the default on Fedora 31 and up.
and change the first line from:
It uses a SysV init script to start FAHClient even though just about everything from CentOS 7 and up uses SystemD. This is important because FAHClient doesn’t suid to the fahclient user correctly using the SysV compatibility layer of SystemD so we need to create our own SystemD unit file. Luckily I’ve already done that.
cd /etc/systemd/system curl -LO https://hobbes1069.fedorapeople.org/amdgpu/FAHClient.service
The naming is important otherwise SystemD will create the service file from the /etc/init.d file which causes the problem we’re trying to correct. By creating a service file with the same name we stop that behavior.
We need to add fahclient to the “render” group so it as access to the correct devices in /dev.
usermod -a -G render fahclient
Theoretically it’s possible to get everything recognized without rebooting but now is probably a good time to reboot your computer anyway since we’ve made a lot of changes.
REBOOT YOUR COMPUTER
At this point things should hopefully work, so try launching FAHControl and see what happens!
NOTE: FAHControl only attempts to test for GPU units on the first launch. If it doesn’t find one it doesn’t matter how many time you check the “System Info” tab or create a new Folding Slot. It won’t try again unless you edit /etc/fahclient/config.xml and remove the line near the top that has something like
That’s all I can remember for the last couple of days banging my head against the wall but hopefully someone finds this usefull.