Skip to content

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

log: warn if user overrides detected (#13088)

Daniel Hiltgen72ff5b9d8c7a
diff --git a/discover/runner.go b/discover/runner.go
index bf2110bc7..6ce37ef66 100644
--- a/discover/runner.go
+++ b/discover/runner.go
@@ -65,6 +65,10 @@ func GPUDevices(ctx context.Context, runners []ml.FilteredRunnerDiscovery) []ml.
}
slog.Info("discovering available GPUs...")
+
+ // Warn if any user-overrides are set which could lead to incorrect GPU discovery
+ overrideWarnings()
+
requested := envconfig.LLMLibrary()
jetpack := cudaJetpack()
@@ -449,3 +453,24 @@ func bootstrapDevices(ctx context.Context, ollamaLibDirs []string, extraEnvs map
return devices
}
+
+func overrideWarnings() {
+ anyFound := false
+ m := envconfig.AsMap()
+ for _, k := range []string{
+ "CUDA_VISIBLE_DEVICES",
+ "HIP_VISIBLE_DEVICES",
+ "ROCR_VISIBLE_DEVICES",
+ "GGML_VK_VISIBLE_DEVICES",
+ "GPU_DEVICE_ORDINAL",
+ "HSA_OVERRIDE_GFX_VERSION",
+ } {
+ if e, found := m[k]; found && e.Value != "" {
+ anyFound = true
+ slog.Warn("user override visible devices", k, e.Value)
+ }
+ }
+ if anyFound {
+ slog.Warn("if GPUs are not correctly discovered, unset and try again")
+ }
+}