[PR #15092] Set runner subprocess working directory to temp dir for GPU discovery #61713

Open
opened 2026-04-29 16:44:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15092
Author: @moktamd
Created: 3/27/2026
Status: 🔄 Open

Base: mainHead: fix/gpu-discovery-cwd


📝 Commits (1)

  • 4999b73 Set working directory for runner subprocess to temp dir

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 llm/server.go (+1 -0)

📄 Description

Fixes #15079

When ollama runs as a service user (e.g. www-data) and the current working directory is inaccessible, GPU discovery silently fails because the runner subprocess inherits the parent's cwd. CUDA initialization accesses the working directory for JIT kernel cache and fails when it can't write there.

Sets cmd.Dir to os.TempDir() so the runner process always starts in an accessible directory.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15092 **Author:** [@moktamd](https://github.com/moktamd) **Created:** 3/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/gpu-discovery-cwd` --- ### 📝 Commits (1) - [`4999b73`](https://github.com/ollama/ollama/commit/4999b732ca582ed7a4792c1cfc62b9fc0bbb2f40) Set working directory for runner subprocess to temp dir ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `llm/server.go` (+1 -0) </details> ### 📄 Description Fixes #15079 When ollama runs as a service user (e.g. www-data) and the current working directory is inaccessible, GPU discovery silently fails because the runner subprocess inherits the parent's cwd. CUDA initialization accesses the working directory for JIT kernel cache and fails when it can't write there. Sets `cmd.Dir` to `os.TempDir()` so the runner process always starts in an accessible directory. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-29 16:44:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#61713