LDGI Notes • Hardware Desk
Port notes from shop-max-mus — Maximus V Formula / Z77, Ivy Bridge, Tesla P100, Prism Bonsai-demo.
Port notes from shop-max-mus (Maximus V Formula / Z77, Ivy Bridge i7-3770K, Tesla P100 16 GB compute-only, Intel HD 4000 for display). Goal: run Prism Bonsai-demo / Bonsai 2 27B PQ2 when stock prebuilts fail.
Publish target: ldgi.app (not lgdi.app). Suggested path: /notes/p100-bonsai-port.html.
| Piece | shop-max-mus |
|---|---|
| CPU | Intel i7-3770K (Ivy Bridge) — no AVX2 / BMI2 |
| Board | ASUS Maximus V Formula (Z77) |
| GPU | NVIDIA Tesla P100 16 GB — CUDA arch sm_60 (Pascal) |
| Display | Intel HD 4000 iGPU (1 GB BIOS carve-out); P100 compute-only (custom DSDT) |
| System RAM | 8 GB installed (~6.2 GiB usable with iGPU carve-out) |
| Power limit | P100 capped at 180 W (card allows up to 250 W; min settable ~125 W) |
| Thermals | Slowdown ~82 °C, shutdown ~85 °C. Under LLM load, ~80 °C with high watts is OK; overheating signal is watts collapsing below ~100 W after temp has hit ~80 (throttle), not 80 °C alone. |
git clone https://github.com/PrismML-Eng/Bonsai-demo.git
cd Bonsai-demo
# lean setup (optional): skip Open WebUI / code interpreter
BONSAI_OPENWEBUI=0 BONSAI_CODE_INTERPRETER=0 ./setup.sh
Model used successfully:
models/bonsai2-gguf/27B/Ternary-Bonsai-2-27B-PQ2_0.gguf (~6.8 GiB)Ternary-Bonsai-2-27B-mmproj-Q8_0.gguf (kept on CPU with BONSAI_MMPROJ_CPU=1)If HF download stalls, resume with curl against the same GGUF URL into that path (verify final size vs Content-Length).
llama-server hits AVX2/BMI2 instructions (ggml_cpu_init / shlx). Ivy Bridge dies immediately.libcudart.so.12 until CUDA 12 runtime / toolkit (or Ollama’s cuda_v12 libs) are on LD_LIBRARY_PATH.nvidia-cuda-toolkit 12.0 (nvcc at /usr/bin/nvcc)Bonsai-demo/llama.cpp (branch prism)-DCMAKE_CUDA_ARCHITECTURES=60 (P100)shlx)-mno-bmi -mno-bmi2, and -DGGML_BMI2=OFF (plus whatever the tree uses to turn off AVX2)bin/cuda-prebuilt/ # original download (keep for reference; do not use on Ivy Bridge/P100)
bin/cuda-p100/ # custom build output
bin/cuda -> cuda-p100
Verify: llama-server -h runs; objdump/disasm should not show BMI2 shlx in the hot paths you cared about.
export LD_LIBRARY_PATH="$PWD/bin/cuda-p100:/usr/lib/x86_64-linux-gnu:/usr/local/lib/ollama/cuda_v12${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
Ollama may be installed only to provide CUDA 12 .so files; Bonsai itself is not the Ollama model server.
Single slot (-np 1) — one user, full KV budget (default auto was 4 slots on this box).
KV4 — BONSAI_KV4=1 stores KV as Q4_0 so longer context fits in 16 GB.
mmproj on CPU — BONSAI_MMPROJ_CPU=1 / --no-mmproj-offload.
| BONSAI_CTX | Notes |
|---|---|
| 8192 | First bring-up; easy fit |
| 16384 | Comfortable |
| 32768 | Comfortable |
| 65536 | Comfortable; ~8.7 GiB VRAM idle-reserved in practice |
| 131072 (128k) | Fits; live snapshot ~10.2 GiB used / ~6 GiB free on shop-max-mus |
Larger than 128k: try carefully; watch load for CUDA OOM. Prefill of huge prompts is slow on P100 (~tens of tok/s prompt eval).
cd ~/Bonsai-demo
export LD_LIBRARY_PATH="$PWD/bin/cuda-p100:/usr/lib/x86_64-linux-gnu:/usr/local/lib/ollama/cuda_v12${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
BONSAI_CTX=131072 BONSAI_MMPROJ_CPU=1 BONSAI_KV4=1 ./scripts/start_llama_server.sh -np 1
# prefer PID-based kill so you do not match your own shell command line
pids=$(ps -C llama-server -o pid=)
[ -n "$pids" ] && kill $pids
# or Ctrl+C in the start terminal
Avoid pkill -f llama-server from a command line that itself contains that string (can kill the shell).
curl -s http://127.0.0.1:8080/health
curl -s http://127.0.0.1:8080/props | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d.get("default_generation_settings",{}).get("n_ctx"))'
Expect 131072 for 128k.
http://127.0.0.1:8080http://127.0.0.1:8080/v1/chat/completionsollama.service may be enabled separately for CUDA libs only27B is a thinking model; thinking defaults on.
enable_thinking: false (real speedup for code dumps)--reasoning-budget 0 --reasoning-format none --chat-template-kwargs '{"enable_thinking": false}'Settings → API Key in the web UI is client-only (Bearer header).
To require a key on the server, restart with:
... ./scripts/start_llama_server.sh -np 1 --api-key 'your-secret'
# or: export LLAMA_API_KEY='your-secret'
Apps: base URL http://127.0.0.1:8080/v1, Authorization: Bearer your-secret.
Default bind is localhost only (BONSAI_HOST=0.0.0.0 for LAN — then a key matters more).
watch -n 1 nvidia-smi
# or
nvidia-smi -l 1
Flat Memory-Usage while generating is normal: weights + full KV for -c are reserved at load.
Progress while a job runs:
curl -s http://127.0.0.1:8080/slots
Watch is_processing, n_prompt_tokens, and next_token[].n_decoded (generated tokens). Context truncate looks like log truncated = 1 / stop at n_ctx — that is a token ceiling, not VRAM OOM.
OOM / crash: process dies, CUDA allocate errors in log, VRAM drops to near empty, /health fails.
bin/cuda-p100 via bin/cuda symlink -c 131072 -np 1 KV4 mmproj CPU nvidia-smi + CUDA samples / arch docs).LD_LIBRARY_PATH.llama.cpp for 60 + Ivy-safe CPU flags; install to bin/cuda-p100.-np 1, modest BONSAI_CTX, then climb (16k → 32k → 64k → 128k).~/Bonsai-demo/RUN-P100.md — short start cheat sheet ~/Bonsai-demo/P100-BONSAI-PORT.md — this document Source: shop-max-mus ~/Bonsai-demo/P100-BONSAI-PORT.md. Short sheet: RUN-P100.md. Domain: ldgi.app (not the LGDI bureau).