-
Notifications
You must be signed in to change notification settings - Fork 0
271 lines (233 loc) · 7.18 KB
/
benchmarks.yml
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: Bench
on:
workflow_dispatch:
push:
branches:
- main
paths:
- .github/workflows/benchmarks.yml
- polylang/Cargo.lock
- polylang/benches/bench.rs
- miden/Cargo.lock
- miden/benches/bench.rs
- risc-zero/host/Cargo.toml
- risc-zero/host/benches/bench.rs
- noir/benches/bench.rs
- noir/Cargo.lock
env:
AWS_REGION: us-east-1
# comma seperated list of instances to start/stop for this action
INSTANCE_ID: i-0c9244d7e2b3893b5
jobs:
start-runner:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Start existing EC2 instance
run: |
aws ec2 start-instances --instance-ids ${INSTANCE_ID}
echo "Waiting for instance to be ready..."
aws ec2 wait instance-running --instance-ids ${INSTANCE_ID}
polylang:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ['ubuntu-16-shared', 'ubuntu-latest-64-cores']
needs: start-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Run Polylang Multi CPU benchmarks
working-directory: ./polylang
if: matrix.runner != 'macos-dedicated'
env:
BENCHY_OUTPUT_DIR: "../.benchmarks/${{ matrix.runner }}"
run: |
cargo bench -F multi-cpu
- name: Run Polylang Metal benchmarks
if: matrix.runner == 'macos-dedicated'
working-directory: ./polylang
env:
BENCHY_OUTPUT_DIR: "../.benchmarks/${{ matrix.runner }}"
run: |
cargo bench
- name: Upload .benchmarks as artifact
uses: actions/upload-artifact@v3
with:
path: .benchmarks/
miden:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ['ubuntu-16-shared', 'ubuntu-latest-64-cores']
needs: start-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Run Miden Multi CPU benchmarks
working-directory: ./miden
if: matrix.runner != 'macos-dedicated'
env:
BENCHY_OUTPUT_DIR: "../.benchmarks/${{ matrix.runner }}"
run: |
cargo bench -F multi-cpu
- name: Run Miden Metal benchmarks
if: matrix.runner == 'macos-dedicated'
working-directory: ./miden
env:
BENCHY_OUTPUT_DIR: "../.benchmarks/${{ matrix.runner }}"
run: |
cargo bench -F metal
- name: Upload .benchmarks as artifact
uses: actions/upload-artifact@v3
with:
path: .benchmarks/
risc_zero:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ['ubuntu-16-shared', 'ubuntu-latest-64-cores']
needs: start-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Cache cargo bin
uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
- name: Install risczero
run: cargo install cargo-risczero && cargo risczero install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Risc-Zero Multi CPU benchmarks
working-directory: ./risc-zero/host
if: matrix.runner != 'macos-dedicated'
env:
BENCHY_OUTPUT_DIR: "../../.benchmarks/${{ matrix.runner }}"
run: |
cargo bench
- name: Run Risc-Zero Metal benchmarks
if: matrix.runner == 'macos-dedicated'
working-directory: ./risc-zero/host
env:
BENCHY_OUTPUT_DIR: "../../.benchmarks/${{ matrix.runner }}"
run: |
cargo bench -F metal
- name: Upload .benchmarks as artifact
uses: actions/upload-artifact@v3
with:
path: .benchmarks/
noir:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ['ubuntu-16-shared', 'ubuntu-latest-64-cores']
needs: start-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Install Nix
run: |
sh <(curl -L https://nixos.org/nix/install)
source $HOME/.nix-profile/etc/profile.d/nix.sh
- name: Run cargo bench in Nix shell
working-directory: ./noir
env:
BENCHY_OUTPUT_DIR: "../.benchmarks/${{ matrix.runner }}"
run: |
source $HOME/.nix-profile/etc/profile.d/nix.sh
nix-shell --run "nix-shell -p clang --run 'cargo bench'"
- name: Upload .benchmarks as artifact
uses: actions/upload-artifact@v3
with:
path: .benchmarks/
leo:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ['ubuntu-16-shared', 'ubuntu-latest-64-cores']
needs: start-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Run Leo benchmarks
working-directory: ./leo
env:
BENCHY_OUTPUT_DIR: "../.benchmarks/${{ matrix.runner }}"
run: |
cargo bench
- name: Upload .benchmarks as artifact
uses: actions/upload-artifact@v3
with:
path: .benchmarks/
commit:
runs-on: ubuntu-latest
needs: [polylang, miden, risc_zero, noir]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download benchmarks artifacts
uses: actions/download-artifact@v3
with:
path: .benchmarks
- name: Combine results
run: ./combine.py
- name: Copy benchmark results to site
run: |
cp benchmarks.json site/src/fixtures/benchmarks.json
- name: Commit benchmark results
run: |
git config --global user.email "calum.moore@gmail.com" \
&& git config --global user.name "Polybase CI" \
&& git add . \
&& git commit -m "Update benchmarks" \
&& git push
clean-up:
runs-on: ubuntu-latest
needs: [polylang, miden, risc_zero, noir]
if: always()
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Stop EC2 instance
run: aws ec2 stop-instances --instance-ids ${{ env.INSTANCE_ID }}