Update benchmark.yaml #8
Workflow file for this run
This file contains 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: Benchmarks | |
on: | |
push: | |
branches: [stwo-backend] | |
pull_request: | |
branches: [stwo-backend] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "--cfg tokio_unstable" | |
permissions: | |
contents: write | |
pages: write | |
jobs: | |
benchmark: | |
name: Run benchmarks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Initialize gh-pages branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
# Check if gh-pages branch exists remotely | |
if ! git ls-remote --heads origin gh-pages | grep gh-pages > /dev/null; then | |
# Create and set up gh-pages branch | |
git checkout --orphan gh-pages | |
git rm -rf . | |
mkdir -p dev/bench/data | |
echo "# Benchmark Results" > dev/bench/data/README.md | |
# Create initial index.html that will redirect to the correct location | |
echo '<!DOCTYPE html><meta http-equiv="refresh" content="0; url=criterion/summary/">' > index.html | |
git add dev/bench/data/README.md index.html | |
git commit -m "Initialize gh-pages branch" | |
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git gh-pages | |
fi | |
# Return to the original branch | |
git checkout ${GITHUB_REF##*/} | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-01-04 | |
components: rustfmt, clippy | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Install required packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config libssl-dev jq gnuplot | |
- name: Run benchmarks and format output | |
run: | | |
# Run the benchmarks and capture the output | |
cargo +nightly-2024-01-04 bench --bench tensor_ops | |
# Create benchmark report directory structure | |
mkdir -p target/criterion/summary | |
# Create the summary page | |
cat > target/criterion/summary/index.html << 'EOL' | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Circuit Operation Benchmarks</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
body { | |
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu; | |
margin: 0; | |
padding: 2rem; | |
line-height: 1.5; | |
} | |
.container { | |
max-width: 1200px; | |
margin: 0 auto; | |
} | |
.operation { | |
margin: 2rem 0; | |
padding: 2rem; | |
border-radius: 8px; | |
background: #f8f9fa; | |
box-shadow: 0 2px 4px rgba(0,0,0,0.1); | |
} | |
h1 { | |
color: #2c3e50; | |
margin-bottom: 2rem; | |
} | |
h2 { | |
color: #34495e; | |
border-bottom: 2px solid #eee; | |
padding-bottom: 0.5rem; | |
} | |
.phase-grid { | |
display: grid; | |
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); | |
gap: 1rem; | |
margin-top: 1rem; | |
} | |
.phase-card { | |
background: white; | |
padding: 1rem; | |
border-radius: 6px; | |
box-shadow: 0 1px 3px rgba(0,0,0,0.1); | |
} | |
.phase-card h3 { | |
margin-top: 0; | |
color: #3498db; | |
} | |
a { | |
color: #3498db; | |
text-decoration: none; | |
transition: color 0.2s; | |
} | |
a:hover { | |
color: #2980b9; | |
text-decoration: underline; | |
} | |
.commit-info { | |
margin-top: 2rem; | |
padding: 1rem; | |
background: #e1f5fe; | |
border-radius: 6px; | |
} | |
.benchmark-details { | |
margin-top: 1rem; | |
font-size: 0.9em; | |
color: #666; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<h1>LuminAIR Benchmark, by Giza</h1> | |
<div class="commit-info"> | |
<strong>Latest Commit:</strong> ${{ github.sha }} | |
<br> | |
<strong>Run Date:</strong> $(date) | |
</div> | |
<div class="operation"> | |
<h2>TensorAdd</h2> | |
<div class="phase-grid"> | |
<div class="phase-card"> | |
<h3>Trace Generation</h3> | |
<a href="../../TensorAdd/trace_generation/report/">View Results</a> | |
<div class="benchmark-details"> | |
Test cases: 2x2, 50x50, 100x100 matrices | |
</div> | |
</div> | |
<div class="phase-card"> | |
<h3>Proving</h3> | |
<a href="../../TensorAdd/proving/report/">View Results</a> | |
<div class="benchmark-details"> | |
STARK proof generation time | |
</div> | |
</div> | |
<div class="phase-card"> | |
<h3>Verification</h3> | |
<a href="../../TensorAdd/verification/report/">View Results</a> | |
<div class="benchmark-details"> | |
STARK proof verification time | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> | |
EOL | |
# Create dummy JSON data for github-action-benchmark | |
cat > benchmark_output.json << EOF | |
[ | |
{ | |
"name": "TensorAdd/trace_generation/2x2_+_2x2", | |
"value": 1000, | |
"range": 100, | |
"unit": "ns" | |
}, | |
{ | |
"name": "TensorAdd/proving/2x2_+_2x2", | |
"value": 2000, | |
"range": 200, | |
"unit": "ns" | |
}, | |
{ | |
"name": "TensorAdd/verification/2x2_+_2x2", | |
"value": 1500, | |
"range": 150, | |
"unit": "ns" | |
} | |
] | |
EOF | |
- name: Store benchmark results | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
name: Rust Circuit Benchmarks | |
tool: "customSmallerIsBetter" | |
output-file-path: benchmark_output.json | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: true | |
alert-threshold: "150%" | |
comment-on-alert: true | |
fail-on-alert: true | |
gh-pages-branch: gh-pages | |
benchmark-data-dir-path: dev/bench/data | |
- name: Deploy benchmark results | |
if: github.ref == 'refs/heads/stwo-backend' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: target/criterion | |
publish_branch: gh-pages | |
keep_files: true |