Skip to content

Commit f4a9bf9

Browse files
chore: add CUDA code to lint + primitive test CIs (#1997)
1 parent 25cc258 commit f4a9bf9

File tree

5 files changed

+73
-11
lines changed

5 files changed

+73
-11
lines changed

.github/workflows/lints.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,39 @@ jobs:
8686
run: |
8787
cargo binstall --no-confirm --force cargo-audit
8888
cargo audit
89+
90+
lint-cuda:
91+
name: Lint CUDA
92+
runs-on:
93+
- runs-on=${{ github.run_id }}
94+
- family=g6.xlarge
95+
- image=ubuntu24-gpu-x64
96+
- extras=s3-cache
97+
98+
steps:
99+
- uses: runs-on/action@v1
100+
- uses: actions/checkout@v4
101+
102+
- uses: dtolnay/rust-toolchain@stable
103+
- uses: Swatinem/rust-cache@v2
104+
with:
105+
cache-on-failure: true
106+
107+
- name: Verify CUDA setup
108+
run: |
109+
nvidia-smi
110+
nvidia-smi -L
111+
nvcc --version
112+
113+
- name: Run fmt
114+
working-directory: crates
115+
run: |
116+
rustup install nightly
117+
rustup component add --toolchain nightly rustfmt
118+
cargo +nightly fmt --all -- --check
119+
120+
- name: Run clippy
121+
run: |
122+
# includes GPU specific features cuda and touchemall
123+
cargo clippy --all-targets --all --tests --features "aggregation bls12_381 bn254 build-elfs cuda default entrypoint evm-prove evm-verify export-intrinsics export-libm function-span getrandom-unsupported halo2-compiler halo2curves heap-embedded-alloc jemalloc jemalloc-prof metrics nightly-features panic-handler parallel perf-metrics rust-runtime static-verifier std test-utils touchemall" -- -D warnings
124+
cargo clippy --all-targets --all --tests --no-default-features --features "jemalloc jemalloc-prof" -- -D warnings

.github/workflows/primitives.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ env:
2323

2424
jobs:
2525
build:
26+
strategy:
27+
matrix:
28+
config:
29+
- { family: "c7g.8xlarge", image: "ubuntu24-full-arm64" }
30+
- { family: "g6.xlarge", image: "ubuntu24-gpu-x64" }
31+
2632
runs-on:
2733
- runs-on=${{ github.run_id }}
28-
- runner=32cpu-linux-arm64
29-
- image=ubuntu24-full-arm64
34+
- family=${{ matrix.config.family }}
35+
- image=${{ matrix.config.image }}
3036
- extras=s3-cache
3137

3238
steps:
@@ -38,22 +44,40 @@ jobs:
3844
cache-on-failure: true
3945
- uses: taiki-e/install-action@nextest
4046

47+
- name: Set CPU tests environment variables
48+
if: matrix.config.family != 'g6.xlarge'
49+
run: |
50+
echo "NEXTEST_ENV=" >> $GITHUB_ENV
51+
echo "NEXTEST_ARGS=--cargo-profile fast --features parallel" >> $GITHUB_ENV
52+
53+
- name: Check CUDA status and set environment variables
54+
if: matrix.config.family == 'g6.xlarge'
55+
run: |
56+
nvidia-smi
57+
nvidia-smi -L
58+
nvcc --version
59+
60+
echo "NEXTEST_ENV=CUDA_OPT_LEVEL=1" >> $GITHUB_ENV
61+
echo "NEXTEST_ARGS=cuda --features parallel,cuda,touchemall" >> $GITHUB_ENV
62+
4163
- name: Run tests for primitives
4264
working-directory: crates/circuits/primitives
4365
run: |
44-
cargo nextest run --cargo-profile fast --features parallel
66+
${{ env.NEXTEST_ENV }} cargo nextest run ${{ env.NEXTEST_ARGS }}
4567
4668
- name: Run tests for poseidon2-air
4769
working-directory: crates/circuits/poseidon2-air
4870
run: |
49-
cargo nextest run --cargo-profile fast --features parallel
71+
${{ env.NEXTEST_ENV }} cargo nextest run ${{ env.NEXTEST_ARGS }}
5072
5173
- name: Run tests for sha256-air
74+
if: matrix.config.family != 'g6.xlarge'
5275
working-directory: crates/circuits/sha256-air
5376
run: |
54-
cargo nextest run --cargo-profile fast --features parallel
77+
${{ env.NEXTEST_ENV }} cargo nextest run ${{ env.NEXTEST_ARGS }}
5578
5679
- name: Run tests for mod-builder
80+
if: matrix.config.family != 'g6.xlarge'
5781
working-directory: crates/circuits/mod-builder
5882
run: |
59-
cargo nextest run --cargo-profile fast --features parallel
83+
${{ env.NEXTEST_ENV }} cargo nextest run ${{ env.NEXTEST_ARGS }}

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/circuits/poseidon2-air/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ openvm-cuda-builder.workspace = true
3434
default = ["parallel"]
3535
parallel = ["openvm-stark-backend/parallel"]
3636
cuda = ["dep:openvm-cuda-common", "dep:openvm-cuda-backend"]
37+
touchemall = ["openvm-cuda-backend/touchemall"]

crates/circuits/primitives/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ openvm-cuda-builder.workspace = true
3232
default = ["parallel"]
3333
parallel = ["openvm-stark-backend/parallel"]
3434
cuda = ["dep:openvm-cuda-common", "dep:openvm-cuda-backend"]
35+
touchemall = ["openvm-cuda-backend/touchemall"]

0 commit comments

Comments
 (0)