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

After a bit more investigation, I noticed a recent update to the amdgpu-install script on Dec 6, 2021 to version 21.40.2.40502.

Actual formal documentation can be found here:
https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation_new.html#ubuntu-20-04

The installation can now complete without error message however I have no opencl acceleration in Blender (not fully surprised given recent posts here).

With that new driver setup I have the following:

>clinfo                                                                                                                                           
Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.2 AMD-APP (3361.0)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback 
  Platform Extensions function suffix             AMD
  Platform Host timer resolution                  1ns

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  AMD Accelerated Parallel Processing
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No devices found in platform [AMD Accelerated Parallel Processing?]
  clCreateContext(NULL, ...) [default]            No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No devices found in platform

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loaderns
  ICD loader Vendor                               OCL Icd free softwarens
  ICD loader Version                              2.2.14ns
  ICD loader Profile                              OpenCL 3.0ns

and a tiny bit too level for me:

>sudo /opt/rocm-4.5.2/bin/rocminfo                                                                                                                
ROCk module is loaded
=====================    
HSA System Attributes    
=====================    
Runtime Version:         1.1
System Timestamp Freq.:  1000.000000MHz
Sig. Max Wait Duration:  18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count)
Machine Model:           LARGE                              
System Endianness:       LITTLE                             

==========               
HSA Agents               
==========               
*******                  
Agent 1                  
*******                  
  Name:                    Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
  Uuid:                    CPU-XX                             
  Marketing Name:          Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
  Vendor Name:             CPU                                
  Feature:                 None specified                     
  Profile:                 FULL_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        0(0x0)                             
  Queue Min Size:          0(0x0)                             
  Queue Max Size:          0(0x0)                             
  Queue Type:              MULTI                              
  Node:                    0                                  
  Device Type:             CPU                                
  Cache Info:              
    L1:                      32768(0x8000) KB                   
  Chip ID:                 0(0x0)                             
  Cacheline Size:          64(0x40)                           
  Max Clock Freq. (MHz):   4300                               
  BDFID:                   0                                  
  Internal Node ID:        0                                  
  Compute Unit:            6                                  
  SIMDs per CU:            0                                  
  Shader Engines:          0                                  
  Shader Arrs. per Eng.:   0                                  
  WatchPts on Addr. Ranges:1                                  
  Features:                None
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: FINE GRAINED        
      Size:                    32811408(0x1f4a990) KB             
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 2                   
      Segment:                 GLOBAL; FLAGS: KERNARG, FINE GRAINED
      Size:                    32811408(0x1f4a990) KB             
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 3                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    32811408(0x1f4a990) KB             
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
  ISA Info:                
*******                  
Agent 2                  
*******                  
  Name:                    gfx803                             
  Uuid:                    GPU-XX                             
  Marketing Name:          Radeon RX 580 Series               
  Vendor Name:             AMD                                
  Feature:                 KERNEL_DISPATCH                    
  Profile:                 BASE_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        128(0x80)                          
  Queue Min Size:          4096(0x1000)                       
  Queue Max Size:          131072(0x20000)                    
  Queue Type:              MULTI                              
  Node:                    1                                  
  Device Type:             GPU                                
  Cache Info:              
    L1:                      16(0x10) KB                        
  Chip ID:                 26591(0x67df)                      
  Cacheline Size:          64(0x40)                           
  Max Clock Freq. (MHz):   1340                               
  BDFID:                   256                                
  Internal Node ID:        1                                  
  Compute Unit:            36                                 
  SIMDs per CU:            4                                  
  Shader Engines:          4                                  
  Shader Arrs. per Eng.:   1                                  
  WatchPts on Addr. Ranges:4                                  
  Features:                KERNEL_DISPATCH 
  Fast F16 Operation:      FALSE                              
  Wavefront Size:          64(0x40)                           
  Workgroup Max Size:      1024(0x400)                        
  Workgroup Max Size per Dimension:
    x                        1024(0x400)                        
    y                        1024(0x400)                        
    z                        1024(0x400)                        
  Max Waves Per CU:        40(0x28)                           
  Max Work-item Per CU:    2560(0xa00)                        
  Grid Max Size:           4294967295(0xffffffff)             
  Grid Max Size per Dimension:
    x                        4294967295(0xffffffff)             
    y                        4294967295(0xffffffff)             
    z                        4294967295(0xffffffff)             
  Max fbarriers/Workgrp:   32                                 
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    8388608(0x800000) KB               
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       FALSE                              
    Pool 2                   
      Segment:                 GROUP                              
      Size:                    64(0x40) KB                        
      Allocatable:             FALSE                              
      Alloc Granule:           0KB                                
      Alloc Alignment:         0KB                                
      Accessible by all:       FALSE                              
  ISA Info:                
    ISA 1                    
      Name:                    amdgcn-amd-amdhsa--gfx803          
      Machine Models:          HSA_MACHINE_MODEL_LARGE            
      Profiles:                HSA_PROFILE_BASE                   
      Default Rounding Mode:   NEAR                               
      Default Rounding Mode:   NEAR                               
      Fast f16:                TRUE                               
      Workgroup Max Size:      1024(0x400)                        
      Workgroup Max Size per Dimension:
        x                        1024(0x400)                        
        y                        1024(0x400)                        
        z                        1024(0x400)                        
      Grid Max Size:           4294967295(0xffffffff)             
      Grid Max Size per Dimension:
        x                        4294967295(0xffffffff)             
        y                        4294967295(0xffffffff)             
        z                        4294967295(0xffffffff)             
      FBarrier Max Size:       32                                 
