Guide | Install AMD OpenCL on: Pop!OS & some Ubuntu Derivates | Linux, amdgpu, amdgpu-pro, rocm, rocr


So i could have the OpenCL installed and i know why it don’t worked before.

2 things :

  • don’t install crappy flatpak applications (Blender 2.83.5 from deb repositories is functionnal)
  • and i installed this : sudo apt install opencl-headers ocl-icd-libopencl1
1 Like

Welcome and Thank you, this is interesting information,

I was not aware that ocl-icd-libopencl1 is required separately. In my package, it was part of the Pro Pin Lib.

  • Also good to know: flatpack version doesn’t work properly for this task.

Blenderis also had problems with the flatpack version, if you have had similar experiences, there is really something with the flatpack blender.

Ahh another typo, I’m pretty sure there are more.
Right now I’m just too blind to find any more of them hehe.
Thanks for letting me know.

I’ll look to it, especially the opencl-headers ocl-icd-libopencl1 seems pretty interesting.
If necessary, I will include these steps in the list.

Thank you and Happy Halloween. :ghost:

1 Like

Thanks for the tutorial!

I run Pop OS 20.10 and have downloaded the latest AMd drivers (amdgpu-pro-20.40-1147286-ubuntu-20.04) and the installation via /amdgpu-install --no-dkms --opencl=rocm goes without any issues.
But unfortunately, the clinfo still shows 0 devices, and the OpenCL is not visible to any apps, including Blender.

You try reinstalling the package ocl-icd-libopencl1:
sudo apt reinstall ocl-icd-libopencl1

1 Like

Thank you @YAFU but that hasn’t helped either :frowning:

Oh, actually after another restart it shows a device now! Thank you!

1 Like

Hello, this tuto didn’t work for me both with Pop os 20.10 and 20.04

I ended up using Ubuntu 20.04 with this tuto :

works great, Blender recognized both my amd cpu and gpu under OpenCL tab.

I followed these instructions as well was not able to get it to work with my 5600xt on PopOS 20.10. After using ./amdgpu-install --no-dkms --opencl=rocm the command clinfo wasn’t even available. I had to install in separately and it showed 0 platforms even after restart.


I also tried uninstall my drivers and installing the 20.40 drivers (per one of the posts) and got this error on executing sudo apt install amdgpu-dkms libdrm-amdgpu-amdgpu1

ERROR (dkms apport): kernel package linux-headers-5.8.0-7630-generic is not supp orted Error! Bad return status for module build on kernel: 5.8.0-7630-generic (amd64) Consult /var/lib/dkms/amdgpu/ for more infor mation. dpkg: error processing package amdgpu-dkms (--configure): installed amdgpu-dkms package post-installation script subprocess returned erro r exit status 10 Errors were encountered while processing: amdgpu-dkms E: Sub-process /usr/bin/dpkg returned an error code (1)

I get the same error “The amdgpu driver is already installed or was not uninstalled correctly.” As I mentioned in my previous post I tried using your uninstall solution sudo apt install amd-gpu-dkms libdrm-amdgpu-amdgpu1 and got the Bad return status error I Listed above.

EDIT I ran ./amdgpu-install --uninstall as well and now when I use ./amdgpu-pro-install -y --opencl = pal, Legacy --headless the output is

E: Invalid operation = ERROR: Unable to install pin package. This driver may not support the running operating system.

Here is the /var/lib/dkms/amdgpu/ which provides more info on the error.

DKMS make.log for amdgpu- for kernel 5.8.0-7630-generic (amd64) Mon Nov 30 08:06:07 PM MST 2020 make: Entering directory '/usr/src/linux-headers-5.8.0-7630-generic' /var/lib/dkms/amdgpu/ "Local GCC version 100202 does not match kernel compiler GCC version 100200" /var/lib/dkms/amdgpu/ "This may cause unexpected and hard-to-isolate compiler-related issues" AR /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ /var/lib/dkms/amdgpu/ In function ‘ttm_bo_vm_fault_idle’: /var/lib/dkms/amdgpu/ error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’? 76 | up_read(&vma->vm_mm->mmap_sem); | ^~~~~~~~ | mmap_base /var/lib/dkms/amdgpu/ In function ‘amdttm_bo_vm_reserve’: /var/lib/dkms/amdgpu/ error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’? 155 | up_read(&vma->vm_mm->mmap_sem); | ^~~~~~~~ | mmap_base make[2]: *** [scripts/ /var/lib/dkms/amdgpu/] Error 1 make[2]: *** Waiting for unfinished jobs.... CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ LD [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ make[1]: *** [scripts/ /var/lib/dkms/amdgpu/] Error 2 make[1]: *** Waiting for unfinished jobs.... CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ /var/lib/dkms/amdgpu/ In function ‘amdgpu_driver_load_kms’: /var/lib/dkms/amdgpu/ error: ‘DPM_FLAG_NEVER_SKIP’ undeclared (first use in this function) 202 | dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP); | ^~~~~~~~~~~~~~~~~~~ /var/lib/dkms/amdgpu/ note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [scripts/ /var/lib/dkms/amdgpu/] Error 1 make[2]: *** Waiting for unfinished jobs.... /var/lib/dkms/amdgpu/ warning: ‘dma_fence_test_signaled_any’ defined but not used [-Wunused-function] 30 | dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ /var/lib/dkms/amdgpu/ In function ‘amdkcl_pci_init’: /var/lib/dkms/amdgpu/ warning: passing argument 2 of ‘amdkcl_fp_setup’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 103 | _kcl_pcie_link_speed = (const unsigned char *) amdkcl_fp_setup("pcie_link_speed", _kcl_pcie_link_speed_stub); | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/dkms/amdgpu/ /var/lib/dkms/amdgpu/ note: expected ‘void *’ but argument is of type ‘const unsigned char *’ 12 | static inline void *amdkcl_fp_setup(const char *symbol, void *fp_stup) | ~~~~~~^~~~~~~ /var/lib/dkms/amdgpu/ In function ‘amdgpu_connector_update_scratch_regs’: /var/lib/dkms/amdgpu/ warning: unused variable ‘i’ [-Wunused-variable] 235 | int i; | ^ /var/lib/dkms/amdgpu/ In function ‘amdgpu_connector_find_encoder’: /var/lib/dkms/amdgpu/ warning: unused variable ‘i’ [-Wunused-variable] 258 | int i; | ^ /var/lib/dkms/amdgpu/ In function ‘amdgpu_connector_best_single_encoder’: /var/lib/dkms/amdgpu/ warning: unused variable ‘i’ [-Wunused-variable] 373 | int i; | ^ CC [M] /var/lib/dkms/amdgpu/ /var/lib/dkms/amdgpu/ In function ‘amdgpu_connector_dvi_detect’: /var/lib/dkms/amdgpu/ warning: unused variable ‘i’ [-Wunused-variable] 1121 | int i; | ^ /var/lib/dkms/amdgpu/ In function ‘amdgpu_connector_dvi_encoder’: /var/lib/dkms/amdgpu/ warning: unused variable ‘i’ [-Wunused-variable] 1177 | int i; | ^ /var/lib/dkms/amdgpu/ In function ‘amdgpu_connector_encoder_get_dp_bridge_encoder_id’: /var/lib/dkms/amdgpu/ warning: unused variable ‘i’ [-Wunused-variable] 1341 | int i; | ^ /var/lib/dkms/amdgpu/ In function ‘amdgpu_connector_encoder_is_hbr2’: /var/lib/dkms/amdgpu/ warning: unused variable ‘i’ [-Wunused-variable] 1366 | int i; | ^ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ CC [M] /var/lib/dkms/amdgpu/ LD [M] /var/lib/dkms/amdgpu/ make[1]: *** [scripts/ /var/lib/dkms/amdgpu/] Error 2 make: *** [Makefile:1780: /var/lib/dkms/amdgpu/] Error 2 make: Leaving directory '/usr/src/linux-headers-5.8.0-7630-generic'

Yes, I have been following step 4 this whole time. I’ve been only operating from a terminal pointing to that directory.

"For now: it’s also a possibility to avoid the problematic package like:
sudo apt install libdrm-amdgpu-amdgpu1"

How? That is the solution you provided for uninstalling the drivers. Without that I was not able to correctly uninstall it. As of this moment I’m not even sure I actually uninstalled it since the new error is confusing to me.

Okay, first things first:
Your uninstall problem.
requires the following steps:
./amdgpu-pro-install --uninstall
./amdgpu-install --uninstall
Just do both.
This should do the trick, at least it always worked in my tests. No matter which combination I tried.
The drivers were uninstalled properly.
If you want, let me know if it works.

AMD changed their drivers!
I found the problem on recent installation attempts.
AMD changed its drivers.
Pal and Legacy headers have been replaced in favor of ROCm and ROCr.

This change also requires the installation of dkms packages and a kernel rebuild,
which is incompatible with Pop!OS.

I’m not entirely sure if the combination of operating system and driver is causing the problem.
Pop! OS 20.10 + Radeon ™ software for Linux® drivers for Ubuntu 20.04.1
Or whether it’s just the change of headers.

From what it looks like, if your kernel is too new, you won’t be able to build DKMS. I’ve been trying to figure out how but had no luck so far. I’m on Kubuntu 20.10 with kernel 5.8.0-29.

When I try to build I get errors mentioning “mmap_sem”. According to this post, anything newer than 5.7 (or maybe that has some patches from 5.7 applied to older kernels) there were changes that won’t allow building DKMS to complete.

Tried the “renamed mmap_sem to mmap_lock” option on the source files and was able to get past the “mmap_sem” errors… and introduced a bunch of new errors. No idea how to fix them.

So until AMD releases a new amdgpu-pro build that works with newer kernels, no OpenCL for me. Or I can reinstall using Kubuntu 20.04 LTS.

1 Like

You got the --no-dkms option to work? Every time I try, it still tries to build the dkms.

I just ran “./amdgpu-install --opencl=legacy,rocr --no-dkms --headless” and after some other stuff gets done I get this:

Setting up dkms (2.8.3-4) …
Setting up amdgpu-dkms (1: …
Loading new amdgpu- DKMS files…
Building for 5.8.0-29-generic 5.8.0-31-generic
Building for architecture x86_64
Building initial module for 5.8.0-29-generic
ERROR: Cannot create report: [Errno 17] File exists: ‘/var/crash/amdgpu-dkms.0.crash’
Error! Bad return status for module build on kernel: 5.8.0-29-generic (x86_64)
Consult /var/lib/dkms/amdgpu/ for more information.
dpkg: error processing package amdgpu-dkms (–configure):
installed amdgpu-dkms package post-installation script subprocess returned error exit status 10

This is going to sound silly, and I’m amazed that it worked myself, but I was running into the same issue and got around it by simply removing the check for --no-dkms in the installer script.

Open up your ./amdgpu-pro-install script and look for the check_options function. Change it to something like this:

    function check_options() {
    #       if [[ "${OPTIONS[*]}" =~ "no-dkms" ]] && \
    #               [[ "${OPTIONS[*]}" =~ "pro" ]]; then
    #               echo -e "ERROR: using --no-dkms with a pro install is "`
    #                       `"invalid.\nDid you want to run the following`
    #                       ` instead?\namdgpu-install --no-dkms" | stderr
    #               exit 1
    #       fi
            echo 'Skipping'

You can’t just remove it because it’s being called elsewhere, but apparently it’s just rejecting you based on the fact you’re running the pro installer. I don’t know DKMS well enough to say if this will cause problems down the line, so run at your own risk. But once I made that modification these instructions worked like a charm - I confirmed with both clinfo and in Blender.

I used the 20.40 driver on PopOS 20.04, not sure how it might behave in other environments.

Edit: I’m on kernel 5.8.0-7630-generic

1 Like

I know that this thread is not strictly for the case im going to lay out, but I’m writing about it here, in hope there is a possibility that this is GPU driver issue and maybe someone here can help me. This problem is really difficult to diagnose.

For some time I’m struggling with Blender randomly hanging out on me. It’s happenig during multithreaded workloads and the Blender process cannot be killed.

Here is original thread: Blender randomly hangs - what CLI debug options should be enabled for GPU issues?
Here is bugreport:

As of now I’ve uninstalled all AMDGPU-PRO drivers and I’m running some tests to see if this can be ruled out of the equation.

After uninstalling AMDGPU-PRO drivers the issue is gone.

1 Like

Which driver version were you using?

I’ve been seeing similar behavior recently but no idea what the issue is. I wonder if maybe uninstalling and then reinstalling a different version would help?

EDIT: I started looking into this a bit more and I had the AMD PPA (oibaf-graphics) still enabled from a previous installation attempt. Purging it and keeping my driver version at 20.40 seems to be helping. Here are some instructions on how to remove the PPA if you’re using that and want to see if disabling it helps:

Hello @pzona!
I’m also using 20.40. I’ve reinstalled the drivers with the hack you posted above and everything so far it seems to be OK. Tested Blender versions 2.90, 2.91 and 2.92.
I don’t have PPA’s in sources.

Hmm not sure what the issue was then but glad it’s working!

It looks like my issue was related to the Mesa and Vulkan libraries being upgraded past the AMDGPU driver. If you’re not using the PPA (and are careful when upgrading) you should be okay :slight_smile:

1 Like

Hey, just asking for the sake of interest, are your Radeon VII pro variants?
If not, the installation without pro might be helpful to solve your problem/s.

./amdgpu-install --no-dkms --opencl=legacy,pal --headless

I’m not sure if you mentioned using the Pro installer or someone else did.

Nevertheless, I would like to point out that, contrary to AMD’s statement, OpenCL can also be installed without the PRO version.

Happy new year.