Install ROCm driver on ubuntu 18.04

1 minute read


You can following the installation manual

The OS used is ubuntu 18.04 with kernel 4.15.0-48-generic

update system

sudo apt update
sudo apt dist-upgrade
sudo apt install libnuma-dev
sudo reboot

Add the ROCm apt repository

wget -qO - | sudo apt-key add -
echo 'deb [arch=amd64] xenial main' | sudo tee /etc/apt/sources.list.d/rocm.list

install rocm

sudo apt update
sudo apt install rocm-dkms
sudo apt-get install dkms rock-dkms rocm-opencl-dev

add current user to the video group

sudo usermod -a -G video $LOGNAME 

echo 'ADD_EXTRA_GROUPS=1' | sudo tee -a /etc/adduser.conf
echo 'EXTRA_GROUPS=video' | sudo tee -a /etc/adduser.conf

export path in ~/.bashrc

  export PATH=$PATH:/opt/rocm/bin
  export PATH=$PATH:/opt/rocm/opencl/include
  export PATH=$PATH:/opt/rocm/opencl/bin/x86_64
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib:/opt/rocm/opencl/lib/x86_64:/opt/rocm/hip/lib
  export AMDAPPSDKROOT=/opt/rocm/opencl

test basic installation


Issue 1 : dkms.conf missing

leiming@pangu:~$ dkms status
amdgpu, 2.3-14, 4.15.0-48-generic, x86_64: installedError! Could not locate dkms.conf file.
File:  does not exist.

find out which amdgpu driver is available

leiming@pangu:/var/lib/dkms/amdgpu/2.3-14/4.15.0-48-generic/x86_64/log$ locate dkms.conf  | grep amd

add amdgpu to driver

sudo dkms add -m amdgpu -v 2.0-89

Issue 2 : clinfo error

Error Message

leiming@pangu:~$ /opt/rocm/opencl/bin/x86_64/clinfo 
ERROR: clGetPlatformIDs(-1001)

check icd file

leiming@pangu:~/files_on_pangu/test_rocm/clARMOR/tests/good_cl_mem$ for i in `ls -1 /etc/OpenCL/vendors`; do echo -n "$i : "; cat /etc/OpenCL/vendors/$i; done
nvidia.icd :

add the missing amdocl64.icd

echo '' | sudo tee /etc/OpenCL/vendors/amdocl64.icd

check again using clinfo


It should print the gpu info on the platform.

For additional tests

Please refer to this post :