Radeon Open Compute

From LinuxReviews
Jump to navigationJump to search
Radeon Open Compute (ROCm)
Stable release
4.1 / March 23, 2021; 9 months ago (2021-03-23)
Repositorygithub.com /RadeonOpenCompute/ROCm
Operating systemLinux
TypeGPU compute
Websiterocmdocs.amd.com /en/latest/index.html

Radeon Open Compute (ROCm) is a open source development platform for GPU computing that consists of a variety of frameworks, programming models and tools. The most interesting and practically usable part of ROCm for most home users is the OpenCL support. Mesas Clover implementation is limited to OpenCL 1.2, installing ROCm is a requirement to use anything that requires OpenCL 2.0

ROCm is a complete GPU compute suite with support for a lot more than OpenCL. You can install all parts of it use it for things like OpenMP or just install the few packages you need to get OpenCL 2.0 working.

Supported Platforms

You need a fairly new AMD graphics card or the right graphics card to use ROCm. Some cards within the same older generations are supported while others are not. Newer generation (Vega/Nav) GPUs are supported but APUs are not.

You will need a CPU and motherboard combination with support for PCIe 3.0 with PCIe atomics. You have this if you have a moderately recent computer. You can use any machine with a AMD Ryzen CPU or APU or a Intel i3, i5, i7 or i9 that is Haswell or newer. You can also use AMD Threadripper and EPYC CPUs and newer Intel Xeons. The GPU should be in a slot that is connected to the processors root I/O controller (not the bottom x16 slot on consumer motherboards that is in reality a x4 PCIe slot going through the motherboards chipset). You can check how PCIe devices are connected by running lspci -tv.

AMD ROCm Support
GPU Family ROCm status GPU(s) Generation
HAWAII Dialog-ok.svg
  • AMD Radeon R9 390X
  • FirePro W9100
FIJI Dialog-ok.svg
  • Radeon R9 Fury
  • Radeon R9 Nano
  • Radeon R9 Fury X
  • Radeon Pro Duo (Fiji)
  • FirePro S9300 X2
  • Radeon Instinct MI8
POLARIS10, POLARIS11, POLARIS12 Dialog-ok.svg
  • Radeon RX 470
  • Radeon RX 480
  • Radeon RX 570
  • Radeon RX 580
  • Radeon Pro Duo (Polaris)
  • Radeon Pro WX 5100
  • Radeon Pro WX 7100
  • Radeon Instinct MI6
POLARIS11 Dialog-ok.svg
  • Radeon RX 460
  • Radeon RX 560
  • Radeon Pro WX 4100
POLARIS12 Dialog-ok.svg
  • Radeon RX 540
  • Radeon RX 550
  • Radeon Pro WX 2100
  • Radeon Pro WX 3100
VEGA10 Dialog-ok.svg
  • Radeon RX Vega 56
  • Radeon RX Vega 64
  • Radeon Vega Frontier Edition
  • Radeon Pro WX 8200
  • Radeon Pro WX 9100
  • Radeon Pro V340
  • Radeon Pro V340 MxGPU
  • Radeon Instinct MI25
VEGA12, VEGA20 ("Vega 7nm") Dialog-ok.svg
  • Radeon VII
  • Radeon Instinct MI50
  • Radeon Instinct MI60
  • Vega Workstation (Vega20 GL-XE)
RAVEN, RENOIR Dialog-cancel.svg gfx9
NAVI10, NAVI14 Dialog-cancel.svg gfx10
CICHLID, FLOUNDER, VANGOGH Blond-anime-girl-with-red-questionmark.png gfx10.3
A CPU with PCIe Gen3 + PCIe Atomics is required (AMD Ryzen CPUs/APUs, EPYC CPUs, Intel Xeon E7 v3+, Intel Xeon E5 v3+, Intel Xeon E3 v3+, Haswell family or newer Core i3/i5/i7/i9).

You will ideally want Linux kernel 5.6 or newer. The amdkfd driver in kernels prior to 5.6 limits the GPUs system memory use to 3/8ths of total memory. 5.6+ allows the GPU to use up to 15/16ths.


ROCm supports a rather limited number of GNU/Linux distributions. AMD officially only supports:

  • Ubuntu 20.04 and 18.04.4
  • CentOS 7.8 & RHEL 7.8
  • CentOS 8.2 & RHEL 8.2
  • SLES 15 SP1

This is unfortunate because compiling ROCm is a problem (to put it mildly). You can, luckily, get the packages to work on non-supported distributions.

You must use the amdgpu kernel module for your AMD GPU/APU (radeon will not work) and your kernel must be compiled with CONFIG_HSA_AMD=y or m ("HSA kernel driver for AMD GPU devices").

The ROCm GitHub Page has instructions for the "supported" distributions. You should install the rock-dkms package if you are installing on a system with a Linux kernel <=5.4. Do not install it if you are using a newer kernel.

Fedora 32/33, OpenCL only

Kemonomimi rabbit.svg
Note: Following these simple steps will give you OpenCL 2.2 support so you can use OpenCL 2.x applications. You will need additional packages such as AOMP (A custom LLVM build) to use things like OpenMP.

First, add the "yum" ROCm repository meant for RHEL:

echo '[ROCm]
gpgcheck=1' > /etc/yum.repos.d/rocm.repo

Next, add the GnuPG key used to sign the packages in that repository (or switch to gpgcheck=0 in rocm.repo if you want to live dangerously):

rpmkeys --import http://repo.radeon.com/rocm/rocm.gpg.key

You can, and probably should, eradicate all other OpenCL implementations from your system before you proceed to installing ROCm:

dnf -y remove hsakmt pocl beignet  mesa-libOpenCL

You can now proceed with installing the actual ROCm packages you need:

dnf -y install hsakmt-roct npth-devel hsa-ext-rocr-dev rocm-utils rocm-opencl rocm-opencl-devel hip-base

ROCm (3.8.0, anyway) is installed to /opt/rocm-3.8.0/ and the OpenCL library required by the OpenCL .icd file it installs is placed in /opt/rocm-3.8.0/opencl/lib/libamdocl64.so. That is not in the regular library path so it will not be found when you run clinfo or other applications trying to use OpenCL. This is actually a minor problem that can be fixed with a simple

echo /opt/rocm-3.8.0/opencl/lib/libamdocl64.so > /etc/OpenCL/vendors/amdocl64_30700.icd

That's it. Running clinfo (provided by a system package called clinfo, you likely have it) should now show Platform Name: AMD Accelerated Parallel Processing and a whole lot of incriminating information about your graphics card.

Software Tweaks

All the LuxMark 3.1 benchmarks fail to render correctly if OpenCL Compiler Options ▸ -d-fast-relaxed-math is enabled.


ROCm makes the screen, or all screens, blink every time it's used. Just running clinfo makes the screen blink.

Testing If ROCm Is Working

The very simple program clpeak, available as a package with that name, can be used to test if it is actually working. clpeak is a OpenCL benchmarking program. It will test Global memory bandwidth (GBPS), Single-precision compute (GFLOPS), half-precision compute (GFLOPS), Double-precision compute (GFLOPS) and Integer compute (GIOPS) and print a list such as

Platform: AMD Accelerated Parallel Processing
  Device: gfx803
    Driver version  : 3182.0 (HSA1.1,LC) (Linux x64)
    Compute units   : 32
    Clock frequency : 1268 MHz

    Global memory bandwidth (GBPS)
      float   : 143.32
      float2  : 145.39
      float4  : 151.33
      float8  : 152.71
      float16 : 129.04

    Single-precision compute (GFLOPS)
      float   : 4910.25
      float2  : 4352.29
      float4  : 4490.20
      float8  : 3740.20
      float16 : 3353.13
(..and more)

See also

Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.