#!/bin/bash # Bonsai on GB10 (partner DGX Spark, 3 Dec 2026): build the PrismML llama.cpp fork, fetch the GGUFs, run llama-bench and the # same 12-prompt chat benchmark used for the vLLM runs (bench.py), one server at a time. W=/var/tmp/gwbench/bonsai; cd $W; mkdir -p out models IMG=nvidia/cuda:13.0.3-devel-ubuntu24.04 TAG=prism-b12232-f702476 B25=prism-ml/Ternary-Bonsai-2.5-27B-GGUF; R25=28a7093cc25bc151cc2b284c5570f12ce343fdcf; F25=Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf B1=prism-ml/Bonsai-27B-gguf; R1=f10afb355f104535e3e3e98cf7ab7795c72bd292; F1=Bonsai-27B-Q1_0.gguf exec > >(tee -a out/queue.log) 2>&1 echo "### $(date -u +%FT%TZ) start"; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader; cat /sys/class/dmi/id/product_name docker pull -q $IMG; docker image inspect -f '{{index .RepoDigests 0}}' $IMG D="docker run --rm --gpus all --network host --ipc host -v $W:$W -w $W $IMG" # 1. build if [ ! -x llama.cpp/build/bin/llama-server ]; then $D bash -c "set -e; apt-get update -qq; DEBIAN_FRONTEND=noninteractive apt-get install -y -qq git cmake ninja-build python3 python3-pip >/dev/null rm -rf llama.cpp; git clone -q --depth 1 -b $TAG https://github.com/PrismML-Eng/llama.cpp.git; cd llama.cpp; git log -1 --format='commit %H %cI' cmake -B build -G Ninja -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=121a -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=OFF -DLLAMA_OPENSSL=OFF -DLLAMA_USE_PREBUILT_UI=OFF -DLLAMA_BUILD_UI=OFF -DLLAMA_BUILD_TESTS=OFF > ../out/cmake.log 2>&1 cmake --build build -j 16 > ../out/build.log 2>&1; ./build/bin/llama-server --version" || { echo "BUILD FAILED"; tail -30 out/build.log; exit 1; } fi L=$W/llama.cpp/build/bin # 2. models, pinned to a repo revision get() { [ -s models/$3 ] || curl -sfL --retry 3 -o models/$3.part "https://huggingface.co/$1/resolve/$2/$3" && mv -f models/$3.part models/$3 2>/dev/null; ls -l models/$3 || echo "DOWNLOAD FAILED $3"; } get $B25 $R25 $F25; get $B1 $R1 $F1; sha256sum models/*.gguf # 3. llama-bench, three repetitions for f in $F25 $F1; do echo "### llama-bench $f"; $D $L/llama-bench -m models/$f -ngl 99 -fa 1 -p 512 -n 128 -r 3 2>&1 | grep -E '^\|| build'; done # 4. server runs: label file np ctx concs extra-args serve() { lab=$1 f=$2 np=$3 ctx=$4 concs=$5; shift 5 echo "### $(date -u +%FT%TZ) $lab np=$np ctx=$ctx args=$*" docker rm -f lbench >/dev/null 2>&1 docker run -d --name lbench --gpus all --network host --ipc host -v $W:$W $IMG $L/llama-server -m $W/models/$f \ --alias m --host 127.0.0.1 --port 8000 -ngl 99 -fa on -c $ctx -np $np --cache-ram 0 "$@" >/dev/null for i in $(seq 1 90); do curl -sf http://127.0.0.1:8000/health >/dev/null && break docker inspect -f '{{.State.Running}}' lbench 2>/dev/null | grep -q true || break; sleep 5; done if ! curl -sf http://127.0.0.1:8000/health >/dev/null; then echo "SERVE FAILED $lab"; docker logs --tail 40 lbench 2>&1; docker rm -f lbench >/dev/null; return 1; fi nvidia-smi --query-gpu=timestamp,power.draw,clocks.gr,temperature.gpu --format=csv -l 2 > out/$lab.gpu.csv & G=$! CONCS="$concs" python3 $W/bench.py m $lab out/$lab.jsonl | tee out/$lab.log kill $G docker logs lbench 2>&1 | grep -iE 'draft|accept|spec' | tail -40 > out/$lab.server.txt docker logs lbench 2>&1 | head -80 >> out/$lab.server.txt docker rm -f lbench >/dev/null; echo "### $(date -u +%FT%TZ) done $lab" } MTP="--spec-type draft-mtp --spec-draft-n-min 0 --spec-draft-n-max 3 --spec-draft-p-min 0.1" serve bonsai25-mtp $F25 16 262144 "1 4 16" $MTP || serve bonsai25-mtp-np1 $F25 1 32768 "1 4" $MTP serve bonsai25-plain $F25 16 262144 "1 4 16" serve bonsai1-plain $F1 16 262144 "1 4 16" echo "### $(date -u +%FT%TZ) ALLDONE"; touch out/ALLDONE