Install OpenCL For The AMDGPU Open Source Drivers On Debian and Ubuntu

Objective

Install the OpenCL portion of the AMDGPU-PRO drivers on Debian and Ubuntu.

Distributions

Debian and Ubuntu

Requirements

A working install of Debian or Ubuntu with root privileges

Conventions

  • # – requires given linux command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – given linux command to be executed as a regular non-privileged user

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.

WARNING: This may interfere with your existing drivers, resulting in poor performance and instability. Proceed with caution.

Install The Prerequisites

Before you get started, you’re going to need a couple of packages. Install them.

$ sudo apt install build-essential dkms


Get the AMDGPU-PRO Drivers

Next, you’ll need to download the latest AMDGPU-PRO packages for Ubuntu from AMD. AMD decided to make this as unnecessarily difficult as possible and locked newer packages to fail unless being installed on a supported Ubuntu release, so you’re going to need an older release which you can find in the release notes for that release.
Download the tarball for Ubuntu.

Unpack the tarball, either with your graphical archive manager or using tar.

$ tar -xJpf amdgpu-pro-*.tar.xz

Install The OpenCL Packages

You’ll need to install a set of packages in order to get OpenCL support. Go to the directory where you unpacked the tarball. You’ll need to use dpkg to install them all separately. These packages need to be installed in a very specific order. Follow the order below.

$ sudo dpkg -i ...
amdgpu-pro-core
libopencl1-amdgpu-pro
clinfo-amdgpu-pro
opencl-amdgpu-pro-icd
amdgpu-pro-dkms
libdrm2-amdgpu-pro
ids-amdgpu-pro
libdrm-amdgpu-pro-amdgpu1

Closing Thoughts

This whole process is needlessly complicated, and AMD should release official support on other platforms. That said, there’s no telling when this will no longer work. For now, though, it’s a decent way to get proper OpenCL support for your AMD card on unsupported distributions.



Comments and Discussions
Linux Forum