HON’s Wiki # ROCm

Home / High-Performance Computing (HPC)

Contents

AMD ROCm (Radeon Open Compute), for programming AMD GPUs. AMD’s alternative to NVIDIA’s CUDA toolkit. It uses the runtime API and kernel language HIP, which is compilable for both AMD and NVIDIA GPUs.

Resources

Setup (Debian/Ubuntu)

Updated for ROCm 5.0.

  1. If the amdgpu-pro driver is installed then uninstall it to avoid conflicts.
  2. If using Mellanox ConnectX NICs then Mellanox OFED must be installed before ROCm.
  3. Add the ROCm package repo:
    1. Install requirements: sudo apt install curl libnuma-dev wget gnupg2
    2. Add repo key: curl -sSf https://repo.radeon.com/rocm/rocm.gpg.key | sudo gpg --dearmor --output /usr/share/keyrings/rocm.gpg
    3. Add AMDGPU repo: echo 'deb [signed-by=/usr/share/keyrings/rocm.gpg arch=amd64] https://repo.radeon.com/amdgpu/latest/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/amdgpu.list
    4. Add ROCm repo: echo 'deb [signed-by=/usr/share/keyrings/rocm.gpg arch=amd64] https://repo.radeon.com/rocm/apt/debian/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list
    5. Update cache: sudo apt update
  4. Install extras: sudo apt install mesa-common-dev clang comgr
  5. Install kernel-mode GPU driver: sudo apt install amdgpu-dkms
  6. Install desired ROCm meta-packages: sudo apt install <meta-packages>
    • For basics: rocm-language-runtime rocm-developer-tools rocm-llvm
    • For HIP: rocm-hip-runtime rocm-hip-libraries rocm-hip-sdk
    • For OpenCL: rocm-opencl-runtime rocm-opencl-sdk
    • For OpenMP: rocm-openmp-sdk
    • For ML: rocm-ml-sdk rocm-ml-libraries
    • Note: ROCm depends on python, which in Ubuntu installs python-is-python2.
  7. Add ROCm to PATH: echo 'export PATH=$PATH:/opt/rocm/bin:/opt/rocm/opencl/bin' | sudo tee /etc/profile.d/rocm.sh (relog to reload)
  8. Add yourself to the relevant groups to use ROCm: sudo usermod -aG video,render <username>
    • For every user that needs access to the device!
  9. Reboot.
  10. Verify AMDGPU DKMS install: sudo dkms status
  11. Verify ROCm install: rocminfo
    • This should show you AMD GPU as an agent (and also you AMD CPU if you have one).
  12. (Optional) Verify HIP: See HIP.

Usage and Tools

AMD GPUs


hon.one | HON95/wiki | Edit page