* studio/setup.sh: guard empty CUDA arch detection in the source build PR #5826 hardened setup.sh for fresh CUDA toolkits, but the source build still set -DCMAKE_CUDA_ARCHITECTURES only when nvidia-smi reported a compute capability. When that query returns nothing the build proceeded with no explicit arch list, so llama.cpp built PTX only. On a driver older than the toolkit that binary fails at runtime with "the provided PTX was compiled with an unsupported toolchain" - the build succeeds, so neither the build-time check nor the CPU fallback caught it (issue #5854). Resolve the arch list before committing to a CUDA build. A new pure helper _resolve_cuda_archs parses and de-duplicates the nvidia-smi compute_cap output and honors an explicit UNSLOTH_LLAMA_CUDA_ARCHS override. When the result is empty, build CPU llama.cpp instead of a PTX-only binary, with a clear message pointing at the override - so the user still ends up with a working llama-server. The override also lets advanced users force a native build on hosts where nvidia-smi cannot report compute_cap. No behavior change when an arch is detected: -DGGML_CUDA=ON plus the arch, CUDA flags and NVCC_PREPEND_FLAGS are assembled exactly as before. Adds tests/sh/test_resolve_cuda_archs.sh (single/multi/dedup/empty/garbage/ whitespace/override cases), wired into tests/run_all.sh and the studio-backend-ci.yml shell-test loop. * studio/setup.sh: resolve nvidia-smi via /usr/bin fallback for arch detection Addresses review feedback on the empty-CUDA-arch guard: _setup_has_usable_nvidia_gpu classifies a host as NVIDIA-usable using nvidia-smi on PATH OR /usr/bin/nvidia-smi, but the new arch detection probed only `command -v nvidia-smi`. On a GPU host where nvidia-smi is off PATH (reachable only at /usr/bin), arch detection returned empty and the new empty-arch branch dropped the build to CPU, losing CUDA. Mirror the same PATH-then-/usr/bin resolution so those hosts still get a native CUDA build. Also scope _resolve_cuda_archs locals with `local` (no behavior change; it already runs under command substitution). * tests: update compute_cap-probe assertion for $_smi_bin resolution The nvidia-smi /usr/bin fallback parameterized the binary in the compute_cap probe (_setup_run_smi "$_smi_bin" ...), so the literal-string assertion in test_compute_cap_probe_timeout_wrapped no longer matched. Assert the probe is preceded by _setup_run_smi (timeout-wrapped) instead, scanning all occurrences so the comment mention is ignored. Same intent, binary-agnostic. * tests: ruff-format the compute_cap probe assertion (pre-commit) Collapse the backslash-continued assert onto one line and normalize slice spacing so the ruff-format pre-commit hook (0.6.9) is satisfied. Formatting only; no behavior change. * Tighten code comments (no logic change) * studio(windows): build CPU when CUDA arch is undetectable (#5854) The Windows source build added -DGGML_CUDA=ON unconditionally but only set -DCMAKE_CUDA_ARCHITECTURES when $CudaArch was detected. With no detectable compute capability that produced a PTX-only binary, the same hole the Linux fix closed. Build CPU llama.cpp in that case, and honor UNSLOTH_LLAMA_CUDA_ARCHS to force a CUDA build, matching setup.sh. Detected-arch builds are unchanged. * test: anchor NVCC_PREPEND_FLAGS scope check on the final CPU branch The undetectable-arch CPU fallback adds an earlier -DGGML_CUDA=OFF, so the ordering check now anchors on -DGGML_CUDA=ON and the last -DGGML_CUDA=OFF instead of the first. --------- Co-authored-by: Daniel Han <michaelhan2050@gmail.com>
This commit is contained in:
parent
bebc93d8fc
commit
70926822db
7 changed files with 185 additions and 57 deletions
1
.github/workflows/studio-backend-ci.yml
vendored
1
.github/workflows/studio-backend-ci.yml
vendored
|
|
@ -226,6 +226,7 @@ jobs:
|
|||
tests/sh/test_studio_home_node_dir.sh \
|
||||
tests/sh/test_system_node_readonly.sh \
|
||||
tests/sh/test_nvcc_meets_llama_minimum.sh \
|
||||
tests/sh/test_resolve_cuda_archs.sh \
|
||||
tests/sh/test_tauri_install_exit_order.sh \
|
||||
tests/sh/test_torch_constraint.sh \
|
||||
tests/sh/test_torch_flavor.sh; do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue