@@ -13,7 +13,7 @@ permissions:
1313
1414jobs :
1515 build-and-test :
16- name : ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}
16+ name : ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.backend }}-${{ matrix. build_type }}
1717 runs-on : ${{ matrix.os }}
1818
1919 strategy :
@@ -22,10 +22,26 @@ jobs:
2222 os : [ubuntu-latest]
2323 compiler : [clang-20, gcc-14]
2424 build_type : [Release, Debug]
25+ backend : [cuda, cpu]
26+ exclude :
27+ # Only test CPU backend with one compiler in Debug to save CI time
28+ - backend : cpu
29+ compiler : clang-20
30+ build_type : Debug
2531
2632 steps :
2733 - uses : actions/checkout@v4
2834
35+ - name : Install CUDA Toolkit
36+ if : matrix.backend == 'cuda'
37+ uses : Jimver/cuda-toolkit@v0.2.21
38+ id : cuda-toolkit
39+ with :
40+ cuda : ' 12.8.0'
41+ method : ' network'
42+ sub-packages : ' ["nvcc", "cudart", "thrust"]'
43+ non-cuda-sub-packages : ' ["libcublas", "libcublas-dev"]'
44+
2945 - name : Set up compiler (Clang)
3046 if : matrix.compiler == 'clang-20'
3147 uses : egor-tensin/setup-clang@v1
@@ -102,12 +118,19 @@ jobs:
102118 uses : actions/cache@v4
103119 with :
104120 path : .cmake/fetchcontent
105- key : ${{ runner.os }}-${{ matrix.compiler }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}
121+ key : ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.backend }}- cmake-${{ hashFiles('**/CMakeLists.txt') }}
106122 restore-keys : |
107- ${{ runner.os }}-${{ matrix.compiler }}-cmake-
123+ ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.backend }}- cmake-
108124
109125 - name : Configure CMake
110- run : cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
126+ run : |
127+ CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}"
128+ if [[ "${{ matrix.backend }}" == "cuda" ]]; then
129+ CMAKE_ARGS="$CMAKE_ARGS -DBACKEND_CUDA=ON -DSKIP_CUDA_TESTS=ON -DCMAKE_CUDA_ARCHITECTURES=120"
130+ else
131+ CMAKE_ARGS="$CMAKE_ARGS -DBACKEND_CUDA=OFF"
132+ fi
133+ cmake -S . -B build $CMAKE_ARGS
111134
112135 - name : Build
113136 run : cmake --build build --config ${{ matrix.build_type }} --parallel
@@ -120,48 +143,4 @@ jobs:
120143 if : always()
121144 with :
122145 files : build/test-results.xml
123- check_name : Test Results (${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }})
124-
125- # CUDA compilation check (no GPU required, just verifies code compiles)
126- cuda-build :
127- name : CUDA Build Check
128- runs-on : ubuntu-latest
129-
130- steps :
131- - uses : actions/checkout@v4
132-
133- - name : Install CUDA Toolkit
134- uses : Jimver/cuda-toolkit@v0.2.21
135- id : cuda-toolkit
136- with :
137- cuda : ' 12.8.0'
138- method : ' network'
139- sub-packages : ' ["nvcc", "cudart", "thrust"]'
140- non-cuda-sub-packages : ' ["libcublas", "libcublas-dev"]'
141-
142- - name : Install OpenMP
143- run : |
144- sudo apt-get update
145- sudo apt-get install -y libgomp1
146-
147- - name : Cache CMake dependencies
148- uses : actions/cache@v4
149- with :
150- path : .cmake/fetchcontent
151- key : ${{ runner.os }}-cuda-cmake-${{ hashFiles('**/CMakeLists.txt') }}
152- restore-keys : |
153- ${{ runner.os }}-cuda-cmake-
154-
155- - name : Configure CMake with CUDA
156- run : |
157- cmake -S . -B build \
158- -DCMAKE_BUILD_TYPE=Release \
159- -DTENSOR_BUILD_CUDA=ON \
160- -DSKIP_CUDA_TESTS=ON \
161- -DCMAKE_CUDA_ARCHITECTURES=89
162-
163- - name : Build (including CUDA)
164- run : cmake --build build --config Release --parallel
165-
166- - name : Run tests (CUDA tests will be skipped)
167- run : ctest --test-dir build --output-on-failure
146+ check_name : Test Results (${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.backend }}-${{ matrix.build_type }})
0 commit comments