[PR #454] [MERGED] first pass at linux gpu support #36031

Closed
opened 2026-04-22 20:45:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/454
Author: @BruceMacD
Created: 9/1/2023
Status: Merged
Merged: 9/12/2023
Merged by: @BruceMacD

Base: mainHead: brucemacd/linux-gpu


📝 Commits (6)

📊 Changes

9 files changed (+158 additions, -22 deletions)

View changed files

Dockerfile.cuda (+22 -0)
📝 api/types.go (+1 -1)
📝 docs/development.md (+10 -0)
📝 llm/llama.cpp/generate.go (+8 -6)
📝 llm/llama.cpp/generate_darwin_amd64.go (+11 -7)
📝 llm/llama.cpp/generate_darwin_arm64.go (+10 -6)
llm/llama.cpp/generate_linux.go (+14 -0)
📝 llm/llama.go (+74 -2)
📝 server/routes.go (+8 -0)

📄 Description

This is the basic implementation of enabling a linux build with GPU support.

Building for Linux with CPU support is unchanged (generate and build as normal).

Building for Linux with GPU requires generating with the gpu tag. This is to allow non-GPU linux builds to continue to be built locally without issue.

How to build/run:

  • generate the required dependencies: go generate ./...
  • build the binary go build .
    and run as normal:
    ./ollama serve &
    ./ollama run llama2

Follow up:

  • Packaging nvidia drivers or downloading them automatically
  • Better heuristics for determining the number of layers to load into GPU

Part of #259


🔄 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/454 **Author:** [@BruceMacD](https://github.com/BruceMacD) **Created:** 9/1/2023 **Status:** ✅ Merged **Merged:** 9/12/2023 **Merged by:** [@BruceMacD](https://github.com/BruceMacD) **Base:** `main` ← **Head:** `brucemacd/linux-gpu` --- ### 📝 Commits (6) - [`63c5115`](https://github.com/ollama/ollama/commit/63c5115f0c4a89d5ee245527781271c90701f850) linux gpu support - [`5e672ce`](https://github.com/ollama/ollama/commit/5e672ce7240acaf7d3f85350f59119417c2329e5) handle multiple gpus - [`86be0f1`](https://github.com/ollama/ollama/commit/86be0f1d110c80607a57c636bd933e7daeac6067) Update generate_linux.sh - [`7709c0c`](https://github.com/ollama/ollama/commit/7709c0c0f9d0acf0e3ecb7a1bc1af218a325404d) add cuda docker image (#488) - [`e6093f7`](https://github.com/ollama/ollama/commit/e6093f7ab56f0e33d91c98b5c33af0fec0f342a8) use total gpu memory - [`f1aab4f`](https://github.com/ollama/ollama/commit/f1aab4f551cfe17cd9c1ca8652765692885ae0bc) Update development.md ### 📊 Changes **9 files changed** (+158 additions, -22 deletions) <details> <summary>View changed files</summary> ➕ `Dockerfile.cuda` (+22 -0) 📝 `api/types.go` (+1 -1) 📝 `docs/development.md` (+10 -0) 📝 `llm/llama.cpp/generate.go` (+8 -6) 📝 `llm/llama.cpp/generate_darwin_amd64.go` (+11 -7) 📝 `llm/llama.cpp/generate_darwin_arm64.go` (+10 -6) ➕ `llm/llama.cpp/generate_linux.go` (+14 -0) 📝 `llm/llama.go` (+74 -2) 📝 `server/routes.go` (+8 -0) </details> ### 📄 Description This is the basic implementation of enabling a linux build with GPU support. Building for Linux with CPU support is unchanged (generate and build as normal). Building for Linux with GPU requires generating with the `gpu` tag. This is to allow non-GPU linux builds to continue to be built locally without issue. How to build/run: - generate the required dependencies: `go generate ./...` - build the binary `go build .` and run as normal: `./ollama serve &` `./ollama run llama2` Follow up: - Packaging nvidia drivers or downloading them automatically - Better heuristics for determining the number of layers to load into GPU Part of #259 --- <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-22 20:45:13 -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#36031