ROCm installation guide for Linux

ROCm installation guide for Linux

If you’re exploring AI, machine learning, or GPU-accelerated computing with an AMD GPU, installing ROCm is essential. However, setting it up on Linux can be quite tricky if you don’t know what you’re doing. This guide aims to simplify the process, making it easier to get ROCm up and running. Also, AMD treats ROCm documentation like an unwanted child, it’s horrible. There are like three or four different pages with completely different methods for ROCm driver installation just for Ubuntu. So, it can be quite hard to navigate through those.

A little side note: while AMD officially supports only the Radeon RX 7900 XTX, Radeon RX 7900 XT, Radeon RX 7900 GRE, and Radeon VII GPUs, ROCm generally works with most modern AMD GPUs. [source]

ROCm installation on Ubuntu

First of all, let’s check if you have a supported Ubuntu version installed (e.g. Jammy Jellyfish or Noble Numbat). Once you verified that you have a supported Ubuntu version, you can get to actually installing ROCm. This is the same process that you should follow when using Distrobox.

First, update your package list, then download and install the amdgpu-install package, then use amdgpu-install to get ROCm. (Check the latest version of amdgpu-install here and use wget to download it.)

ROCm installation on Arch

You’ll need the following packages: rocm-hip-sdk and rocm-opencl-sdk. To install them, you can use:

(While these packages are available in the official Extra repositories, I’m using an AUR helper here.)

Alternative method

If the previous method for Arch doesn’t work, you might want to try this method instead.

You can use Distrobox with Podman or Docker to use Ubuntu 22.04 Jammy Jellyfish “inside of” Arch since Ubuntu 22.04 is officially supported by AMD for ROCm. Once you have Distrobox installed with either Podman or Docker, you can create a Distrobox instance with the ubuntu:22.04 image using:

This will create an instance called “rocm.” After it completes, you can enter the instance with:

After these steps, you can go back to the “ROCm installation on Ubuntu” part and follow the steps there. Additionally, if you’re using Docker, you have to add your user to the docker group to be able to use Docker without root (which doesn’t work with Distrobox). You can use the following to do that:

sudo usermod -aG docker $USER

ROCm installation on Fedora

You’ll need the following packages: rocm-opencl, rocm-hip and rocminfo (*optional). To install them you can use:

If you’re using anything below Fedora 38, you might have to use - enable-repo=updates-testing as another parameter.

Configuring environment variables

Next, set up the necessary environment variables for ROCm.

A little side note: as far as I know, configuring the ROCM_PATH environment variable is only needed on Arch Linux and no other distributions.

Open your ~/.bashrc in your preferred text editor and add these lines (for Radeon RX 7xxx or other RDNA3 GPUs):

If you’re using a Radeon RX 6xxx series GPU or any other RDNA / RDNA2 GPU, set HSA_OVERRIDE_GFX_VERSION to 10.3.0.

Add your user to the video group

For non-root users to access GPU resources, they need to be a part of the video group. You can add your current user to the video group by using:

Verify ROCm driver installation

If everything is installed correctly, running rocminfo should return an agent with your GPU information (and possibly another agent with your CPU information too), confirming that the drivers are working. On some distributions (e.g. Arch), rocminfo might not run out of the box and you need to run /opt/rocm/bin/rocminfo instead.


Written by SaynedBread. No contact information :).

Categories: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *