Mooncake/mooncake-integration/ollama/scripts/setup_llama.sh

27 lines
866 B
Bash

#!/usr/bin/env bash
# Clone + build llama.cpp with CUDA (H200 = sm_90) and SHARED libs (needed for cgo Stage-2).
set -euo pipefail
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/env.sh"
if [ ! -d "$LLAMA_DIR/.git" ]; then
echo "[llama] cloning"
git clone --depth 1 https://github.com/ggml-org/llama.cpp "$LLAMA_DIR"
fi
cd "$LLAMA_DIR"
echo "[llama] HEAD: $(git rev-parse --short HEAD)"
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_CUDA=ON \
-DCMAKE_CUDA_ARCHITECTURES=90 \
-DBUILD_SHARED_LIBS=ON \
-DLLAMA_CURL=OFF \
-DLLAMA_BUILD_TESTS=OFF \
-DLLAMA_BUILD_EXAMPLES=ON \
-DLLAMA_BUILD_SERVER=ON
# Limit build parallelism to a fixed job count rather than all available cores.
cmake --build build --target llama-server llama-cli -j 24
echo "[llama] server: $LLAMA_BUILD/bin/llama-server"
ls -la "$LLAMA_BUILD/bin" | head