A quick guide: How to install OpenCL for AMD GPUs on Linux Kubuntu 18.04 (and similar distro)

koschi
koschi
Joined: 17 Mar 05
Posts: 86
Credit: 1688467555
RAC: 824375

Some speculations from my

Some speculations from my end:

Since the previous drivers required Ubuntu 16.04, current ones 18.04, I'd say they focus on LTS releases only. With 18.04.02 now shipping kernel 4.18, maybe that also gets supported in next driver releases. Otherwise next LTS is 20.04 then in a bot more than a year :-/

 

With recent distributions you might have more luck with open source OpenCL, via amdgpu (free), mesa and clover/ROCm. I haven't tried this myself yet though...

 

koschi
koschi
Joined: 17 Mar 05
Posts: 86
Credit: 1688467555
RAC: 824375

I did try it, Ubuntu 19.04 +

I did try it, Ubuntu 19.04 + Mesa 19.1 + Clover:

https://einsteinathome.org/host/12770352/tasks/0/0

 

Rather slow for running just one WU, I get around the same run times doing two WUs at once with OpenCL from AMDGPU. Will try ROCm as well...

koschi
koschi
Joined: 17 Mar 05
Posts: 86
Credit: 1688467555
RAC: 824375

I did try ROCm, it was almost

I did try ROCm, it was almost double the speed of Mesa/Clover OpenCL here at Einstein. However, OpenCL from 18.50 still outperformed ROCm by a few percent. Collatz was ok. Both had problems though on other projects, eg. Milkyway doesn't work at all. Both free implementations were ~30% slower than 18.50 legacy OpenCL at Primegrid.

 

I focused back in the AMDGPU-PRO driver and looked for the libraries that it needs to get OpenCL running on unsupported distributions and kernels. Arch Linux had a build script to extract the libraries from the official driver, I based my version for DEB based distributions around that:

http://kerbodyne.com/boinc/create_amdgpu-ocl-pkg.sh

Place the script with the driver archive of 18.50 in the same directory (I'm still working on automatic downloading from the official website), then execute the script. It unpacks the driver and extracts libraries from 3 different packages, then creates an installable package from these. So they can be installed/removed quickly, copied to other systems etc. I choose to provide a script here, so I don't (potentially) violate the license agreement by redistributing AMDs software on my server. The script will ask for sudo permissions in order to change the ownership of the files contained in the archive to root:root. Have a look at the code to confirm that it doesn't do any harm. I created it in an isolated environment, also tried it on my primary workstation, no harm was done running the script ;-)

I could get a Polaris and a VEGA card crunching on Ubuntu 19.04 with kernel 5.0.0 via this procedure. No success yet on pre-Polaris cards yet, I plan trying with an HD7950 tonight though, lets see.

Any feedback is welcome, I'd appreciate you reporting back in case it works or fails for you.

Thanks!

 

cecht
cecht
Joined: 7 Mar 18
Posts: 1533
Credit: 2902142205
RAC: 2173718

Koschi wrote:Being on Ubuntu

Koschi wrote:
Being on Ubuntu 18.04. is not enough, the driver only compiles against kernel 4.15. 4.18/4.19/4.20 didn't work, so I had to revert back to 4.15.

Yes. On my new host, I first installed Lubuntu 18.04, since that what I'm running on my other host with a couple AMD cards. But that new install loaded the Linux 4.18 kernel and so I couldn't load amdgpu 18.5 drivers (when I tried, the install had warnings and the system would freeze at boot with a blank screen). I then realized on that other host, I had first installed Lubuntu 16.04, which loads the Linux 4.15 kernel, and when I upgraded to 18.04, it retained the 4.15 kernel, which works with the amdgpu 18.5 drivers. Up until then, being a newbie, I had no idea that kernels were distinct from the rest of the system.

On the new host I couldn't change the GRUB_DEFAULT boot sequence to grab the 4.15 kernel instead of the default 4.18 kernel because I had mindlessly clicked the Lubuntu 18.04 install option for LVM, which prevented changing the default kernel in GRUB. (I could manually select the 4.15 kernel at boot, but I didn't want to go that route for every reboot/restart.) So I started over and installed Lubuntu 16.04 to get the right default kernel, then installed amdgpu 18.4 (not 18.5), which is the most recent version for Ubuntu 16.04, and OpenCL. I was planning to just stick with that 16.04 configuration, but a utility that I use to control my RX 570 cards requires Python 3.6, which is not part of the 16.04 package. So *sigh*, I upgraded to Lubuntu 18.04, which does include Python 3.6, but stuck with the amdgpu 18.4 drivers, and everything now works fine.

Ideas are not fixed, nor should they be; we live in model-dependent reality.

mikey
mikey
Joined: 22 Jan 05
Posts: 12682
Credit: 1839086474
RAC: 3838

Millenium wrote:Confirming

Millenium wrote:

Confirming that the current AMDGPU 18.50 driver only work for Ubuntu 18.04.1 and its kernel (and of course kubuntu and others), if you update the 18.04 kernel or if you install Ubuntu 18.10 or 19.04 it does not work.

I am currently trying Kubuntu 19.04 (wich btw works very well) and the driver does not install, so no OpenCL at all for now. I hope an update will come soon after 19.04 is officially released in April.

Darn it and here I installed 18.10.2 hoping it would work!! Oh well I will have to look thru my cd's and see if I have that older version or it's back to the download page.

koschi
koschi
Joined: 17 Mar 05
Posts: 86
Credit: 1688467555
RAC: 824375

No need to downgrade, go

No need to downgrade, go ahead with 18.10 and extract the legacy OpenCL libraries from the official driver with my script from above post. Then install the created .deb file and you are ready to roll...

cecht
cecht
Joined: 7 Mar 18
Posts: 1533
Credit: 2902142205
RAC: 2173718

Mikey wrote:Darn it and here

Mikey wrote:
Darn it and here I installed 18.10.2 hoping it would work!! Oh well I will have to look thru my cd's and see if I have that older version or it's back to the download page.

I too had no joy loading amdgpu after a clean install of 18.04.2, but discovered (from a tip from Rick'sLab on GitHub), that if you first clean install Ubuntu 18.04.1, then update, there is no problem installing amdgpu 18.5 or OpenCL. The reason, I believe, is that 18.04.1 loads the Linux 4.15.0-47-generic kernel, which is retained after the update to 18.04.2, while a 18.04.2 clean install loads the Linux 4.18.xxxx kernel, which so far doesn't work with amdgpu.

With the current amdgpu 18.5-756341 driver package for Ubuntu 18.04, the on-line AMD documentation is not up to date. After ./amdgpu-install -y  and a reboot, I could only get OpenCL to install with ./amdgpu-install -y --opencl=legacy. (I didn't need the Vega drivers so didn't include =pal in my above example, and didn't need the --headless option.) In other words, ./amdgpu-pro-install -y --opencl=legacy didn't work.  There is no longer a separate amdgpu-pro-install script, so -pro is now an option within the new amdgpu-intstall script.

Also, amdgpu-uninstall won't work as documented because that script is now in usr/bin; run from there and it works fine (as I learned from many failed early installation attempts).

Ideas are not fixed, nor should they be; we live in model-dependent reality.

koschi
koschi
Joined: 17 Mar 05
Posts: 86
Credit: 1688467555
RAC: 824375

@cecht have you considered

@cecht

have you considered extracting the OpenCL legacy libs from the 18.50 driver? That way you can get never kernel Ubuntu (18.04.2, 18.10 and 19.04) crunching...

cecht
cecht
Joined: 7 Mar 18
Posts: 1533
Credit: 2902142205
RAC: 2173718

koschi wrote:@have you

koschi wrote:
@have you considered extracting the OpenCL legacy libs from the 18.50 driver? That way you can get never kernel Ubuntu (18.04.2, 18.10 and 19.04) crunching...

Ah, no, I didn't think of that. Tasks are crunching nicely at the moment, so I'm hesitant to fix something that ain't broke.  Same reason I haven't tried the new AMD amdgpu 19.1 drivers optimized for Ubuntu 18.04.2. I'll take the ignoble route and wait to hear from someone else those magic words, "yes, it works".  In case I get a fit of courage, though, is it necessary to uninstall amdgpu before updating to newer drivers?  What about OpenCL? - would that also need to be uninstalled before updating?

Ideas are not fixed, nor should they be; we live in model-dependent reality.

cecht
cecht
Joined: 7 Mar 18
Posts: 1533
Credit: 2902142205
RAC: 2173718

Just posting an update to my

Just posting an update to my previous post: I have loaded the amdgpu 19.3 drivers and everything is humming along nicely at x3 tasks for my two RX 570 cards (even though that driver release was supposed to be only for the new RX 5700 Navi cards).

Ideas are not fixed, nor should they be; we live in model-dependent reality.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.