Friday, May 3, 2019

ROCm OpenCL with openSUSE Tumbleweed

EDIT 2022:

Follow the latest doc instead: https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.4/page/How_to_Install_ROCm.html

EDIT 20200622:
With ROCm 3.5, the easiest way is to use zypper.

- Add repository:
sudo zypper addrepo --no-gpgcheck http://repo.radeon.com/rocm/zyp/zypper/ rocm
sudo zypper ref

- Install packages:
sudo zypper in rocm-opencl3.5.0 hsa-ext-rocr-dev3.5.0

- Update lib path (if necessary). ROCm 3.5 is installed under "/opt/rocm-3.5.x". Create a symbolic link "/opt/rocm -> /opt/rocm-3.5.1". Check the lib path in /etc/ld.so.conf.d and make sure these are listed

  - /opt/rocm/lib
  - /opt/rocm/lib64
  - /opt/rocm/hsa/lib
  - /opt/rocm/opencl/lib

If not, create a new file (e.g. rocm.conf) and add the above paths.  Then run "sudo ldconfig".

Run both "/usr/bin/clinfo" and "/opt/rocm/opencl/bin/clinfo" to check if OpenCL is working.



EDIT 20200110:
(0) As of 2020-01-05, running "clinfo" with openSUSE Tumbleeweed 20200103 and these  ROCm packages will cause null pointer dereference errors.
(0) Things are working again with Tumbleeweed 20200108.
(1) The user needs to be member of the "video" group.  Run this command to add yourself to the group "sudo usermod -a -G video $LOGNAME"
(2) The site now has RPM packages for openSUSE.  Go the http://repo.radeon.com/rocm/zyp/zypper/ to download the packages instead.  Also, no need to specify "--nodeps" when installing the packages

- - 8< - - -


With Tumbleweed running Linux kernel 5.0, it is easy to install ROCm OpenCL with upstream kernel.

- Go to http://repo.radeon.com/rocm/zyp/zypper/ and download the latest version of following packages:

hsakmt-roct
hsa-rocr-dev
rocm-opencl
rocm-opencl-devel
rocminfo-1.0.0

(EDIT 20200126) With ROCm 3.0, you also need to install these packages (due to an issue):
comgr
rocm-smi-lib64

- Install them without checking dependencies, assuming you already have libc etc packages installed, e.g.:

sudo rpm -ivh comgr-1.6.0.121-cbb02f9-Linux.rpm hsakmt-roct-1.0.9-319-g02e2b30.x86_64.rpm hsa-rocr-dev-1.1.30100.0-local-build-ecafeba1-Linux.rpm rocm-opencl-2.0.0--8f28d95ad-Linux.rpm rocm-opencl-devel-2.0.0--8f28d95ad-Linux.rpm rocm-smi-lib64-2.2.0.8.local-build-0-a246aac.rpm rocminfo-1.0.0.0.local_build-0-a134847.rpm

- That's it! Optionally, install clinfo with zypper to check the available platforms.  Or you can just use the one installed by rocminfo (under /opt/rocm*/bin). If you have been using Mesa OpenCL, you may want to uninstall it.

7 comments:

Unknown said...

This is not working.

I can't see any openCL in Blender or with hashcat.

Anonymous said...

Thanks for posting this helpful ROCm on Tumbleweed guide! It works in LibreOffice with your mentioned corrections.

Hans said...

Thank you for your information.
Saly I get no device listed in clinfo (have a RX560):

Number of platforms 1
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.0 AMD-APP (3137.0)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback
Platform Extensions function suffix AMD

Platform Name AMD Accelerated Parallel Processing
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

I do not have AMDGPU-PRO installed. Is this required?
Any ideas.

Thank you in advance!

Clarence said...

i also don't have amdgpu-pro. Just using the open source amdgpu.

Make sure you have amdgpu module loaded. Also, check that you have kernel-firmware-amdgpu and xf86-video-amdgpu installed.

Xakkep9000 said...

you mean an rock-dkms?
The amdgpu Linux kernel driver

Xakkep9000 said...

1st check if clinfo shows opencl device under sudo
sudo clinfo

if so, you should do:
1. add current user to usergroup 'video'
2. Add next line to /etc/udev/rules.d/60-kfd-opencl.rules
KERNEL=="kfd", MODE="0660", GROUP="video"

3. reboot

now clinfo sees opencl device under normal user!

Anonymous said...

This worked like a charm for my Radeon VII! Thanks so much for posting!!