From: pockers21 Date: Thu, 5 Jun 2025 13:25:29 +0000 (-0700) Subject: ci: fix CUDA build failure on autodl cloud machines (#14005) X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=146b88e8b3e16d22cea22f8be982a4d45e913b1e;p=pkg%2Fggml%2Fsources%2Fllama.cpp ci: fix CUDA build failure on autodl cloud machines (#14005) Replace CMAKE_CUDA_ARCHITECTURES=native with nvidia-smi detection as 'native' fails on autodl cloud environments. Co-authored-by: pockers21 --- diff --git a/ci/run.sh b/ci/run.sh index b49a3a5f..2968a7dd 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -46,7 +46,20 @@ if [ ! -z ${GG_BUILD_METAL} ]; then fi if [ ! -z ${GG_BUILD_CUDA} ]; then - CMAKE_EXTRA="${CMAKE_EXTRA} -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=native" + CMAKE_EXTRA="${CMAKE_EXTRA} -DGGML_CUDA=ON" + + if command -v nvidia-smi >/dev/null 2>&1; then + CUDA_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader,nounits 2>/dev/null | head -1 | tr -d '.') + if [[ -n "$CUDA_ARCH" && "$CUDA_ARCH" =~ ^[0-9]+$ ]]; then + CMAKE_EXTRA="${CMAKE_EXTRA} -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCH}" + else + echo "Warning: Using fallback CUDA architectures" + CMAKE_EXTRA="${CMAKE_EXTRA} -DCMAKE_CUDA_ARCHITECTURES=61;70;75;80;86;89" + fi + else + echo "Error: nvidia-smi not found, cannot build with CUDA" + exit 1 + fi fi if [ ! -z ${GG_BUILD_SYCL} ]; then