Source Code Compilation and Build
Obtain the Ollama source code, build the CUDA 13 acceleration library and Ollama command line program from the source code, and install the local build products.
- Obtain the Ollama 0.19.0 source code.
1 2
git clone --branch v0.19.0 --depth 1 https://github.com/ollama/ollama.git
- Build the CUDA 13 acceleration library from the source code.
1 2 3 4 5 6 7 8 9 10
cd ollama export CUDA_HOME=/usr/local/cuda-13.0 export PATH=/usr/local/go/bin:$CUDA_HOME/bin:$PATH export LD_LIBRARY_PATH=$CUDA_HOME/lib64:${LD_LIBRARY_PATH:-} cmake -B build --preset "CUDA 13" \ -DCMAKE_CUDA_ARCHITECTURES=80 \ -DCMAKE_CUDA_FLAGS="-t 1" cmake --build build --preset "CUDA 13" --parallel 8 cmake --install build --component CUDA --prefix /tmp/ollama-build
- Build the Ollama command line program from the source code.
1 2
go build -trimpath -ldflags "-X github.com/ollama/ollama/version.Version=0.19.0" \ -o /tmp/ollama-build/ollama .
- Install the local build products.
1install -m 0755 /tmp/ollama-build/ollama /usr/local/bin/ollama
The following is an example of the build products.
1 2
ollama lib/ollama/cuda_v13/libggml-cuda.so
Parent topic: Developer Guide