Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

@Tonymartos
Last active July 26, 2025 11:47
Show Gist options
  • Save Tonymartos/fd502f2a371f68cc8f96b52939d2bad7 to your computer and use it in GitHub Desktop.
Save Tonymartos/fd502f2a371f68cc8f96b52939d2bad7 to your computer and use it in GitHub Desktop.
Mod ollama.service for use a support no-official gpu RX 6700XT

This configuration is for GPUs that are not supported by Ollama by default. In my case, it's an RX 6000 series.

The installation is exclusive to Arch Linux, but the configuration is the same.

Install RoCm from Arch Linux

  • If you have another distro, try to investigate how install rocm, rest is same config
sudo pacman -Syu
sudo pacman -S rocm-core rocm-hip-sdk rocm-opencl-sdk rocm-opencl-runtime

#Optional repository from AUR
paru -S rocm-core rocm-hip-sdk rocm-opencl-runtime

Export enviroment variables in bash or zsh

echo 'export HSA_OVERRIDE_GFX_VERSION=10.3.0' >> ~/.bashrc
echo 'export ROCM_PATH=/opt/rocm' >> ~/.bashrc
echo 'export AMDGPU_TARGETS=gfx1031' >> ~/.bashrc

source ~/.bashrc
---------

echo 'export HSA_OVERRIDE_GFX_VERSION=10.3.0' >> ~/.zshrc
echo 'export ROCM_PATH=/opt/rocm' >> ~/.zshrc
echo 'export AMDGPU_TARGETS=gfx1031' >> ~/.zshrc


source ~/.zshrc

Edit ollama service for set enviroment variables for use gpu

sudo systemctl edit --full ollama.service
[Service]
Environment="HSA_OVERRIDE_GFX_VERSION=10.3.0"
Environment="ROCM_PATH=/opt/rocm"
Environment="AMDGPU_TARGETS=gfx1031"

Reload daemon and ollama

sudo systemctl daemon-reload
sudo systemctl restart ollama
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment