After installing AMD's GPU drivers here (specifically "version 20.20 for Ubuntu 18.04"), "lspci" correctly displays the GPU, but "clinfo" doesn't recognize any OpenCl devices.
To install the drivers I unarchived the tarball and ran "./amdgpu-pro-install -y --opencl=pal,legacy --headless" and "sudo usermod -a -G video $LOGNAME".
The command "lspci -nn | grep -E 'VGA|Display'" properly displays the installed GPU:
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df] (rev c7)
Number of platforms 2 Platform Name AMD Accelerated Parallel Processing Platform Vendor Advanced Micro Devices, Inc. Platform Version OpenCL 2.1 AMD-APP (3110.6) Platform Profile FULL_PROFILE Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices Platform Host timer resolution 1ns Platform Extensions function suffix AMD Platform Name Clover Platform Vendor Mesa Platform Version OpenCL 1.1 Mesa 20.0.8 Platform Profile FULL_PROFILE Platform Extensions cl_khr_icd Platform Extensions function suffix MESA Platform Name AMD Accelerated Parallel Processing Number of devices 0 Platform Name Clover 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] No 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
*-display description: VGA compatible controller product: Ellesmere [Radeon RX 470/480/570/570X/580/580X] vendor: Advanced Micro Devices, Inc. [AMD/ATI] physical id: 0 bus info: pci@0000:01:00.0 version: c7 width: 64 bits clock: 33MHz capabilities: pm pciexpress msi vga_controller bus_master cap_list rom configuration: driver=amdgpu latency=0 resources: irq:33 memory:e0000000-efffffff memory:f0000000-f01fffff ioport:1100(size=256) memory:f0200000-f023ffff memory:c0000-dffff
Number of platforms 1 Platform Name AMD Accelerated Parallel Processing Platform Vendor Advanced Micro Devices, Inc. Platform Version OpenCL 2.1 AMD-APP (3110.6) Platform Profile FULL_PROFILE Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices Platform Host timer resolution 1ns Platform Extensions function suffix AMD Platform Name AMD Accelerated Parallel Processing Number of devices 1 Device Name Ellesmere Device Vendor Advanced Micro Devices, Inc. Device Vendor ID 0x1002 Device Version OpenCL 1.2 AMD-APP (3110.6) Driver Version 3110.6 Device OpenCL C Version OpenCL C 1.2 Device Type GPU Device Board Name (AMD) AMD Radeon (TM) RX 480 Graphics Device Topology (AMD) PCI-E, 01:00.0 Device Profile FULL_PROFILE Device Available Yes Compiler Available Yes Linker Available Yes Max compute units 36 SIMD per compute unit (AMD) 4 SIMD width (AMD) 16 SIMD instruction width (AMD) 1 Max clock frequency 1338MHz Graphics IP (AMD) 8.0 Device Partition (core) Max number of sub-devices 36 Supported partition types None Max work item dimensions 3 Max work item sizes 1024x1024x1024 Max work group size 256 Preferred work group size (AMD) 256 Max work group size (AMD) 1024 Preferred work group size multiple 64 Wavefront width (AMD) 64 Preferred / native vector sizes char 4 / 4 short 2 / 2 int 1 / 1 long 1 / 1 half 1 / 1 (cl_khr_fp16) float 1 / 1 double 1 / 1 (cl_khr_fp64) Half-precision Floating-point support (cl_khr_fp16) Denormals No Infinity and NANs No Round to nearest No Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Single-precision Floating-point support (core) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations Yes Double-precision Floating-point support (cl_khr_fp64) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Address bits 64, Little-Endian Global memory size 8566751232 (7.978GiB) Global free memory (AMD) 8346384 (7.96GiB) Global memory channels (AMD) 8 Global memory banks per channel (AMD) 16 Global memory bank width (AMD) 256 bytes Error Correction support No Max memory allocation 4244635648 (3.953GiB) Unified memory for Host and Device No Minimum alignment for any data type 128 bytes Alignment of base address 2048 bits (256 bytes) Global Memory cache type Read/Write Global Memory cache size 16384 (16KiB) Global Memory cache line size 64 bytes Image support Yes Max number of samplers per kernel 16 Max size for 1D images from buffer 134217728 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 256 bytes Pitch alignment for 2D image buffers 256 pixels Max 2D image size 16384x16384 pixels Max 3D image size 2048x2048x2048 pixels Max number of read image args 128 Max number of write image args 8 Local memory type Local Local memory size 32768 (32KiB) Local memory syze per CU (AMD) 65536 (64KiB) Local memory banks (AMD) 32 Max number of constant args 8 Max constant buffer size 4244635648 (3.953GiB) Preferred constant buffer size (AMD) 16384 (16KiB) Max size of kernel argument 1024 Queue properties Out-of-order execution No Profiling Yes Prefer user sync for interop Yes Profiling timer resolution 1ns Profiling timer offset since Epoch (AMD) 1607714011163656126ns (Fri Dec 11 13:13:31 2020) Execution capabilities Run OpenCL kernels Yes Run native kernels No Thread trace supported (AMD) Yes Number of async queues (AMD) 2 Max real-time compute queues (AMD) 0 Max real-time compute units (AMD) 0 SPIR versions 1.2 printf() buffer size 4194304 (4MiB) Built-in kernels Device Extensions cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_amd_bus_addressable_memory cl_khr_spir cl_khr_gl_event 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] Success [AMD] clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name Ellesmere clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name Ellesmere 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) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name Ellesmere
Found this Linux Tech site that shows how to download and install and enable OpenCL in Linux (Debian & Ubuntu) using AMDGPU-Pro driver:
https://linuxconfig.org/install-opencl-for-the-amdgpu-open-source-drivers-on-debian-and-ubuntu
Introduction
The proprietary AMDGPU-PRO drivers only support a select small subset of Linux distributions. Non-LTS Ubuntu releases aren't supported, and Debian users are completely out of luck. To make things worse, AMD doesn't provide OpenCL support through their open source drivers.
There is good news. You can install just the OpenCL parts of the AMDGPU-PRO drivers on your Debian or Ubuntu system using the packages provided by AMD. There's a very specific way that you need to go about it, but it can be done, making things like mining cryptocurrency on an AMD card possible.
EDIT: This Users just opened a new thread concerning OpenCl in Ubuntu latest version. Maybe he can help you get Opencl to be recognized in your GPU card: https://community.amd.com/t5/drivers-software/issues-installing-opencl-from-ubuntu-amdgpu-20-45/m-p/...
Hi and thanks for your response! I already tried this guide and had issues when de-packaging with dependencies. This guide is for non long term support (LTS) versions, but I am using the 18.04 LTS version of Ubuntu. Please let me know if you have any other ideas!
Version 20.20 is an earlier version, version 20.40 is the latest for Ubuntu 18.04 LTS, but it should work.
I have a Vega 64, and to install amdgpu OpenCL 20.40, I download the package from amd.com, and unpack it. Then I use the following command:
amdgpu-install --no-dkms --headless --opencl=pal
At the moment I'm using amdgpu-install, because the --no-dkms option isn't available anymore with amdgpu-pro-install, but that shouldn't make any difference. I'm using --no-dkms too, because I'm installing on Ubuntu 20.10, which has kernel 5.8, meaning the kernel module will fail to compile. But if you're installing on 18.04 LTS, you can omit that. Because I have a Vega 64, I don't need the legacy part either.
This will install the following packages on my computer:
amdgpu-core amdgpu-pro-core clinfo-amdgpu-pro ocl-icd-libopencl1-amdgpu-pro opencl-amdgpu-pro-comgr opencl-amdgpu-pro-icd
You should be able to use the following command to install 20.20 on Ubuntu 18.04 LTS:
amdgpu-pro-install --headless -opencl=pal,legacy
I also create a link to libOpenCL.so.1.2 named libOpenCL.so, which isn't present, because some programs look for it, but it shouldn't be necessary, because they should also check for libOpenCL.so.1, which is present.
What's interesting is that clinfo report when run as sudo. This report definitely shows that amdgpu-pro OpenCL is installed, and what's more, it's actually recognising the GPU! If you scroll down, it says Success, AMD Accelerated Parallel Processing, and Ellesmere for the GPU.
I believe this is a permission issue. Did the install script prompt you for superuser rights? You said you've added yourself to the video group. Can you see it listed when you use groups? You could also try sudo ldconfig, though the script should already have done that.
Thank you for such detailed instructions! I'll give this a shot when I get a chance.