desko: ollama: fix/re-enable GPU acceleration

This commit is contained in:
2025-07-24 02:12:20 +00:00
parent 4d20be490a
commit d54eff32a7
2 changed files with 9 additions and 5 deletions

View File

@@ -53,6 +53,5 @@
# needed to use libimobiledevice/ifuse, for iphone sync
services.usbmuxd.enable = true;
# TODO(2025-01-01): re-enable once rocm build is fixed: <https://github.com/NixOS/nixpkgs/pull/367695>
# hardware.amdgpu.opencl.enable = true; # desktop (AMD's opencl implementation AKA "ROCM"); probably required for ollama
hardware.amdgpu.opencl.enable = true; # desktop (AMD's opencl implementation AKA "ROCM"); probably required for ollama
}

View File

@@ -11,8 +11,13 @@
#
# models are defined e.g. here: <https://ollama.com/library/llama3.2:3b/blobs/dde5aa3fc5ff>
#
# TODO: enable ShellGPT integration?
# - <https://github.com/TheR1D/shell_gpt?tab=readme-ov-file#docker--ollama>
### to confirm GPU acceleration
# grep `journalctl -u ollama` for:
# - `looking for compatible GPUs`
# and see if it says anything bad afterward like:
# - `no compatible GPUs were discovered`
# then run a model and check for:
# `offloading <n> repeating layers to GPU`
{ config, lib, pkgs, ... }:
let
cfg = config.sane.services.ollama;
@@ -89,7 +94,7 @@ in
# these acceleration settings are relevant to `desko`.
services.ollama.acceleration = lib.mkIf config.hardware.amdgpu.opencl.enable "rocm"; # AMD GPU acceleration (achieves the same as `nixpkgs.config.rocmSupport = true` but just for ollama (the global toggle rebuilds the world))
services.ollama.rocmOverrideGfx = "10.1.0"; #< `nix-shell -p "rocmPackages.rocminfo" --run "rocminfo" | grep "gfx"` (e.g. gfx1010)
# services.ollama.environmentVariables.HCC_AMDGPU_TARGET = "gfx1010"; # seems to be unnecessary
services.ollama.environmentVariables.HCC_AMDGPU_TARGET = "gfx1010";
users.groups.ollama = {};