From 5f9f312bdb8abb468901b6165c575240a3257301 Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Wed, 24 Sep 2025 16:25:56 -0700 Subject: [PATCH] fix - give bootstrapping more time on slow systems --- discover/runner.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/discover/runner.go b/discover/runner.go index 610b97f22..4c78b0bfe 100644 --- a/discover/runner.go +++ b/discover/runner.go @@ -78,13 +78,6 @@ func GPUDevices(ctx context.Context, runners []FilteredRunnerDiscovery) []ml.Dev libDirs[""] = struct{}{} } - // Typically bootstrapping takes < 1s, but on some systems, with devices - // in low power/idle mode, initialization can take multiple seconds. We - // set a long timeout just for bootstrap discovery to reduce the chance - // of giving up too quickly - ctx1stPass, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() - slog.Info("discovering available GPUs...") // For our initial discovery pass, we gather all the known GPUs through @@ -100,6 +93,13 @@ func GPUDevices(ctx context.Context, runners []FilteredRunnerDiscovery) []ml.Dev } else { dirs = []string{LibOllamaPath, dir} } + // Typically bootstrapping takes < 1s, but on some systems, with devices + // in low power/idle mode, initialization can take multiple seconds. We + // set a long timeout just for bootstrap discovery to reduce the chance + // of giving up too quickly + ctx1stPass, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + // For this pass, we retain duplicates in case any are incompatible with some libraries devices = append(devices, bootstrapDevices(ctx1stPass, dirs, nil)...) }