HOW-TO · SET

How to install ROCm for AMD GPUs

advanced30 minBy Fredoline Eruo
Target environment
Ubuntu 24.04 · Ollama 0.4.xWindows 11 · Ollama 0.4.xmacOS 15 · Ollama 0.4.x
PREREQUISITES

AMD GPU (RX 7000 series or Instinct MI series), Ubuntu 22.04 LTS, root access

What this does

Installs the ROCm (Radeon Open Compute) stack on an Ubuntu host, providing the kernel driver, user-space runtime, and HIP toolchain needed to execute GPU-accelerated workloads on AMD hardware. After completion, frameworks supporting HIP can offload compute to AMD GPUs.

Steps

  1. Add the AMD ROCm repository.

    wget -qO - https://repo.radeon.com/rocm/rocm.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm.gpg
    echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/6.2/ ubuntu main" | sudo tee /etc/apt/sources.list.d/rocm.list
    

    Expected output: Repository entry appended.

  2. Install the ROCm packages.

    sudo apt-get update
    sudo apt-get install -y rocm-llvm rocm-smi rocm-device-libs
    

    Expected output: Packages unpacked and DKMS modules built.

  3. Add ROCm binary paths to the environment.

    echo 'export PATH=/opt/rocm/bin:$PATH' | sudo tee /etc/profile.d/rocm.sh
    source /etc/profile.d/rocm.sh
    

    Expected output: New shell sessions now include ROCm binaries.

  4. Reboot to load the amdgpu kernel module.

    sudo reboot
    

    Expected output: System restarts.

Verification

rocm-smi --showproductname --showdriverversion
# Expected: GPU product name listed, driver version shown

Common failures

  • Fatal error during GPU init — GPU may be in an unsupported PCIe configuration. Verify the card is firmly seated.
  • ROCm installation on kernel version not supported — DKMS driver build failed. Install a compatible kernel LTS branch.
  • GPU not visible after reboot — Secure Boot may block the amdgpu module. Disable Secure Boot in UEFI settings.
  • rocm-smi: command not found — PATH not updated. Source /etc/profile.d/rocm.sh explicitly.
  • Package version conflict — Run sudo apt-get remove --purge rocm* amdgpu-dkms before reinstalling.
  • /opt/rocm not found after install — The install prefix may differ. Check /opt/rocm-* for versioned directories and update PATH accordingly.
  • HIP runtime cannot find GPU — No GPU topology file present. Ensure amdgpu kernel module loaded with lsmod | grep amdgpu.

Related guides

RELATED GUIDES