*** Done *** 

I will continue my investigation to see if I can get my setup going or if it is a dead end

Are you sure that you are on a Blender version earlier than 3.0 to try OpenCL acceleration?

You shouldn’t need root to run rocminfo, if your user is in render and video groups.
That’s a first requirement before trying anything in the stack remotely evolved like running Blender on HIP.

I have a hard time wrapping my head around

  • OpenCL in deb-based-distributions package management (there is a mesa ICD loader, but loads of virtual packages),
  • ROCm OpenCL
  • ROCm HIP - OpenCL connection.

Sure enough idiot me did not bother trying blender 3.0…

I lost a few brain cells going through the maze of the evolution of AMD installer this morning

After trying again, I confirm there is no support showing in Blender 3.0.

I also had an issue with suspend/sleep option which I use a lot so that is a showstopper.

As there seems to be very active development and my card is unlikely to have full support, I will stick to v2.93.6 and drivers v21.20 until the installer improves and formal support for the RX580 is confirmed as it seems unlikely but hopefully I will be proven wrong.

Maybe @Denzil-Ferreira was showing that openCL still worked with Blender3.0, although the Blender foundation announced that it dropped support… I have not followed closely enough wouldn’t want to mislead you…

Thanks for the clarification @Maxzor - I also read about the drop of OpenCL in 3.0 and double checking, it is not clear the version used by @Denzil-Ferreira .

For now, I will stick to what works for my setup and wait for maturity to come.

Hey! I forgot to check what version of Blender this was, but it was the one installed from Pop App Store directly! I can’t confirm this atm as I’m on Fedora 35 now :man_facepalming:

@Denzil-Ferreira still hard to say as the PopOS app store has 2 options, the deb version which is on 2.93.3 and the flatpak which is on 3.x

Hi yes, you are correct, it’s the 2.93.3 version (.deb). Just for fun, I installed the flatpack 3.x and there is no OpenCL on the preferences, only CUDA is there.

2 Likes

Hi,Can somebody help me. I tried install several drivers but none of them work properly.
I am working on ubuntu 20.04.3LTS and radeon 6600 xt. I need direct instructions which drivers should i download and what part should i install bc i am an idiot
thanks in advance

Okey,i installed drivers followed your instructions,but it in preferences gpu has weird name and it work really slow.(i did ./amdgpu-install --no-dkms --opencl=rocr)
Screenshot from 2022-01-11 14-19-53

Hello @Maxzor !

First thank you and others in debian-ai mailing list for packaging ROCm. Considering how big Debian ecosystem is it’s good to see joined effort between hardware manufacturer and distro maintainers.

I know that it is very early, but nevertheless I wanted to ask some general user-related questions:

OPENCL
I saw that you had some problems with opencl-runtime and that it is still not packaged. I assume that no opencl-runtime means that the applications that require OpenCL are not going to work OOTB with current rocm debian package.
OpenCL might be eventually needed as older versions of Blender use it. Having both OpenCL and HIP night be necessary for testing performance regressions. Switching between two different driver versions for this purpose sounds like a nightmare.

UPDATES
After initial work with first package version is done how hard will it be to upgrade ROCm to newer versions? How dependand are you (as a packaging team) on AMD when it comes to updating rocm package after new version of ROCm is released by AMD?

MESA
Do I understand it correctly that rocm package will provide only compute parts of the driver stack and in theory there shouldn’t be any conflict with MESA display drivers?

Thanks again for your work, and good luck.

Hello @silex!

OPENCL
I am at this very moment discussing with gentoo packagers whom also have trouble with rocm/opencl 2.2 . I got rocm-opencl-runtime compiled 5 minutes ago here, with its ICD loader, but with either “debian ICD” and “rocm ICD” clinfo gives :

ERROR: clGetPlatformIDs(-1001)

I have no domain knowledge whatsoever on OpenCL… I was about to ask for help the debian openCL team, Andreas Beckmann seems knowledgeable. Any help welcome!
P.S. give me a few minutes and I’ll upload a working build at salsa.debian.org/rocm-team/rocm-opencl-runtime:white_check_mark:

