From c4071a86cbb2e4015b2e8d92aaba007d02d318b9 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 2 Jun 2026 23:47:00 -0700 Subject: [PATCH] install.ps1: propagate UNSLOTH_LLAMA_BUILD_JOBS into the WSL CUDA-llama build Windows env vars don't cross into WSL by default, so the background provision_llama_cuda.sh always built at -j(nproc). Forward UNSLOTH_LLAMA_BUILD_JOBS via 'env' so thermally/power-limited laptops can cap the build's parallelism (harmless no-op passthrough when unset). Co-Authored-By: Claude Opus 4.8 --- install.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index 855151cbbc..0f7cd7de8a 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1655,7 +1655,12 @@ shell.Run cmd, 0, False $prevEapL = $ErrorActionPreference; $ErrorActionPreference = "Continue" try { $_llamaUrl = "https://raw.githubusercontent.com/unslothai/unsloth/main/studio/scripts/provision_llama_cuda.sh" - $_provCmd = 'mkdir -p /root/.unsloth; if curl -fsSL "' + $_llamaUrl + '" -o /root/.unsloth/provision_llama_cuda.sh && [ -s /root/.unsloth/provision_llama_cuda.sh ]; then chmod +x /root/.unsloth/provision_llama_cuda.sh; nohup setsid bash /root/.unsloth/provision_llama_cuda.sh > /root/.unsloth/llama_cuda_build.log 2>&1 < /dev/null & echo PROV_STARTED; else echo PROV_NOSCRIPT; fi' + # Propagate UNSLOTH_LLAMA_BUILD_JOBS into the WSL build (Windows env + # vars do not cross into WSL by default), so thermally/power-limited + # laptops can cap the CUDA build's parallelism (`env` with no + # assignment is a harmless passthrough when the var is unset). + $_jobsEnv = if ($env:UNSLOTH_LLAMA_BUILD_JOBS) { "UNSLOTH_LLAMA_BUILD_JOBS=$($env:UNSLOTH_LLAMA_BUILD_JOBS) " } else { "" } + $_provCmd = 'mkdir -p /root/.unsloth; if curl -fsSL "' + $_llamaUrl + '" -o /root/.unsloth/provision_llama_cuda.sh && [ -s /root/.unsloth/provision_llama_cuda.sh ]; then chmod +x /root/.unsloth/provision_llama_cuda.sh; nohup setsid env ' + $_jobsEnv + 'bash /root/.unsloth/provision_llama_cuda.sh > /root/.unsloth/llama_cuda_build.log 2>&1 < /dev/null & echo PROV_STARTED; else echo PROV_NOSCRIPT; fi' $_provOut = & wsl.exe -d $distro -u root -- bash -lc $_provCmd 2>$null if ("$_provOut" -match 'PROV_STARTED') { step "llama.cpp" "building CUDA llama.cpp for GGUF inference in the background (a few min); log: ~/.unsloth/llama_cuda_build.log" "Green"