Skip to content

Instantly share code, notes, and snippets.

@JiLiZART
Created March 9, 2026 20:40
Show Gist options
  • Select an option

  • Save JiLiZART/200006586b897997fa6ca3edb4a4183d to your computer and use it in GitHub Desktop.

Select an option

Save JiLiZART/200006586b897997fa6ca3edb4a4183d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Exit on any error
set -e
# Get the current Git tag
TAG=$(git -C ~/llama.cpp describe --tags)
BUILD_DIR="$HOME/llama.cpp/build-$TAG"
# Export environment variables
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export PATH="$PATH:$CUDA_HOME/bin"
echo "Using build directory: $BUILD_DIR"
# Run cmake and build
cmake -B "$BUILD_DIR" -S "$HOME/llama.cpp" \
-DGGML_RPC=ON \
-DGGML_CUDA=ON \
-DGGML_SCHED_MAX_COPIES=1 \
-DGGML_CUDA_FA_ALL_QUANTS=ON \
-DGGML_CUDA_FORCE_MMQ=ON \
-DLLAMA_CURL=OFF \
-DCMAKE_CXX_FLAGS="-O3 -flto" \
-DCMAKE_C_FLAGS="-O3 -flto"
cmake --build "$BUILD_DIR" --config Release -j 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment