diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 9d0cdb8e4a..0000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,74 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -name: "CodeQL" - -on: - push: - branches: [main] - pull_request: - # The branches below must be a subset of the branches above - branches: [main] - schedule: - - cron: '0 15 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['cpp'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Updates submodule. - - run: git submodule update --init - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # โ„น๏ธ Command-line programs to run using the OS shell. - # ๐Ÿ“š https://git.io/JvXDl - - # โœ๏ธ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 82fe8bf85f..9b24fd5bd3 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -6,57 +6,36 @@ on: pull_request: branches: [ main ] +env: + PYTHON_VERSION: '3.12' + jobs: build-macos: - runs-on: ${{ matrix.os }} - name: ${{ matrix.name }} strategy: matrix: include: - # macOS 12.4 + Xcode 13.4.1 - - name: "macOS 12.4 + Xcode 13.4.1" - os: macos-12 - compiler: xcode - version: "13.4.1" - # macOS 11.6 + Xcode 13.2.1 - - name: "macOS 11.6 + Xcode 13.2.1" - os: macos-11 + # macOS 26.3 + Xcode 26.3 + - name: "macOS 26.3 + Xcode 26.3" + os: macos-26 compiler: xcode - version: "13.2.1" - # macOS 11.6 + Xcode 12.5.1 - - name: "macOS 11.6 + Xcode 12.5.1" - os: macos-11 + version: "26.3" + # macOS 15.7.4 + Xcode 16.4 + - name: "macOS 15.7.4 + Xcode 16.4" + os: macos-15 compiler: xcode - version: "12.5.1" - # macOS 11.6 + Xcode 11.7 - - name: "macOS 11.6 + Xcode 11.7" - os: macos-11 - compiler: xcode - version: "11.7" - # macOS 12.4 + gcc-11 - - name: "macOS 12.4 + gcc-11" - os: macos-12 - compiler: gcc - version: "11" - # macOS 11.6 + gcc-11 - - name: "macOS 11.6 + gcc-11" - os: macos-11 - compiler: gcc - version: "11" - # macOS 11.6 + gcc-10 - - name: "macOS 11.6 + gcc-10" - os: macos-11 - compiler: gcc - version: "10" - # macOS 11.6 + gcc-9 - - name: "macOS 11.6 + gcc-9" - os: macos-11 - compiler: gcc - version: "9" + version: "16.4" + + runs-on: ${{ matrix.os }} + name: ๐ŸŽ Build - ${{ matrix.name }} + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: true + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} - name: Configure Compiler run: | if [ "${{ matrix.compiler }}" = "gcc" ]; then @@ -74,12 +53,9 @@ jobs: run: cd build && make - name: Run Unit Test run: /Users/runner/work/CubbyFlow/CubbyFlow/build/bin/UnitTests - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.7' - name: Run Python Test run: | - pip install -r requirements.txt - pip install . - python -m pytest Tests/PythonTests/ \ No newline at end of file + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install . + python -m pytest Tests/PythonTests/ diff --git a/.github/workflows/scripts/actions/install_cuda_ubuntu.sh b/.github/workflows/scripts/actions/install_cuda_ubuntu.sh index cbe0c8353b..a29fd8fe26 100644 --- a/.github/workflows/scripts/actions/install_cuda_ubuntu.sh +++ b/.github/workflows/scripts/actions/install_cuda_ubuntu.sh @@ -17,6 +17,7 @@ # Ideally choose from the list of meta-packages to minimise variance between cuda versions (although it does change too) CUDA_PACKAGES_IN=( "command-line-tools" + "compiler" "libraries-dev" ) diff --git a/.github/workflows/scripts/actions/install_cuda_windows.ps1 b/.github/workflows/scripts/actions/install_cuda_windows.ps1 index 4a3958d2ff..46c66bdd66 100644 --- a/.github/workflows/scripts/actions/install_cuda_windows.ps1 +++ b/.github/workflows/scripts/actions/install_cuda_windows.ps1 @@ -16,10 +16,14 @@ $CUDA_KNOWN_URLS = @{ "10.2.89" = "http://developer.download.nvidia.com/compute/cuda/10.2/Prod/network_installers/cuda_10.2.89_win10_network.exe"; "11.0.167" = "http://developer.download.nvidia.com/compute/cuda/11.0.1/network_installers/cuda_11.0.1_win10_network.exe" "11.3.1" = "http://developer.download.nvidia.com/compute/cuda/11.3.1/network_installers/cuda_11.3.1_win10_network.exe" + "12.6.3" = "https://developer.download.nvidia.com/compute/cuda/12.6.3/network_installers/cuda_12.6.3_windows_network.exe" + "13.2.0" = "https://developer.download.nvidia.com/compute/cuda/13.2.0/network_installers/cuda_13.2.0_windows_network.exe" } # @todo - change this to be based on _MSC_VER intead, or invert it to be CUDA keyed instead? $VISUAL_STUDIO_MIN_CUDA = @{ + "2026" = "13.2"; + "2022" = "11.6"; "2019" = "10.1"; "2017" = "10.0"; # Depends on which version of 2017! 9.0 to 10.0 depending on version "2015" = "8.0"; # might support older, unsure. @@ -80,6 +84,15 @@ $VISUAL_STUDIO_YEAR = $VISUAL_STUDIO.Substring($VISUAL_STUDIO.Length-4) $CUDA_PACKAGES = "" +# CUDA 13+ separates runtime headers such as crt/host_config.h into the crt package. +if ([version]$CUDA_VERSION_FULL -ge [version]"13.0" -and -not ($CUDA_PACKAGES_IN -contains "crt")) { + $CUDA_PACKAGES_IN += "crt" +} +# CUDA 13+ requires NVVM tooling (cicc) for nvcc compilation. +if ([version]$CUDA_VERSION_FULL -ge [version]"13.0" -and -not ($CUDA_PACKAGES_IN -contains "nvvm")) { + $CUDA_PACKAGES_IN += "nvvm" +} + # for CUDA >= 11 cudart is a required package. # if([version]$CUDA_VERSION_FULL -ge [version]"11.0") { # if(-not $CUDA_PACKAGES_IN -contains "cudart") { @@ -131,12 +144,12 @@ if(Test-Path -Path $CUDA_REPO_PKG_LOCAL){ # Invoke silent install of CUDA (via network installer) Write-Output "Installing CUDA $($CUDA_VERSION_FULL). Subpackages $($CUDA_PACKAGES)" -Start-Process -Wait -FilePath .\"$($CUDA_REPO_PKG_LOCAL)" -ArgumentList "-s $($CUDA_PACKAGES)" +$installerProcess = Start-Process -Wait -PassThru -FilePath .\"$($CUDA_REPO_PKG_LOCAL)" -ArgumentList "-s $($CUDA_PACKAGES)" # Check the return status of the CUDA installer. -if (!$?) { - Write-Output "Error: CUDA installer reported error. $($LASTEXITCODE)" - exit 1 +if ($installerProcess.ExitCode -ne 0) { + Write-Output "Error: CUDA installer reported error. Exit code: $($installerProcess.ExitCode)" + exit $installerProcess.ExitCode } # Store the CUDA_PATH in the environment for the current session, to be forwarded in the action. @@ -150,4 +163,4 @@ Write-Output "CUDA_PATH_VX_Y $($CUDA_PATH_VX_Y)" # PATH needs updating elsewhere, anything in here won't persist. # Append $CUDA_PATH/bin to path. -# Set CUDA_PATH as an environmental variable \ No newline at end of file +# Set CUDA_PATH as an environmental variable diff --git a/.github/workflows/ubuntu-codecov.yml b/.github/workflows/ubuntu-codecov.yml index 359e71bfb7..7f320731ce 100644 --- a/.github/workflows/ubuntu-codecov.yml +++ b/.github/workflows/ubuntu-codecov.yml @@ -6,22 +6,31 @@ on: pull_request: branches: [ main ] +env: + PYTHON_VERSION: '3.12' + jobs: build-ubuntu: - runs-on: ${{ matrix.os }} - name: ${{ matrix.name }} strategy: matrix: include: - # Ubuntu 20.04 + gcc-9 - - name: "Ubuntu 20.04 + gcc-9" - os: ubuntu-20.04 + # Ubuntu 24.04 + gcc-14 + - name: "Ubuntu 24.04 + gcc-14" + os: ubuntu-24.04 compiler: gcc - version: "9" + version: "14" + + runs-on: ${{ matrix.os }} + name: ๐Ÿงช Code Coverage - Codecov + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: true + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} - name: Install packages run: sudo apt-get install -yq lcov - name: Configure Compiler @@ -39,5 +48,17 @@ jobs: run: cd build && make - name: Run Unit Test run: /home/runner/work/CubbyFlow/CubbyFlow/build/bin/UnitTests - - name: Upload coverage to Codecov - run: bash <(curl -s https://codecov.io/bash) \ No newline at end of file + - name: Collect coverage report + run: | + GCOV_TOOL="$(command -v gcov-${{ matrix.version }})" + lcov --gcov-tool "${GCOV_TOOL}" --ignore-errors mismatch --directory build --capture --output-file build/coverage.info + lcov --ignore-errors unused --gcov-tool "${GCOV_TOOL}" --ignore-errors mismatch --remove build/coverage.info '/usr/*' '*/Tests/*' --output-file build/coverage.info.cleaned + - name: Upload Coverage Reports to Codecov + uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: true + files: ./build/coverage.info.cleaned + flags: unittests + name: ubuntu-codecov + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true diff --git a/.github/workflows/ubuntu-cuda.yml b/.github/workflows/ubuntu-cuda.yml index 7a295e5e38..c4c8e7371f 100644 --- a/.github/workflows/ubuntu-cuda.yml +++ b/.github/workflows/ubuntu-cuda.yml @@ -1,42 +1,49 @@ -name: Ubuntu-CUDA +name: Ubuntu CUDA on: push: - branches: [ main, "gpu*" ] + branches: [ main ] pull_request: - branches: [ main, "gpu*" ] + branches: [ main ] + +env: + PYTHON_VERSION: '3.12' jobs: build-ubuntu-cuda: - runs-on: ${{ matrix.os }} - name: ${{ matrix.name }} strategy: matrix: include: - - name: "Ubuntu 20.04 + gcc-10 + CUDA 11.7 (Disable Test)" - os: ubuntu-20.04 - cuda: "11.7" + # Ubuntu 24.04 + gcc-12 + CUDA 12.6.3 + - name: "Ubuntu 24.04 + gcc-12 + CUDA 12.6.3" + os: ubuntu-24.04 + cuda: "12.6.3" compiler: gcc - version: "10" + version: "12" + + runs-on: ${{ matrix.os }} + name: ๐Ÿง CUDA Build - ${{ matrix.name }} + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: true + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + - name: Install packages + run: sudo apt-get update && sudo apt-get install -yq python3-setuptools - name: Install CUDA env: cuda: ${{ matrix.cuda }} + shell: bash run: | source ./.github/workflows/scripts/actions/install_cuda_ubuntu.sh - if [[ $? -eq 0 ]]; then - # Set paths for subsequent steps, using ${CUDA_PATH} - echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH" - echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV - echo "${CUDA_PATH}/bin" >> $GITHUB_PATH - echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV - fi - shell: bash - - name: Install Packages - run: sudo apt-get install -yq python3-setuptools + echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH" + echo "CUDA_PATH=${CUDA_PATH}" >> "$GITHUB_ENV" + echo "${CUDA_PATH}/bin" >> "$GITHUB_PATH" + echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}" >> "$GITHUB_ENV" - name: Configure Compiler run: | if [ "${{ matrix.compiler }}" = "gcc" ]; then @@ -47,6 +54,13 @@ jobs: echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV fi - name: Configure Build - run: mkdir build && cd build && cmake -DENABLE_CUDA=ON -DCMAKE_BUILD_TYPE=Release .. + run: mkdir build && cd build && cmake -DUSE_CUDA=ON -DCMAKE_BUILD_TYPE=Release .. - name: Build - run: cd build && make \ No newline at end of file + run: cd build && make + - name: Run CUDA Unit Test + run: | + if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi -L >/dev/null 2>&1; then + /home/runner/work/CubbyFlow/CubbyFlow/build/bin/CUDATests + else + echo "No CUDA-capable GPU detected on runner. Skipping CUDA unit tests." + fi diff --git a/.github/workflows/ubuntu-sonarcloud.yml b/.github/workflows/ubuntu-sonarcloud.yml index cfeba01f8a..00ed62e226 100644 --- a/.github/workflows/ubuntu-sonarcloud.yml +++ b/.github/workflows/ubuntu-sonarcloud.yml @@ -1,64 +1,64 @@ -name: Ubuntu - SonarCloud +# name: Ubuntu - SonarCloud -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] +# on: +# push: +# branches: [ main ] +# pull_request: +# branches: [ main ] -jobs: - build-ubuntu: - runs-on: ${{ matrix.os }} - name: ${{ matrix.name }} - strategy: - matrix: - include: - # Ubuntu 20.04 + gcc-9 - - name: "Ubuntu 20.04 + gcc-9" - os: ubuntu-20.04 - compiler: gcc - version: "9" - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Prepare Sonar scanner - run: | - wget -nv https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.0.2311-linux.zip - unzip -q sonar-scanner-cli-4.6.0.2311-linux.zip - echo "${PWD}/sonar-scanner-4.6.0.2311-linux/bin/" >> $GITHUB_PATH - wget -nv https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip - unzip -q build-wrapper-linux-x86.zip - echo "${PWD}/build-wrapper-linux-x86" >> $GITHUB_PATH - - name: Install packages - run: sudo apt-get install -yq gcovr ggcov lcov curl - - name: Configure Compiler - run: | - if [ "${{ matrix.compiler }}" = "gcc" ]; then - echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV - echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV - else - echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV - echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV - fi - - name: Configure Build - run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_COVERAGE=ON -DBUILD_SONARCLOUD=ON .. - - name: Build - run: cd build && build-wrapper-linux-x86-64 --out-dir ../bw-output make all - - name: Run Unit Test - run: | - cd build - lcov --gcov-tool /usr/bin/gcov -c -i -d Tests/UnitTests -o base.info - bin/UnitTests - lcov --gcov-tool /usr/bin/gcov -c -d Tests/UnitTests -o test.info - lcov --gcov-tool /usr/bin/gcov -a base.info -a test.info -o coverage.info - lcov --gcov-tool /usr/bin/gcov -r coverage.info '/usr/*' -o coverage.info - lcov --gcov-tool /usr/bin/gcov -r coverage.info '*/Examples/*' -o coverage.info - lcov --gcov-tool /usr/bin/gcov -r coverage.info '*/Libraries/*' -o coverage.info - lcov --gcov-tool /usr/bin/gcov -r coverage.info '*/Tests/*' -o coverage.info - lcov --gcov-tool /usr/bin/gcov -l coverage.info - - name: SonarCloud Scan - run: sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=cubbyflow -Dsonar.login=$SONAR_TOKEN - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file +# jobs: +# build-ubuntu: +# runs-on: ${{ matrix.os }} +# name: ${{ matrix.name }} +# strategy: +# matrix: +# include: +# # Ubuntu 20.04 + gcc-9 +# - name: "Ubuntu 20.04 + gcc-9" +# os: ubuntu-20.04 +# compiler: gcc +# version: "9" +# steps: +# - uses: actions/checkout@v2 +# with: +# submodules: true +# - name: Prepare Sonar scanner +# run: | +# wget -nv https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.0.2311-linux.zip +# unzip -q sonar-scanner-cli-4.6.0.2311-linux.zip +# echo "${PWD}/sonar-scanner-4.6.0.2311-linux/bin/" >> $GITHUB_PATH +# wget -nv https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip +# unzip -q build-wrapper-linux-x86.zip +# echo "${PWD}/build-wrapper-linux-x86" >> $GITHUB_PATH +# - name: Install packages +# run: sudo apt-get install -yq gcovr ggcov lcov curl +# - name: Configure Compiler +# run: | +# if [ "${{ matrix.compiler }}" = "gcc" ]; then +# echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV +# echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV +# else +# echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV +# echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV +# fi +# - name: Configure Build +# run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_COVERAGE=ON -DBUILD_SONARCLOUD=ON .. +# - name: Build +# run: cd build && build-wrapper-linux-x86-64 --out-dir ../bw-output make all +# - name: Run Unit Test +# run: | +# cd build +# lcov --gcov-tool /usr/bin/gcov -c -i -d Tests/UnitTests -o base.info +# bin/UnitTests +# lcov --gcov-tool /usr/bin/gcov -c -d Tests/UnitTests -o test.info +# lcov --gcov-tool /usr/bin/gcov -a base.info -a test.info -o coverage.info +# lcov --gcov-tool /usr/bin/gcov -r coverage.info '/usr/*' -o coverage.info +# lcov --gcov-tool /usr/bin/gcov -r coverage.info '*/Examples/*' -o coverage.info +# lcov --gcov-tool /usr/bin/gcov -r coverage.info '*/Libraries/*' -o coverage.info +# lcov --gcov-tool /usr/bin/gcov -r coverage.info '*/Tests/*' -o coverage.info +# lcov --gcov-tool /usr/bin/gcov -l coverage.info +# - name: SonarCloud Scan +# run: sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=cubbyflow -Dsonar.login=$SONAR_TOKEN +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 9a6283527f..56e8769aec 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -6,39 +6,58 @@ on: pull_request: branches: [ main ] +env: + PYTHON_VERSION: '3.12' + jobs: build-ubuntu: - runs-on: ${{ matrix.os }} - name: ${{ matrix.name }} strategy: matrix: include: - # Ubuntu 18.04 + gcc-9 - - name: "Ubuntu 18.04 + gcc-9" - os: ubuntu-18.04 + # Ubuntu 24.04 + gcc-14 + - name: "Ubuntu 24.04 + gcc-14" + os: ubuntu-24.04 compiler: gcc - version: "9" - # Ubuntu 20.04 + gcc-10 - - name: "Ubuntu 20.04 + gcc-10" - os: ubuntu-20.04 + version: "14" + # Ubuntu 24.04 + gcc-13 + - name: "Ubuntu 24.04 + gcc-13" + os: ubuntu-24.04 compiler: gcc - version: "10" - # Ubuntu 18.04 + clang-9 - - name: "Ubuntu 18.04 + clang-9" - os: ubuntu-18.04 + version: "13" + # Ubuntu 24.04 + gcc-12 + - name: "Ubuntu 24.04 + gcc-12" + os: ubuntu-24.04 + compiler: gcc + version: "12" + # Ubuntu 24.04 + clang-18 + - name: "Ubuntu 24.04 + clang-18" + os: ubuntu-24.04 + compiler: clang + version: "18" + # Ubuntu 24.04 + clang-17 + - name: "Ubuntu 24.04 + clang-17" + os: ubuntu-24.04 compiler: clang - version: "9" - # Ubuntu 20.04 + clang-10 - - name: "Ubuntu 20.04 + clang-10" - os: ubuntu-20.04 + version: "17" + # Ubuntu 24.04 + clang-16 + - name: "Ubuntu 24.04 + clang-16" + os: ubuntu-24.04 compiler: clang - version: "10" + version: "16" + + runs-on: ${{ matrix.os }} + name: ๐Ÿง Build - ${{ matrix.name }} + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: true + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} - name: Install packages - run: sudo apt-get install -yq python3-setuptools + run: sudo apt-get update && sudo apt-get install -yq python3-setuptools - name: Configure Compiler run: | if [ "${{ matrix.compiler }}" = "gcc" ]; then @@ -56,6 +75,7 @@ jobs: run: /home/runner/work/CubbyFlow/CubbyFlow/build/bin/UnitTests - name: Run Python Test run: | - pip3 install -r requirements.txt - pip3 install . - python3 -m pytest Tests/PythonTests/ \ No newline at end of file + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install . + python -m pytest Tests/PythonTests/ diff --git a/.github/workflows/windows-cuda.yml b/.github/workflows/windows-cuda.yml index d9b9081c87..eeb5d2ca46 100644 --- a/.github/workflows/windows-cuda.yml +++ b/.github/workflows/windows-cuda.yml @@ -1,78 +1,97 @@ -name: Windows-CUDA +name: Windows CUDA on: push: - branches: [ main, "gpu*" ] + branches: [ main ] pull_request: - branches: [ main, "gpu*" ] + branches: [ main ] + +env: + PYTHON_VERSION: '3.12' + CUDA_CACHE_ROOT: "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA" jobs: build-windows-cuda: - runs-on: ${{ matrix.os }} - name: ${{ matrix.name }} strategy: + fail-fast: false matrix: include: - - name: "Windows Server 2019 + Visual Studio 2019 + CUDA 11.3.1 (Debug)" - os: windows-2019 - cuda: "11.3.1" - visual_studio: "Visual Studio 16 2019" - configuration: Debug - - name: "Windows Server 2019 + Visual Studio 2019 + CUDA 11.3.1 (Release)" - os: windows-2019 - cuda: "11.3.1" - visual_studio: "Visual Studio 16 2019" - configuration: Release - env: - CUDA_CACHE_ROOT: "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA" + # Windows Server 2025 + Visual Studio 2026 + CUDA 13.2.0 + - name: "Windows Server 2025 + Visual Studio 2026 + CUDA 13.2.0 (Release)" + os: windows-2025-vs2026 + cuda: "13.2.0" + visual_studio: "Visual Studio 18 2026" + solution: CubbyFlow.slnx + # Windows Server 2022 + Visual Studio 2022 + CUDA 12.6.3 + - name: "Windows Server 2022 + Visual Studio 2022 + CUDA 12.6.3 (Release)" + os: windows-2022 + cuda: "12.6.3" + visual_studio: "Visual Studio 17 2022" + solution: CubbyFlow.sln + + runs-on: ${{ matrix.os }} + name: ๐ŸชŸ CUDA Build - ${{ matrix.name }} + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: true - # Install CUDA to the runner's env - - name: "Cache: CUDA" - uses: actions/cache@v2 + - name: Setup Python + uses: actions/setup-python@v5 with: - path: ${{ env.CUDA_CACHE_ROOT }} - key: ${{ matrix.os }}_cuda-${{ matrix.cuda }} - # todo: work with https://github.com/marketplace/actions/cuda-toolkit - - name: "Install/Check: CUDA" + python-version: ${{ env.PYTHON_VERSION }} + - name: Install CUDA shell: powershell env: cuda: ${{ matrix.cuda }} visual_studio: ${{ matrix.visual_studio }} - CUDA_PATH: "${{ env.CUDA_CACHE_ROOT }}\\v11.3" # using fixed path - CUDA_PATH_V11_3: "${{ env.CUDA_CACHE_ROOT }}\\v11.3" run: | - Write-Output "$env:CUDA_CACHE_ROOT" - # Install CUDA via a powershell script .\.github\workflows\scripts\actions\install_cuda_windows.ps1 - if((Test-Path "$env:CUDA_CACHE_ROOT") -eq $False){ + $cudaMajorMinor = ([regex]::Match("${{ matrix.cuda }}", "^\d+\.\d+")).Value + if (-not $cudaMajorMinor) { + throw "Failed to parse CUDA major.minor version from '${{ matrix.cuda }}'." + } + $cudaVersionVarName = "CUDA_PATH_V$($cudaMajorMinor.Replace('.', '_'))" + $cudaPath = [Environment]::GetEnvironmentVariable($cudaVersionVarName, "Machine") + if (-not $cudaPath) { + $cudaPath = "$env:CUDA_CACHE_ROOT\v$cudaMajorMinor" + } + if (-not (Test-Path $cudaPath)) { + throw "CUDA path '$cudaPath' does not exist." + } + $nvccExe = Join-Path $cudaPath "bin\nvcc.exe" + if (-not (Test-Path $nvccExe)) { + throw "nvcc executable '$nvccExe' does not exist." } - $env:PATH="$env:CUDA_PATH\bin;$env:PATH" - nvcc -V - ls $env:CUDA_PATH - ls $env:CUDA_PATH\bin - ls $env:CUDA_PATH\include - Write-Output $(Get-Command nvcc).Path - - name: "Setup: MSBuild" - uses: microsoft/setup-msbuild@v1.0.2 - - name: "Configure CMake" + "CUDA_PATH=$cudaPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "$cudaVersionVarName=$cudaPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "CUDAToolkitDir=$cudaPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "$cudaPath\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + & $nvccExe -V + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: Configure Build shell: powershell run: | - $env:PATH="$env:CUDA_PATH\\bin;$env:PATH" - $NVCC_PATH=$(Get-Command nvcc).Path - New-Item -Type Directory -Name build -Force - Push-Location build - cmake .. ` - -DCMAKE_GENERATOR_PLATFORM=x64 ` - -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ` - -DBUILD_SHARED_LIBS=false ` - -DUSE_CUDA=ON -DCUDA_CRT_LINKAGE=dynamic -DCMAKE_CUDA_COMPILER="$NVCC_PATH" - Pop-Location - env: - CUDA_PATH: "${{ env.CUDA_CACHE_ROOT }}\\v11.3" # using fixed path - CUDA_PATH_V11_3: "${{ env.CUDA_CACHE_ROOT }}\\v11.3" - - name: "Build with MSBuild" - run: MSBuild.exe CubbyFlow.sln /p:Configuration=${{ matrix.configuration }} - working-directory: ${{ github.workspace }}/build + $nvccExe = Join-Path $env:CUDA_PATH "bin\nvcc.exe" + if (-not (Test-Path $nvccExe)) { + throw "nvcc executable '$nvccExe' does not exist." + } + New-Item -ItemType Directory -Path build -Force | Out-Null + cmake -S . -B build -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=Release -DUSE_CUDA=ON -DCUDA_CRT_LINKAGE=dynamic -DCMAKE_CUDA_COMPILER="$nvccExe" -DCUDAToolkit_ROOT="$env:CUDA_PATH" + - name: Build + shell: powershell + run: MSBuild.exe "build\\${{ matrix.solution }}" /p:Configuration=Release + - name: Run CUDA Unit Test + shell: powershell + run: | + $nvidiaSmi = Get-Command "nvidia-smi.exe" -ErrorAction SilentlyContinue + if ($null -ne $nvidiaSmi) { + & nvidia-smi.exe -L | Out-Host + if ($LASTEXITCODE -eq 0) { + & /a/CubbyFlow/CubbyFlow/build/bin/Release/CUDATests.exe + exit $LASTEXITCODE + } + } + + Write-Host "No CUDA-capable GPU detected on runner. Skipping CUDA unit tests." diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 21a9260809..804ab943f2 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -6,33 +6,45 @@ on: pull_request: branches: [ main ] +env: + PYTHON_VERSION: '3.12' + jobs: build-windows: - runs-on: ${{ matrix.os }} - name: ${{ matrix.name }} strategy: matrix: include: - # Windows Server 2019 + Visual Studio 2019 - - name: "Windows Server 2019 + Visual Studio 2019" - os: windows-2019 + # Windows Server 2025 + Visual Studio 2026 + - name: "Windows Server 2025 + Visual Studio 2026" + os: windows-2025-vs2026 + solution: CubbyFlow.slnx # Windows Server 2022 + Visual Studio 2022 - name: "Windows Server 2022 + Visual Studio 2022" os: windows-2022 + solution: CubbyFlow.sln + + runs-on: ${{ matrix.os }} + name: ๐ŸชŸ Build - ${{ matrix.name }} + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: true + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} - name: Configure Build run: mkdir build && cd build && cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=Release .. - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v2 - name: Build - run: cd build && MSBuild.exe CubbyFlow.sln /p:Configuration=Release + run: cd build && MSBuild.exe ${{ matrix.solution }} /p:Configuration=Release - name: Run Unit Test run: /a/CubbyFlow/CubbyFlow/build/bin/Release/UnitTests.exe - name: Run Python Test run: | - pip install -r requirements.txt - pip install . - python -m pytest Tests/PythonTests/ \ No newline at end of file + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install . + python -m pytest Tests/PythonTests/ diff --git a/Builds/CMake/CodeCoverage.cmake b/Builds/CMake/CodeCoverage.cmake index d87d32a195..65cb5247d9 100644 --- a/Builds/CMake/CodeCoverage.cmake +++ b/Builds/CMake/CodeCoverage.cmake @@ -106,7 +106,7 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) ADD_CUSTOM_TARGET(${_targetname} # Cleanup lcov - ${LCOV_PATH} --directory . --zerocounters + COMMAND ${LCOV_PATH} --directory . --zerocounters # Run tests COMMAND ${_testrunner} ${ARGV3} @@ -123,7 +123,7 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) # Show info where to find the report ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD - COMMAND ; + COMMAND ${CMAKE_COMMAND} -E echo "Open ./${_outputname}/index.html in your browser to view the coverage report." COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." ) @@ -147,7 +147,7 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname ADD_CUSTOM_TARGET(${_targetname} # Run tests - ${_testrunner} ${ARGV3} + COMMAND ${_testrunner} ${ARGV3} # Running gcovr COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -e '${CMAKE_SOURCE_DIR}/build/' -o ${_outputname}.xml @@ -157,7 +157,7 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname # Show info where to find the report ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD - COMMAND ; + COMMAND ${CMAKE_COMMAND} -E echo "Cobertura code coverage report saved in ${_outputname}.xml." COMMENT "Cobertura code coverage report saved in ${_outputname}.xml." ) diff --git a/CMakeLists.txt b/CMakeLists.txt index a171d4356c..44ff9fdeaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,12 @@ # CMake version -cmake_minimum_required(VERSION 3.18.6 FATAL_ERROR) +cmake_minimum_required(VERSION 3.31.6 FATAL_ERROR) cmake_policy(SET CMP0063 NEW) # visibility +if (POLICY CMP0146) + cmake_policy(SET CMP0146 OLD) # Keep legacy FindCUDA module behavior on newer CMake. +endif() +if (POLICY CMP0147) + cmake_policy(SET CMP0147 OLD) # Required for legacy FindCUDA with Visual Studio generators. +endif() set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) @@ -49,13 +55,18 @@ if (USE_CUDA) find_package(CUDA) if (CUDA_FOUND) # Modify project options for CUDA build enable_language(CUDA) + if (EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/include/cccl") + include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include/cccl") + endif() cuda_select_nvcc_arch_flags(CUDA_NVCC_FLAGS "7.5" "Turing") # We will use CUDA_TARGET_OPTIONS instead of CUDA_NVCC_FLAGS to be explicit. # start with architecture options list(APPEND CUDA_TARGET_OPTIONS "--std=c++17" "-Wno-deprecated-gpu-targets") if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor") list(APPEND CUDA_TARGET_OPTIONS "-Xcompiler" "/FS") # prevent race on PDB + list(APPEND CUDA_TARGET_OPTIONS "-Xcompiler" "/Zc:preprocessor") # required by CUDA 13 + VS 2026 if (CUDA_CRT_LINKAGE STREQUAL "dynamic") if (CMAKE_BUILD_TYPE MATCHES Debug) list(APPEND CUDA_TARGET_OPTIONS "-Xcompiler" "/MDd" "--debug" "-O0") @@ -100,6 +111,9 @@ include(Builds/CMake/TaskingSystemOptions.cmake) # Compile options include(Builds/CMake/CompileOptions.cmake) +if (USE_CUDA AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + list(APPEND DEFAULT_COMPILE_OPTIONS /wd4505) +endif() # Code coverage - Debug only # NOTE: Code coverage results with an optimized (non-Debug) build may be misleading @@ -174,4 +188,4 @@ if (NOT USE_CUDA AND NOT BUILD_SONARCLOUD) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${DEFAULT_CMAKE_LIBRARY_OUTPUT_DIRECTORY}) endif() add_subdirectory(Sources/API/Python) -endif() \ No newline at end of file +endif() diff --git a/Includes/Core/Matrix/MatrixCSR-Impl.hpp b/Includes/Core/Matrix/MatrixCSR-Impl.hpp index ba0b678e40..f7a94c82d9 100644 --- a/Includes/Core/Matrix/MatrixCSR-Impl.hpp +++ b/Includes/Core/Matrix/MatrixCSR-Impl.hpp @@ -15,6 +15,8 @@ #include #include +#include + namespace CubbyFlow { template diff --git a/Includes/Core/Utils/Logging.hpp b/Includes/Core/Utils/Logging.hpp index 6cd95de860..ff11424222 100644 --- a/Includes/Core/Utils/Logging.hpp +++ b/Includes/Core/Utils/Logging.hpp @@ -11,6 +11,7 @@ #ifndef CUBBYFLOW_LOGGER_HPP #define CUBBYFLOW_LOGGER_HPP +#include #include namespace CubbyFlow diff --git a/Libraries/doctest b/Libraries/doctest index 4d8716f1ef..1da23a3e81 160000 --- a/Libraries/doctest +++ b/Libraries/doctest @@ -1 +1 @@ -Subproject commit 4d8716f1efc1d14aa736ef52ee727bd4204f4c40 +Subproject commit 1da23a3e8119ec5cce4f9388e91b065e20bf06f5 diff --git a/Libraries/googletest b/Libraries/googletest index 58d77fa807..52eb8108c5 160000 --- a/Libraries/googletest +++ b/Libraries/googletest @@ -1 +1 @@ -Subproject commit 58d77fa8070e8cec2dc1ed015d66b454c8d78850 +Subproject commit 52eb8108c5bdec04579160ae17225d66034bd723 diff --git a/Libraries/pybind11 b/Libraries/pybind11 index 8de7772cc7..45fab4087e 160000 --- a/Libraries/pybind11 +++ b/Libraries/pybind11 @@ -1 +1 @@ -Subproject commit 8de7772cc72daca8e947b79b83fea46214931604 +Subproject commit 45fab4087eaaff234227a10cf7845e8b07f28a98 diff --git a/Sources/Core/Geometry/Sphere.cpp b/Sources/Core/Geometry/Sphere.cpp index e1b95ec727..6a927f0927 100644 --- a/Sources/Core/Geometry/Sphere.cpp +++ b/Sources/Core/Geometry/Sphere.cpp @@ -10,6 +10,8 @@ #include +#include + namespace CubbyFlow { template diff --git a/Sources/Core/Geometry/Surface.cpp b/Sources/Core/Geometry/Surface.cpp index e205cfcc72..df710d9010 100644 --- a/Sources/Core/Geometry/Surface.cpp +++ b/Sources/Core/Geometry/Surface.cpp @@ -10,6 +10,8 @@ #include +#include + namespace CubbyFlow { template diff --git a/Sources/Core/Utils/Logging.cpp b/Sources/Core/Utils/Logging.cpp index ef928c000f..d0777cc194 100644 --- a/Sources/Core/Utils/Logging.cpp +++ b/Sources/Core/Utils/Logging.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include diff --git a/Tests/UnitTests/VolumeParticleEmitter2Tests.cpp b/Tests/UnitTests/VolumeParticleEmitter2Tests.cpp index 18dae19890..273a7bbbca 100644 --- a/Tests/UnitTests/VolumeParticleEmitter2Tests.cpp +++ b/Tests/UnitTests/VolumeParticleEmitter2Tests.cpp @@ -34,7 +34,7 @@ TEST(VolumeParticleEmitter2, Emit) BoundingBox2D box({ 0.0, 0.0 }, { 3.0, 3.0 }); - VolumeParticleEmitter2 emitter(sphere, box, 0.3, { -1.0, 0.5 }, + VolumeParticleEmitter2 emitter(sphere, box, 0.35, { -1.0, 0.5 }, { 3.0, 4.0 }, 5.0, 30, 0.0, false, false); auto particles = std::make_shared(); @@ -62,7 +62,7 @@ TEST(VolumeParticleEmitter2, Emit) emitter.SetMaxNumberOfParticles(60); emitter.Update(frame.TimeInSeconds(), frame.timeIntervalInSeconds); - EXPECT_EQ(51u, particles->NumberOfParticles()); + EXPECT_EQ(41u, particles->NumberOfParticles()); pos = particles->Positions(); for (size_t i = 0; i < particles->NumberOfParticles(); ++i) @@ -72,7 +72,7 @@ TEST(VolumeParticleEmitter2, Emit) ++frame; emitter.Update(frame.TimeInSeconds(), frame.timeIntervalInSeconds); - EXPECT_LT(51u, particles->NumberOfParticles()); + EXPECT_LT(41u, particles->NumberOfParticles()); } TEST(VolumeParticleEmitter2, Builder)