From 11d632307c705ccef4f176901c02db890200dbc2 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 4 Jun 2026 13:28:53 -0700 Subject: [PATCH] provision: ignore junk/0 UNSLOTH_LLAMA_BUILD_JOBS (cmake -j0 = all cores) A non-numeric or 0 override silently fell through to `cmake -j0`, which builds with ALL cores -- the opposite of the thermal-headroom default and a shutdown risk on NVIDIA-ARM laptops. Validate it's a positive integer; ignore anything else and auto-compute. Co-Authored-By: Claude Opus 4.8 --- studio/scripts/provision_llama_cuda.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/studio/scripts/provision_llama_cuda.sh b/studio/scripts/provision_llama_cuda.sh index cda2bb1dcb..5be96aa89b 100644 --- a/studio/scripts/provision_llama_cuda.sh +++ b/studio/scripts/provision_llama_cuda.sh @@ -136,7 +136,8 @@ fi # (~1.5 GB per nvcc job) to avoid OOM. Tune with UNSLOTH_LLAMA_BUILD_JOBS=N (raise # on a well-cooled box, lower if it still trips). Incremental: a re-run resumes. _ncpu="$(nproc 2>/dev/null || echo 4)" -if [ -n "${UNSLOTH_LLAMA_BUILD_JOBS:-}" ]; then +# Honor a valid positive-int override; ignore junk/0 (cmake reads -j0 as "all cores"). +if [ -n "${UNSLOTH_LLAMA_BUILD_JOBS:-}" ] && [ "${UNSLOTH_LLAMA_BUILD_JOBS}" -ge 1 ] 2>/dev/null; then JOBS="$UNSLOTH_LLAMA_BUILD_JOBS" else _half=$(( (_ncpu + 1) / 2 )) # ~half the cores for thermal headroom