Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

Add ollama executable peer dir for rocm

Daniel Hiltgen00ec26932114
diff --git a/gpu/amd_linux.go b/gpu/amd_linux.go
index 25f9128f3..4d95f3149 100644
--- a/gpu/amd_linux.go
+++ b/gpu/amd_linux.go
@@ -287,6 +287,21 @@ func AMDValidateLibDir() (string, error) {
return rocmTargetDir, nil
}
+ // next to the running binary
+ exe, err := os.Executable()
+ if err == nil {
+ peerDir := filepath.Dir(exe)
+ if rocmLibUsable(peerDir) {
+ slog.Debug("detected ROCM next to ollama executable " + peerDir)
+ return rocmTargetDir, setupLink(peerDir, rocmTargetDir)
+ }
+ peerDir = filepath.Join(filepath.Dir(exe), "rocm")
+ if rocmLibUsable(peerDir) {
+ slog.Debug("detected ROCM next to ollama executable " + peerDir)
+ return rocmTargetDir, setupLink(peerDir, rocmTargetDir)
+ }
+ }
+
// Well known ollama installer path
installedRocmDir := "/usr/share/ollama/lib/rocm"
if rocmLibUsable(installedRocmDir) {