-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (165 loc) · 5.76 KB
/
Copy pathrun-benchmark.yml
File metadata and controls
192 lines (165 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Run Benchmark
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
inputs:
instance_family:
description: Instance family to use for the benchmark runner
type: string
required: false
default: g6e.2xlarge
mode:
description: Host harness mode
type: choice
required: false
default: prove-stark
options:
- execute
- execute-metered
- prove-app
- prove-stark
host_profile:
description: Cargo profile for the host harness
type: choice
required: false
default: release
options:
- dev
- release
iterations:
description: Optional CoreMark ITERATIONS override
type: string
required: false
default: ""
concurrency:
group: ${{ github.workflow_ref }}-run-benchmark-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
jobs:
benchmark:
name: Run Host Benchmark
env:
BENCH_HOST_PROFILE: ${{ inputs.host_profile || 'release' }}
BENCH_ITERATIONS: ${{ inputs.iterations || '' }}
BENCH_MODE: ${{ inputs.mode || 'prove-stark' }}
runs-on:
- runs-on
- run-id=${{ github.run_id }}
- family=${{ inputs.instance_family || 'g6e.2xlarge' }}
- disk=large
- tag=bench-coremark-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
- extras=s3-cache
- spot=false
- image=${{ startsWith(inputs.instance_family || 'g6e.2xlarge', 'g') && 'ubuntu24-gpu-x64' || contains(inputs.instance_family || 'g6e.2xlarge', 'g.') && 'ubuntu24-full-arm64' || 'ubuntu24-full-x64' }}
timeout-minutes: 180
steps:
- uses: runs-on/action@v2
- name: Checkout repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
env:
RUSTUP_PERMIT_COPY_RENAME: "1"
with:
toolchain: nightly-2025-08-19
components: clippy,rustfmt
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y gnuplot
- name: Verify GPU setup
if: ${{ startsWith(inputs.instance_family || 'g6e.2xlarge', 'g') }}
run: |
nvidia-smi
nvidia-smi -L
- name: Resolve RISC-V GCC
run: |
candidates=(
riscv32-unknown-elf-gcc
riscv64-unknown-elf-gcc
riscv32-linux-gnu-gcc
riscv64-linux-gnu-gcc
riscv-none-elf-gcc
riscv64-unknown-linux-gnu-gcc
)
for cc in "${candidates[@]}"; do
if command -v "$cc" >/dev/null 2>&1; then
echo "OPENVM_GUEST_GCC=$cc" >> "$GITHUB_ENV"
echo "Using $cc"
exit 0
fi
done
sudo apt-get update
sudo apt-get install -y gcc-riscv64-unknown-elf
if command -v riscv64-unknown-elf-gcc >/dev/null 2>&1; then
echo "OPENVM_GUEST_GCC=riscv64-unknown-elf-gcc" >> "$GITHUB_ENV"
echo "Installed and using riscv64-unknown-elf-gcc"
exit 0
fi
echo "No supported RISC-V GCC toolchain was found." >&2
exit 1
- name: Checkout openvm
run: git clone --depth=1 --branch="v2.0.0" https://github.com/openvm-org/openvm.git
- name: Install cargo-openvm
working-directory: openvm/crates/cli
run: cargo install --force --locked --profile=release --path .
- name: Install openvm-prof
working-directory: openvm/crates/prof
run: cargo install --force --profile=dev --path .
- name: Build and stage guest ELF
run: |
mkdir -p host/elf
if [[ -n "$BENCH_ITERATIONS" ]]; then
CFLAGS="-DITERATIONS=$BENCH_ITERATIONS" cargo openvm build
else
cargo openvm build
fi
cp target/riscv32im-risc0-zkvm-elf/release/openvm-coremark host/elf/openvm-coremark
- name: Run host harness benchmark
run: |
./host/scripts/run_coremark.sh \
--mode "$BENCH_MODE" \
--profile "$BENCH_HOST_PROFILE"
- name: Generate openvm-prof outputs
run: |
openvm-prof --json-paths metrics.json --output-json openvm-prof.json
- name: Add benchmark summary
if: always()
run: |
echo "## Host Benchmark" >> "$GITHUB_STEP_SUMMARY"
echo "- Mode: \`$BENCH_MODE\`" >> "$GITHUB_STEP_SUMMARY"
echo "- Host profile: \`$BENCH_HOST_PROFILE\`" >> "$GITHUB_STEP_SUMMARY"
if [[ -n "$BENCH_ITERATIONS" ]]; then
echo "- ITERATIONS override: \`$BENCH_ITERATIONS\`" >> "$GITHUB_STEP_SUMMARY"
fi
echo "" >> "$GITHUB_STEP_SUMMARY"
if [[ -f metrics.md ]]; then
cat metrics.md >> "$GITHUB_STEP_SUMMARY"
elif [[ -f metrics.json ]]; then
echo "Generated \`metrics.json\`, but no markdown summary was found." >> "$GITHUB_STEP_SUMMARY"
else
echo "No benchmark metrics were generated." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload benchmark artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: host-benchmark-${{ inputs.mode || 'prove-stark' }}-${{ github.run_id }}
if-no-files-found: warn
path: |
metrics.json
metrics.md
metrics.detailed.md
openvm-prof.json
gpu_memory_usage.csv