4

After installing AMD's GPU drivers here (specifically "version 20.20 for Ubuntu 20.04"), OpenCl doesn't work.

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)

But when I run clinfo I get an output of

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

After searching around I tried running sudo apt-get install ocl-icd-opencl-dev, but it was already installed.

Any help would be very appreciated. Please let me know if there is any information I could add that you think may be useful.

OrangePeeler
  • 41
  • 1
  • 3
  • The `amdgpu-pro` driver might be incompletely installed. What's the output of `dpkg -l | grep amdgpu` ? – HEKTO Dec 29 '20 at 23:54

2 Answers2

1

I have the same problem trying to use OpenCl (for mining) via ssh (despite I installed amdgpu-pro using the --headless option). If you experience the issue via ssh try to log in directly after boot and start the specific process there as a workaround. If it does not work and you installed amdgpu-pro via ssh try to install it directly.

Kytut
  • 11
  • 1
0

Attribution

First I tried to install the amdgpu software for the particular videocard, but I was not able to get that working successfully. Furthermore, the ./amdgpu-install and amdgpu-pro-install scripts froze the terminal for a significant amount of time. Hence, after some trial and error I followed the steps from this video, which explains the/a more detailed- process suggested in the answer by TurboSlayer in this question. I verified the instructions work by inspecting the output of both clinfo and rocminfo and observing the respective cards are indeed recognized in the output of both of these commands.

Code

# Source of commands: https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html

yes | sudo apt update
yes | sudo apt dist-upgrade
yes | sudo apt install libnuma-dev
yes | sudo apt install wget gnupg2
wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list
yes | sudo apt update
sudo reboot

# Open a terminal after reboot and run:
yes | sudo apt install rocm-dkms
sudo usermod -aG video $LOGNAME
sudo usermod -aG render $LOGNAME
echo 'export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin' | sudo tee -a /etc/profile.d/rocm.sh


# Wait till everything is installed and reboot again
sudo reboot

# Verify the videocards are recognized with:
clinfo
rocminfo

Next, one wants to ensure that OpenCL actually finds those cards. By default OpenCL looks into its own directory for the amdocl64_40000.icd (which is just some file it apparently needs, I thought it was card-dependent due to the 40000 code but it does not look like that). However that file is actually located in the rocm folder when using this procedure so change the path of that amdocl64_40000.icd file with:

sudo nano /etc/OpenCL/vendors/amdocl64_40000.icd

and change:

libamdocl64.so

to:

/opt/rocm/opencl/lib/libamdocl64.so

Now you shouldn't get the Failed to list OpenCL platforms error anymore. Source for this last step.

Note

The script was ran on a fresh Ubuntu 20.04 installation. The above instructions did not work after uninstalling the amdgpu-install nor amdgpu-pro-install files. I guess something which also was used by rocm was corrupted during that amdgpu-install process, which I guess did not happen at the fresh Ubuntu 20.04 installation.

a.t.
  • 275
  • 4
  • 13