Metal cuda backend #127
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build CUDA | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| env: | |
| cmake-build-type: "Release" | |
| cmake-parallel: 10 | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }}-CUDA-${{ matrix.cmake-build-type }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| name: [ubuntu, windows] | |
| include: | |
| - name: ubuntu | |
| os: ubuntu-latest | |
| c-compiler: "gcc" | |
| cxx-compiler: "g++" | |
| cmake-build-type: "Release" | |
| cmake-build-flag: "" | |
| - name: windows | |
| os: windows-latest | |
| c-compiler: "cl.exe" | |
| cxx-compiler: "cl.exe" | |
| cmake-build-type: "Release" | |
| cmake-build-flag: "-A x64" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: 3.8 | |
| - name: Cache pip packages | |
| uses: actions/cache@v5 | |
| continue-on-error: true | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install Python build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install ninja | |
| shell: bash | |
| - name: Install ccache (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt-get install -y ccache | |
| shell: bash | |
| - name: Cache ccache (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/cache@v5 | |
| continue-on-error: true | |
| with: | |
| path: ~/.cache/ccache | |
| key: ${{ runner.os }}-ccache-${{ hashFiles('clic/**', 'cmake/**') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ccache- | |
| - name: Get CMake and Ninja | |
| uses: lukka/get-cmake@v4.3.1 | |
| - name: Install CUDA Toolkit (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| id: cuda-toolkit-linux | |
| uses: Jimver/cuda-toolkit@v0.2.35 | |
| with: | |
| cuda: '12.6.0' | |
| method: 'network' | |
| sub-packages: '["nvcc","cudart","cudart-dev","nvrtc","nvrtc-dev"]' | |
| non-cuda-sub-packages: '["libnvjitlink","libnvjitlink-dev"]' | |
| use-local-cache: true | |
| - name: Install CUDA Toolkit (Windows) | |
| if: matrix.os == 'windows-latest' | |
| id: cuda-toolkit-windows | |
| uses: Jimver/cuda-toolkit@v0.2.35 | |
| with: | |
| cuda: '12.6.0' | |
| method: 'local' | |
| use-local-cache: true | |
| log-file-suffix: '_windows' | |
| - name: Set CUDA path | |
| id: cuda-path | |
| run: | | |
| if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
| echo "CUDA_ROOT=${{ steps.cuda-toolkit-linux.outputs.CUDA_PATH }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "CUDA_ROOT=${{ steps.cuda-toolkit-windows.outputs.CUDA_PATH }}" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: Verify CUDA Installation | |
| run: | | |
| echo "CUDA installed to: ${{ steps.cuda-path.outputs.CUDA_ROOT }}" | |
| nvcc --version | |
| shell: bash | |
| - name: Restore build cache | |
| uses: actions/cache@v5 | |
| continue-on-error: true | |
| with: | |
| path: ${{ runner.workspace }}/build | |
| key: ${{ runner.os }}-cuda-build-${{ matrix.cmake-build-type }}-${{ hashFiles('CMakeLists.txt', 'clic/**', 'cmake/**') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cuda-build-${{ matrix.cmake-build-type }}- | |
| - name: Compile CLIc with CUDA | |
| run: | | |
| set -euo pipefail | |
| BUILD_DIR="${{ runner.workspace }}/build" | |
| CUDA_ROOT="${{ steps.cuda-path.outputs.CUDA_ROOT }}" | |
| cmake -S "${{ github.workspace }}" -B "$BUILD_DIR" \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} \ | |
| -DBUILD_DOCUMENTATION=OFF \ | |
| -DBUILD_BENCHMARK=OFF \ | |
| -DCLE_BACKEND=CUDA \ | |
| "-DCUDAToolkit_ROOT=${CUDA_ROOT}" \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| ${{ matrix.cmake-build-flag }} | |
| cmake --build "$BUILD_DIR" --parallel ${{ env.cmake-parallel }} --config Release | |
| shell: bash -l {0} | |
| env: | |
| CCACHE_BASEDIR: ${{ github.workspace }} | |
| CCACHE_DIR: ~/.cache/ccache | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v7.0.0 | |
| with: | |
| name: test-results-cuda-${{ matrix.name }} | |
| path: ${{ runner.workspace }}/build/Testing/Temporary/ | |
| if-no-files-found: ignore |