ci-benchmark #1909
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: ci-benchmark | |
| on: | |
| schedule: | |
| - cron: '0 */4 * * *' # run every 4 hours | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| checks: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows, linux] | |
| config: [Release] | |
| python: ["3.10"] | |
| include: | |
| # Builds running on self-hosted runners | |
| - { os: windows, platform: x86_64, compiler: msvc, config: Release, flags: "benchmark", runs-on: { group: nvrgfx, labels: [Windows, X64, nvrgfx-perf] } } | |
| - { os: linux, platform: x86_64, compiler: gcc, config: Release, flags: "benchmark", runs-on: { group: nvrgfx, labels: [Linux, X64] } } | |
| env: | |
| # Environment variables used by ci.py | |
| CI_OS: ${{ matrix.os }} | |
| CI_PLATFORM: ${{ matrix.platform }} | |
| CI_COMPILER: ${{ matrix.compiler }} | |
| CI_CONFIG: ${{ matrix.config }} | |
| CI_PYTHON: ${{ matrix.python }} | |
| CI_FLAGS: ${{ matrix.flags }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| lfs: true | |
| - name: Cleanup submodules # Fix for https://github.com/actions/checkout/issues/358 | |
| run: | | |
| git submodule foreach --recursive git clean -ffdx | |
| git submodule foreach --recursive git reset --hard | |
| # Setup Linux. | |
| - name: Setup Linux | |
| if: startsWith(matrix.os, 'linux') && contains(matrix.runs-on, 'ubuntu-') | |
| run: | | |
| sudo apt update && sudo apt install -y libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config | |
| # Setup Python. | |
| - name: Setup Python ${{ matrix.python }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| # Setup Python environment. | |
| - name: Setup Python environment | |
| run: | | |
| python -m pip install -r requirements-dev.txt | |
| python -m pip install -r samples/requirements.txt | |
| python -m pip install pytest-github-actions-annotate-failures | |
| # Setup PyTorch environment | |
| - name: Setup PyTorch environment | |
| if: runner.os != 'macos' && contains(matrix.flags, 'unit-test') | |
| run: | | |
| python -m pip install torch==2.8.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 | |
| # Setup MSVC. | |
| - name: Setup MSVC | |
| uses: step-security/msvc-dev-cmd@v1 | |
| # Setup CMake/Ninja. | |
| - name: Setup CMake/Ninja | |
| uses: lukka/get-cmake@latest | |
| # Build latest Slang. | |
| # - name: Build latest Slang | |
| # run: | | |
| # git clone --recursive https://github.com/shader-slang/slang.git | |
| # cd slang | |
| # mkdir build | |
| # cmake -B build --preset default | |
| # cmake --build build --config ${{ matrix.config }} --parallel | |
| # Setup. | |
| - name: Setup | |
| run: python tools/ci.py setup | |
| # Setup vcpkg caching. | |
| # Only run on hosted runners. | |
| # For self-hosted runners, we use a local cache directory. | |
| - name: Set vcpkg cache directory | |
| if: startsWith(matrix.runs-on, 'ubuntu-') || startsWith(matrix.runs-on, 'macos-') || startsWith(matrix.runs-on, 'windows-') | |
| run: | | |
| echo "VCPKG_DEFAULT_BINARY_CACHE=${{ github.workspace }}/vcpkg-cache" >> $GITHUB_ENV | |
| mkdir -p ${{ github.workspace }}/vcpkg-cache | |
| - name: Setup vcpkg caching | |
| if: startsWith(matrix.runs-on, 'ubuntu-') || startsWith(matrix.runs-on, 'macos-') || startsWith(matrix.runs-on, 'windows-') | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} | |
| key: vcpkg-cache-${{ runner.os }}-${{ matrix.platform }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json', 'external/vcpkg-triplets/**') }} | |
| # Configure. | |
| - name: Configure | |
| # run: python tools/ci.py --cmake-args="-DSGL_LOCAL_SLANG=ON -DSGL_LOCAL_SLANG_DIR=slang -DSGL_LOCAL_SLANG_BUILD_DIR=build/${{ matrix.config }}" configure | |
| run: python tools/ci.py configure | |
| # Build. | |
| - name: Build | |
| run: python tools/ci.py build | |
| # Benchmark (Python) | |
| - name: Benchmark (Python) | |
| if: contains(matrix.flags, 'benchmark') | |
| run: python tools/ci.py benchmark-python --run-id "${{ github.run_id }}" --mongodb-connection-string "${{ secrets.BENCHMARK_MONGODB_CONNECTION_STRING }}" --mongodb-database-name "nvr-ci" --lock-gpu-clocks |