diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py index 89110b486c..f81fa293cc 100644 --- a/studio/install_python_stack.py +++ b/studio/install_python_stack.py @@ -186,13 +186,14 @@ def pip_install( stdout = subprocess.PIPE, stderr = subprocess.STDOUT, ) - if result.returncode != 0: - print(_red(f" uv failed, falling back to pip...")) - pip_cmd = _build_pip_cmd(args) + constraint_args + req_args - run(label, pip_cmd) - else: - pip_cmd = _build_pip_cmd(args) + constraint_args + req_args - run(label, pip_cmd) + if result.returncode == 0: + return + print(_red(f" uv failed, falling back to pip...")) + if result.stdout: + print(result.stdout.decode(errors = "replace")) + + pip_cmd = _build_pip_cmd(args) + constraint_args + req_args + run(label, pip_cmd) finally: if actual_req is not None and actual_req != req: actual_req.unlink(missing_ok = True) diff --git a/studio/setup.sh b/studio/setup.sh index 5cabb461c8..a9e3085efd 100755 --- a/studio/setup.sh +++ b/studio/setup.sh @@ -295,17 +295,26 @@ rm -rf "$LLAMA_CPP_DIR" # Detect GPU compute capability and limit CUDA architectures # Without this, cmake builds for ALL default archs (very slow) - CUDA_ARCH="" + CUDA_ARCHS="" if command -v nvidia-smi &>/dev/null; then - _raw_cap=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | head -1 | tr -d '[:space:]') - if [[ "$_raw_cap" =~ ^([0-9]+)\.([0-9]+)$ ]]; then - CUDA_ARCH="${BASH_REMATCH[1]}${BASH_REMATCH[2]}" - fi + # Read all GPUs, deduplicate (handles mixed-GPU hosts) + _raw_caps=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null || true) + while IFS= read -r _cap; do + _cap=$(echo "$_cap" | tr -d '[:space:]') + if [[ "$_cap" =~ ^([0-9]+)\.([0-9]+)$ ]]; then + _arch="${BASH_REMATCH[1]}${BASH_REMATCH[2]}" + # Append if not already present + case ";$CUDA_ARCHS;" in + *";$_arch;"*) ;; + *) CUDA_ARCHS="${CUDA_ARCHS:+$CUDA_ARCHS;}$_arch" ;; + esac + fi + done <<< "$_raw_caps" fi - if [ -n "$CUDA_ARCH" ]; then - echo " GPU compute capability: sm_${CUDA_ARCH} -- limiting build to this arch" - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCH}" + if [ -n "$CUDA_ARCHS" ]; then + echo " GPU compute capabilities: ${CUDA_ARCHS//;/, } -- limiting build to detected archs" + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHS}" else echo " Could not detect GPU arch -- building for all default CUDA architectures (slower)" fi