From f221637053850d62e488501b726d2acfbf43c6b1 Mon Sep 17 00:00:00 2001 From: Bruce MacDonald Date: Tue, 12 Sep 2023 11:04:35 -0400 Subject: [PATCH] first pass at linux gpu support (#454) * linux gpu support * handle multiple gpus * add cuda docker image (#488) --------- Co-authored-by: Michael Yang --- Dockerfile.cuda | 22 ++++++++ api/types.go | 2 +- docs/development.md | 10 ++++ llm/llama.cpp/generate.go | 14 +++-- llm/llama.cpp/generate_darwin_amd64.go | 18 +++--- llm/llama.cpp/generate_darwin_arm64.go | 16 ++++-- llm/llama.cpp/generate_linux.go | 14 +++++ llm/llama.go | 76 +++++++++++++++++++++++++- server/routes.go | 8 +++ 9 files changed, 158 insertions(+), 22 deletions(-) create mode 100644 Dockerfile.cuda create mode 100644 llm/llama.cpp/generate_linux.go diff --git a/Dockerfile.cuda b/Dockerfile.cuda new file mode 100644 index 00000000..3fe68f81 --- /dev/null +++ b/Dockerfile.cuda @@ -0,0 +1,22 @@ +FROM nvidia/cuda:12.2.0-devel-ubuntu22.04 + +WORKDIR /go/src/github.com/jmorganca/ollama +RUN apt-get update && apt-get install -y git build-essential cmake +ADD https://dl.google.com/go/go1.21.1.linux-amd64.tar.gz /tmp/go1.21.1.tar.gz +RUN mkdir -p /usr/local && tar xz -C /usr/local