#!/usr/bin/env bash # Build llama.cpp with CUDA for the 4090 (sm_89). # # Pinned to a tag rather than master: qwen35 arch support and the current # --spec-type names are recent, and master moves fast. set -euo pipefail TAG="${TAG:-b10448}" LLAMA_DIR="${LLAMA_DIR:-$HOME/code/llama.cpp}" export PATH=/usr/local/cuda-13.2/bin:$PATH export CUDACXX=/usr/local/cuda-13.2/bin/nvcc command -v nvcc >/dev/null || { echo "nvcc missing — run 00-cuda.sh first" >&2; exit 1; } if [[ ! -d "$LLAMA_DIR" ]]; then git clone --depth 1 --branch "$TAG" https://github.com/ggml-org/llama.cpp.git "$LLAMA_DIR" fi cd "$LLAMA_DIR" cmake -B build \ -DGGML_CUDA=ON \ -DCMAKE_CUDA_ARCHITECTURES=89 \ -DLLAMA_CURL=ON \ -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release -j "$(nproc)" ./build/bin/llama-server --version 2>&1 | head -3