diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index a777807b0..9c317eb66 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -22,31 +22,72 @@ env: jobs: Build: - name: CUDA (${{ matrix.config }}) - runs-on: ubuntu-latest + name: ${{ matrix.name }} CUDA (${{ matrix.config }}) + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: [ubuntu-latest, windows-latest] config: - Debug - - Release + # - Release # cannot run multiple cuda-toolkit jobs in parallel + include: + - os: ubuntu-latest + name: Linux + cuda_subpackages: '["nvcc"]' + - os: windows-latest + name: Windows + # Windows splits the toolkit into finer components than Linux and an + # invalid component name aborts the whole install, so name exactly + # what the build needs (per the Windows installer subpackage list): + # nvcc - compiler front-end (nvcc, cudafe++, ptxas, nvlink) + # nvvm - device compiler backend (cicc); nvcc alone omits it + # cudart - cuda_runtime.h + runtime library + # crt - crt/host_config.h + # thrust - Thrust, and the CUB/libcudacxx headers it bundles + # ("cccl"/"cub" are not valid Windows installer subpackage names.) + cuda_subpackages: '["nvcc", "nvvm", "cudart", "crt", "thrust"]' steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 10 - - name: Dependencies + - name: Dependencies (Linux) + if: runner.os == 'Linux' run: | sudo apt-get install ccache echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV" - - name: cuda-toolkit - uses: Jimver/cuda-toolkit@v0.2.30 + - name: Dependencies (Windows) + if: runner.os == 'Windows' + run: | + choco install ccache + "CACHE_PATH=${env:LOCALAPPDATA}\ccache" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Install Ninja + if: runner.os == 'Windows' + uses: seanmiddleditch/gha-setup-ninja@master + + # Install CUDA before msvc-dev-cmd so the toolkit's bin dir lands on PATH + # before msvc-dev-cmd snapshots PATH into GITHUB_ENV for later steps. + # (check_language(CUDA) still does not reliably autodetect nvcc on this + # runner even with it on PATH, so the Windows configure also passes + # -DCMAKE_CUDA_COMPILER explicitly.) + - name: Install CUDA Toolkit + uses: Jimver/cuda-toolkit@v0.2.35 + id: cuda-toolkit with: - sub-packages: '["nvcc"]' + cuda: '13.2.0' + sub-packages: ${{ matrix.cuda_subpackages }} method: 'network' + - name: Setup MSVC (Windows) + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + - name: Get number of CPU cores uses: SimenB/github-actions-cpu-cores@v2 id: cpu-cores @@ -56,7 +97,7 @@ jobs: uses: actions/cache@v5 with: path: ${{ env.CACHE_PATH }} - key: ${{ runner.os }}-${{ matrix.config }}-cache + key: ${{ runner.os }}-${{ matrix.config }}-CUDA-cache - name: Prepare ccache run: | @@ -64,7 +105,8 @@ jobs: ccache -V && ccache --show-config ccache --show-stats && ccache --zero-stats - - name: Configure + - name: Configure (Linux) + if: runner.os == 'Linux' run: | mkdir -p build cd build @@ -76,6 +118,21 @@ jobs: -DIPC_TOOLKIT_BUILD_PYTHON=ON \ -DCMAKE_BUILD_TYPE=${{ matrix.config }} + - name: Configure (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + cmake -G Ninja ^ + -DIPC_TOOLKIT_WITH_CUDA=ON ^ + -DCMAKE_CUDA_ARCHITECTURES=75 ^ + -DSCALABLE_CCD_CUDA_ARCHITECTURES=75 ^ + -DIPC_TOOLKIT_BUILD_TESTS=ON ^ + -DIPC_TOOLKIT_BUILD_PYTHON=ON ^ + -DCMAKE_CUDA_COMPILER="%CUDA_PATH%\bin\nvcc.exe" ^ + -DCMAKE_BUILD_TYPE=${{ matrix.config }} ^ + -B build ^ + -S . + - name: Build run: | cmake --build build -j ${{ steps.cpu-cores.outputs.count }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 68fd32051..4ba292f3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,8 +207,8 @@ add_subdirectory("${IPC_TOOLKIT_SOURCE_DIR}") # Public include directory for IPC Toolkit target_include_directories(ipc_toolkit PUBLIC - "${IPC_TOOLKIT_INCLUDE_DIR}" # public headers - "${PROJECT_BINARY_DIR}/include" # generated config.hpp + "${IPC_TOOLKIT_INCLUDE_DIR}" # public headers + $ # generated config.hpp ) # Folder name for IDE