Skip to content

Benchmark Reports

Benchmark Reports #45

Workflow file for this run

name: Benchmark Reports
on:
schedule:
- cron: '0 7 * * *' # Nightly (ish) Pacific
workflow_dispatch:
# uncomment for only for testing changes to this workflow while in a PR
# pull_request:
# branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# this is needed to gain access via OIDC to the S3 bucket for caching
permissions:
id-token: write
contents: read
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_BUILD_LOCKED: 1
RISC0_RUST_TOOLCHAIN_VERSION: r0.1.79.0-2
RISC0_CPP_TOOLCHAIN_VERSION: 2024.01.05
jobs:
bench:
runs-on: [self-hosted, prod, bench, "${{ matrix.os }}", "${{ matrix.device }}"]
strategy:
fail-fast: false
matrix:
include:
- os: Linux
feature: prove
device: cpu
- os: Linux
feature: cuda
device: nvidia_rtx_3090_ti
- os: Linux
feature: cuda
device: g6.xlarge
- os: macOS
feature: prove
device: apple_m2_pro
env:
FEATURE: ${{ matrix.feature }}
EXTRA: ""
steps:
- uses: actions/checkout@v4
- if: matrix.feature == 'cuda'
uses: ./.github/actions/cuda
- uses: ./.github/actions/rustup
- uses: ./.github/actions/sccache
with:
key: ${{ matrix.os }}-${{ matrix.feature }}
- run: cargo run --bin rzup -- --verbose install rust $RISC0_RUST_TOOLCHAIN_VERSION
- run: cargo run --bin rzup -- --verbose install cpp $RISC0_CPP_TOOLCHAIN_VERSION
- name: Save commit hash to a file
run: |
echo "${{ github.sha }}" > benchmarks/COMMIT_HASH.txt
echo "${{ github.sha }}" > risc0/zkvm/COMMIT_HASH.txt
- run: cargo run --release -F $FEATURE -- --out ${{ matrix.os }}-${{ matrix.device }}.csv
working-directory: benchmarks
- name: Upload benchmarks
uses: actions/upload-artifact@v4
with:
name: benchmark-result-${{ matrix.os }}-${{ matrix.device }}
path: |
benchmarks/COMMIT_HASH.txt
benchmarks/${{ matrix.os }}-${{ matrix.device }}.csv
- if: matrix.feature == 'cuda'
run: echo "EXTRA=-F docker" >> $GITHUB_ENV
- name: Generate datasheet
run: cargo run --release -F $FEATURE $EXTRA --example datasheet -- --json risc0/zkvm/${{ matrix.os }}-${{ matrix.device }}.json
- name: Upload datasheet
uses: actions/upload-artifact@v4
with:
name: datasheet-result-${{ matrix.os }}-${{ matrix.device }}
path: |
risc0/zkvm/COMMIT_HASH.txt
risc0/zkvm/${{ matrix.os }}-${{ matrix.device }}.json
publish:
needs: bench
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages repository branch ${{ github.base_ref || github.ref_name }}
uses: actions/checkout@v4
with:
repository: risc0/ghpages
token: ${{ secrets.BENCHMARK_TOKEN }}
ref: ${{ github.base_ref || github.ref_name }}
- name: Download benchmarks
uses: actions/download-artifact@v4
with:
pattern: benchmark-result-*
path: dev/benchmarks
merge-multiple: true
- name: Download datasheet
uses: actions/download-artifact@v4
with:
pattern: datasheet-result-*
path: dev/datasheet
merge-multiple: true
- name: Push results
run: |
git config user.name "r0-ghbot"
git config user.email "[email protected]"
git add --all
if git diff --cached --exit-code; then
echo "No changes to commit"
else
git commit -m "Add build artifacts"
git push
fi
alert_devops_if_failed:
runs-on: ubuntu-latest
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }}
needs: [bench, publish]
steps:
- name: DevOps Alert
env:
NEEDS: ${{ toJSON(needs) }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"Benchmark Reports Job Failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' ${{ secrets.DEVOPS_ALERT_WEBHOOK_URL }}