Installing OpenCL Drivers

Installing OpenCL Drivers#

OpenCL 1.2+ must be installed on your desired compute platform to run xcompute-server. An Installable Client Driver (ICD) is required to map the hardware to the OpenCL context.

It is recommended to install ‘clinfo’ first as to always know the OpenCL platform and device state (but it is also bundled with xcompute-server).

sudo apt install clinfo ocl-icd-libopencl1

Once clinfo is installed, often check the OpenCL status:

clinfo

The initial output of clinfo may look something like this:

Number of platforms                               1
  Platform Name                                   NVIDIA CUDA
  Platform Vendor                                 NVIDIA Corporation
  Platform Version                                OpenCL 3.0 CUDA 11.4.158
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_global_int32_base_atomics ...

Note that the correct vendor platform(s) and device(s) appear. If they do not, don’t panic!

Processor vendors (Intel, AMD, NVIDIA, etc) provide the ICD “drivers” for most modern CPUs and GPUs, often available for download on their website and/or through package mananagers and ppa’s.

OpenCL drivers are vendor-specific. If you’ve got a dedicated GPU, you’ll probably want to use that for compute. If you’ve got a many-core CPU and a light-weight VGA adapter, you’ll probably want CPU for compute. Sometimes both works well. There are other types of devices that also support OpenCL (such as FPGA) though those installers aren’t included here (see Xilinx, etc).

AMD’s GPU ICD#

Find and download the latest AMD-GPU-PRO package: https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-30

Navigate to the folder and install from command line with the following options:

./amdgpu-pro-install -y --opencl=rocm

If deploying on a headless compute-only server, it is recommended to include the --headless option to omit graphics drivers.

Following installation, it is necessary to add user xcompute (and/or $LOGNAME) to the video and render groups to enable GPU access:

sudo usermod -a -G video xcompute
sudo usermod -a -G render xcompute

NVIDIA’s GPU ICD#

A good approach is to install the vendor-recommended graphics adapter driver version, and then match the OpenCL installable client driver (ICD).

  1. Add the PPA (personal package archive) for graphics drivers:

sudo add-apt-repository ppa:graphics-drivers/ppa

Note: if add-apt-repository is unavailable, manually add the ppa to: /etc/apt/sources.list

Then update the package lists:

sudo apt update; sudo apt upgrade
  1. Install the NVIDIA driver version NNN via your package manager (names and versions may differ):

sudo apt install nvidia-driver-NNN nvidia-opencl-icd-NNN

For Voltaire- and Amphere-class cards (V100, A100, etc), NNN = 580 has worked. For example:

sudo apt install nvidia-driver-580 nvidia-opencl-icd-580

For legacy cards running older Ubuntu/Debian, NNN = 470 may require special handling:

sudo apt install nvidia-tesla-470-driver nvidia-tesla-470-opencl-icd

Notes:

  • Following installation, a reboot may be in order. Then check clinfo

  • If drivers are not available in your package manager, download via https://www.nvidia.com/drivers.

If you wish to remove old/bad drivers:

sudo apt remove nvidia*
sudo apt purge nvidia*

Intel’s CPU ICD#

Please see https://software.intel.com/en-us/articles/opencl-drivers for more information.

  • Many-core CPU can be used effectively for compute.

  • Mesa compatibility drivers are not recommended.