From 6f34a5704794d26f8eee24f10dfbe2830ab683bb Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Fri, 1 May 2026 15:25:52 +0800 Subject: [PATCH 1/3] Fix CUDA configure on CI --- .github/workflows/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 733c87a8b..108655a4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,9 +51,11 @@ jobs: TORCH_DIR: ${{ github.workspace }}/.cache/libtorch/${{ matrix.torch_variant }}/libtorch/share/cmake/Torch run: | set -e - cmake -S ml_tools -B ml_tools/build-${{ matrix.build_type }}-${{ matrix.torch_variant }} \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DTorch_DIR="$TORCH_DIR" + CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTorch_DIR=$TORCH_DIR" + if [ "${{ matrix.torch_variant }}" = "cu121" ]; then + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CUDA_ARCHITECTURES=70;75;80;86" + fi + cmake -S ml_tools -B ml_tools/build-${{ matrix.build_type }}-${{ matrix.torch_variant }} $CMAKE_ARGS - name: Build run: | From 32bb17a14d8dac597556193a64b0650d2f45e0ed Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Fri, 1 May 2026 15:34:11 +0800 Subject: [PATCH 2/3] Ensure CUDA compiler is found --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 108655a4f..6d4eaea0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,6 +26,13 @@ jobs: sudo apt-get update sudo apt-get -y install cuda-toolkit-12-1 + - name: Configure CUDA environment + if: matrix.torch_variant == 'cu121' + run: | + set -e + echo "/usr/local/cuda/bin" >> "$GITHUB_PATH" + echo "CUDA_HOME=/usr/local/cuda" >> "$GITHUB_ENV" + - name: Cache libtorch id: cache-libtorch uses: actions/cache@v4 @@ -53,7 +60,7 @@ jobs: set -e CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTorch_DIR=$TORCH_DIR" if [ "${{ matrix.torch_variant }}" = "cu121" ]; then - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CUDA_ARCHITECTURES=70;75;80;86" + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CUDA_ARCHITECTURES=70;75;80;86 -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc" fi cmake -S ml_tools -B ml_tools/build-${{ matrix.build_type }}-${{ matrix.torch_variant }} $CMAKE_ARGS From 72a43393ac9d6475cd463b16c98e85ebc0801261 Mon Sep 17 00:00:00 2001 From: sunliang98 <1700011430@pku.edu.cn> Date: Fri, 1 May 2026 15:39:17 +0800 Subject: [PATCH 3/3] Pin CUDA arch list for libtorch --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d4eaea0f..2f01ec006 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,7 @@ jobs: set -e CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTorch_DIR=$TORCH_DIR" if [ "${{ matrix.torch_variant }}" = "cu121" ]; then + export TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CUDA_ARCHITECTURES=70;75;80;86 -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc" fi cmake -S ml_tools -B ml_tools/build-${{ matrix.build_type }}-${{ matrix.torch_variant }} $CMAKE_ARGS