HOW-TO · SET
How to install ROCm for AMD GPUs
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
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.listExpected output: Repository entry appended.
Install the ROCm packages.
sudo apt-get update sudo apt-get install -y rocm-llvm rocm-smi rocm-device-libsExpected output: Packages unpacked and DKMS modules built.
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.shExpected output: New shell sessions now include ROCm binaries.
Reboot to load the amdgpu kernel module.
sudo rebootExpected 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.shexplicitly.- Package version conflict — Run
sudo apt-get remove --purge rocm* amdgpu-dkmsbefore reinstalling. /opt/rocm not foundafter 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
amdgpukernel module loaded withlsmod | grep amdgpu.
Related guides
RELATED GUIDES