OTHER PACKAGES AND TODO
Other than OpenCL, there is still a fair amount of work to get all the stack uploaded.

Notably there seem to be issues with OpenMP so any help welcome. With a few exchanges that I had with Mathew Arsenault, Jon Chesterfield, and on github, it seems that OpenMP offloading will at least need llvm-14. I don’t even know if that means that OpenMP programs cannot run on the ROCm stack currently.

UPDATES
The debian packages have watch files, this means that in theory when AMD releases ROCm 5.1 in the following weeks, it would be a few shell commands to update all the packages to the new ROCm version.
In practice though, anything can break, and I would not be surprised that the Gordian knot of rocclr-opencl-hip-hipamd will completely break into something new that will need another amount of work to package again.

MESA
I know very little about MESA: do they in any way modify the kernel driver? If not, it remains to be seen how AMD finalizes compute/graphics interop, but I would be surprised if there was any conflict there.
P.S. The conflict that might arise is between MESA OpenCL and ROCm OpenCL. This area needs discussion, and I have no clue where it should happen…

1 Like

Nice timing :^)

Completely understandable.

Interesting. I cant help much but the only time I heard about OpenMP when it comes to Blender was with GPU support for Mantaflow (smoke & fluid). Thou it looks that the development of this feature is on hold right now. I don’t know if Blender uses OpenMP elsewhere.

Fingers crossed it will not.

AFAIK MESA OpenCL is a separate optional package and you can install display driver only. But I could be wrong here.

Can the ubuintu open source driver extend rocm?

Hi !
So sad ! it did not worked for me (but thanks for the share)

the config

Here’s my config infos for you

# neofetch

         /////////////
     /////////////////////
  ///////*767////////////////
//////7676767676*//////////////       root@pop-os 

/////76767//7676767////////////// -----------
/////767676///76767/////////////// OS: Pop!_OS 22.04 LTS x86_64
///////767676///76767.///7676
/////// Kernel: 5.18.10-76051810-generic
/////////767676//76767///767676//////// Uptime: 12 mins
//////////76767676767////76767///////// Packages: 2370 (dpkg)
///////////76767676//////7676////////// Shell: bash 5.1.16
////////////,7676,///////767/////////// Resolution: 2880x1600
/////////////*7676///////76//////////// Terminal: gnome-terminal
///////////////7676//////////////////// CPU: AMD Ryzen 7 5800X (16) @ 3.800GHz
///////////////7676///767//////////// GPU: AMD ATI Radeon RX 6700/6700 XT / 6800M
//////////////////////’//////////// Memory: 2641MiB / 32012MiB
//////.7676767676767676767,//////
/////767676767676767676767/////
///////////////////////////
/////////////////////
/////////////

# hostnamectl

Static hostname: pop-os
Icon name: computer-desktop
Chassis: desktop
Operating System: Pop!_OS 22.04 LTS
Kernel: Linux 5.18.10-76051810-generic
Architecture: x86-64

post try

Here’s some result of my try (did not see errors)

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

blablabla

#apt install opencl-headers ocl-icd-libopencl1

blablabla

# clinfo

Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3224.4)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Extensions function suffix AMD
Platform Host timer resolution 1ns

Platform Name AMD Accelerated Parallel Processing
Number of devices 0

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, …) No platform
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, …) No platform
clCreateContext(NULL, …) [default] No platform
clCreateContext(NULL, …) [other]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No devices found in platform

What driver version you tried to install?

OpenCL on AMD can reliably work with the following hack. I have installed only 2 packages from AMD PRO driver and OpenCL works (Debian sid).

I tried to install the amd one

Color me surprised. What version NUMBER?

Feel a bit lost about these drivers
I downloaded, untar and used that version from amd

Radeon™ Software for Linux® installer version 22.20 for Ubuntu 20.04.5 HWE

Now I’ve got that with less /proc/modules
amdgpu 10448896 16 - Live 0xffffffffc08f5000

And there are some random big pixel artefacts on screen, now

Most of the method from this thread wont work with newer drivers. AMD changed their driver packaging method recently.

I suggest you try to find older drivers. I have installed amdgpu-pro-20.40-1147286-ubuntu-20.04
Everything newer either will not install or will not work properly, at least on Debian. On PopOS it should be similar.

To be clear. This will give you OpenCL only, so you can forget about using Blender 3.0 and newer if you want GPU rendering.

AMD does not release PRO drivers for PopOS nor for Debian. If you want to render on GPU with Blender 3.0 and newer your best bet is to wait until ROCm is packaged in Debian, so it can finally trickle down to PopOS. When it happens - its hard to tell.
Alternatively you can compile ROCm from source, but it can be complicated.

1 Like