Skip to content

Instantly share code, notes, and snippets.

@furaar
Created August 2, 2024 15:12
Show Gist options
  • Save furaar/ee05a5ef673302a8e653863b6eaedc90 to your computer and use it in GitHub Desktop.
Save furaar/ee05a5ef673302a8e653863b6eaedc90 to your computer and use it in GitHub Desktop.
Step-by-step guide to install AMD ROCm on Ubuntu with RX6600 GPU. Includes setting up Ollama and running Llama 3.1 model. Perfect for machine learning and GPU-heavy tasks!

AMD ROCm Installation Guide on RX6600 + Ollama

System Information

            .-/+oossssoo+/-.               x@furaar 
        `:+ssssssssssssssssss+:`           -------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.4 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: redacted 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 6.5.0-45-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 2 hours, 40 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 1820 (dpkg), 11 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.1.16 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 2560×1440
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: GNOME 42.9 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Adwaita 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Yaru-blue-dark [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Yaru-blue [GTK2/3] 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: gnome-terminal 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: AMD Ryzen 9 6900HX with Radeon  
    .ossssssssssssssssssdMMMNysssso.       GPU: AMD ATI Radeon RX 6600/6600 XT/ 
      -+sssssssssssssssssyyyssss+-         GPU: AMD ATI e8:00.0 Rembrandt 
        `:+ssssssssssssssssss+:`           Memory: 4023MiB / 31356MiB 
            .-/+oossssoo+/-.                            

Install Essentials and Monitoring Tool

sudo apt update && sudo apt upgrade
sudo apt-get install neofetch htop wget curl

Install the Latest Supported Kernel

sudo apt install linux-image-generic
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt install grub-customizer
  • Launch Grub Customizer from Activities.
  • Go to the General tab
  • Set default entry > predefined field to Advanced options for Ubuntu > Ubuntu, with Linux x.x.x-x-generic
  • Save changes and sudo reboot

Ensure to boot into the configured kernel at the boot menu.

Install latest linux headers

sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"

ROCM Installation

Add Current and Future Users to Render and Video Groups

sudo usermod -a -G render,video $LOGNAME
echo 'ADD_EXTRA_GROUPS=1' | sudo tee -a /etc/adduser.conf
echo 'EXTRA_GROUPS=video' | sudo tee -a /etc/adduser.conf
echo 'EXTRA_GROUPS=render' | sudo tee -a /etc/adduser.conf

Update Repositories and Fetch the AMDGPU Package

sudo apt update
wget https://repo.radeon.com/amdgpu-install/6.1.3/ubuntu/focal/amdgpu-install_6.1.60103-1_all.deb
sudo apt install ./amdgpu-install_6.1.60103-1_all.deb

Run the AMDGPU Installer

sudo amdgpu-install --no-dkms --usecase=hiplibsdk,rocm
sudo rocminfo
sudo reboot

Set Environment Variables to Bypass Unsupported Hardware Errors

HSA_OVERRIDE_GFX_VERSION=10.3.0
HIP_VISIBLE_DEVICES=1

Install ollama

curl -fsSL https://ollama.com/install.sh | sh

Edit the Ollama Service File

sudo nano /etc/systemd/system/ollama.service

Add these lines under the existing Environment key:

Environment="HSA_OVERRIDE_GFX_VERSION=10.3.0"
Environment="ROCR_VISIBLE_DEVICES=0"

Reload the daemon and Ollama service:

sudo systemctl daemon-reload
sudo systemctl restart ollama

Install and Run Llama3.1 Model

ollama run llama3.1

Monitor GPU Usage

watch -n 1 rocm-smi

Uninstall AMDGPU Install

amdgpu-install --uninstall
@afrolino02
Copy link

afrolino02 commented Jan 31, 2025

Star, because, my ollama was slow and I didn't install ROCM, thanks for the explaination.

@lancediarmuid
Copy link

Thanks!

@Stmsmj
Copy link

Stmsmj commented Mar 15, 2025

when i run "sudo amdgpu-install --no-dkms --usecase=hiplibsdk,rocm" it shows this error
"The following packages have unmet dependencies:
hipsolver : Depends: libcholmod3 but it is not installable
Depends: libsuitesparseconfig5 but it is not installable
rocm-gdb : Depends: libtinfo5 but it is not installable
Depends: libncurses5 but it is not installable
Depends: libpython3.10 but it is not installable or
libpython3.8 but it is not installable
E: Unable to correct problems, you have held broken packages."


i fixed the probelm. i used "sudo apt install amdgpu-dkms rocm" in docs and didnt show this error.

im on mint 22.

another thing i say idk if it helps anybody is if you use mint 22 instead of "sudo apt install grub-customizer" you gotta do "sudo apt-get install grub-customizer"

@haitub4
Copy link

haitub4 commented Mar 23, 2025

It says ROCk module is NOT loaded, possibly no GPU devices when I run rocminfo, I'm using WSL 2

@furaar
Copy link
Author

furaar commented Mar 23, 2025

It says ROCk module is NOT loaded, possibly no GPU devices when I run rocminfo, I'm using WSL 2

ROCm/ROCm#1361
ollama/ollama#5275

I don't think WSL 2 is supported yet and tickets have been open since early 2024. I would suggest you create a new partition on your drive, install ubuntu on it and follow this guide again. This solution is janky as it is, I wouldn't complicate things with WSL.

@furaar
Copy link
Author

furaar commented Mar 23, 2025

when i run "sudo amdgpu-install --no-dkms --usecase=hiplibsdk,rocm" it shows this error "The following packages have unmet dependencies: hipsolver : Depends: libcholmod3 but it is not installable Depends: libsuitesparseconfig5 but it is not installable rocm-gdb : Depends: libtinfo5 but it is not installable Depends: libncurses5 but it is not installable Depends: libpython3.10 but it is not installable or libpython3.8 but it is not installable E: Unable to correct problems, you have held broken packages."

i fixed the probelm. i used "sudo apt install amdgpu-dkms rocm" in docs and didnt show this error.

im on mint 22.

another thing i say idk if it helps anybody is if you use mint 22 instead of "sudo apt install grub-customizer" you gotta do "sudo apt-get install grub-customizer"

thanks! Yea i tested it on Ubuntu 22.04, glad it worked out on Mint 22

@wuhanpneumonia
Copy link

It says ROCk module is NOT loaded, possibly no GPU devices when I run rocminfo, I'm using WSL 2

I installed rocm successfully in ubuntu. but never work through wsl2. it wasted me 2 days.
I don't think adrenaline support rx6600 or other old gpu on wsl2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment