Skip to content

Commit 01edfbf

Browse files
mivertowskiclaude
andcommitted
Fix CI/CD for non-CUDA environments
Changes: - Remove cudarc from ringkernel-cuda dev-dependencies (now feature-gated) - Add #[cfg(feature = "cuda")] guards to CUDA test files - Remove cuda from ringkernel-wavesim default features (CUDA is opt-in) - Add required-features to ringkernel-ecosystem example - Fix unused variable warnings in wavesim with #[allow(unused_variables)] - Gate test_persistent.rs imports behind cuda feature - Update CI workflow with explanatory comments about CUDA handling - Update docs workflow with CUDA note This ensures the workspace builds and tests pass on CI runners without NVIDIA GPU/nvcc installed. CUDA functionality remains available via explicit feature flags. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e0208c3 commit 01edfbf

9 files changed

Lines changed: 36 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ env:
1010
CARGO_TERM_COLOR: always
1111
RUST_BACKTRACE: 1
1212

13+
# Note: CUDA tests require NVIDIA GPU + nvcc and are skipped in CI.
14+
# CUDA features are opt-in (not default) so workspace builds succeed without nvcc.
15+
# Run CUDA tests locally with: cargo test -p ringkernel-cuda --features cuda
16+
1317
jobs:
1418
# Format check
1519
fmt:
@@ -47,7 +51,7 @@ jobs:
4751
- name: Run tests
4852
run: cargo test --workspace --lib --bins
4953

50-
# Integration tests
54+
# Integration tests (excludes CUDA tests that require nvcc)
5155
integration:
5256
name: Integration Tests
5357
runs-on: ubuntu-latest
@@ -56,7 +60,7 @@ jobs:
5660
- uses: dtolnay/rust-toolchain@stable
5761
- uses: Swatinem/rust-cache@v2
5862
- name: Run integration tests
59-
run: cargo test --workspace --test '*' --features cpu --exclude ringkernel-cuda
63+
run: cargo test --workspace --test '*' --features cpu
6064

6165
# Doc tests
6266
doc:
@@ -71,7 +75,7 @@ jobs:
7175
- name: Run doc tests
7276
run: cargo test --workspace --doc
7377

74-
# Build check with all features
78+
# Build check
7579
build:
7680
name: Build
7781
runs-on: ubuntu-latest
@@ -81,7 +85,7 @@ jobs:
8185
- uses: Swatinem/rust-cache@v2
8286
- name: Build workspace
8387
run: cargo build --workspace
84-
- name: Build with all CPU features
88+
- name: Build with CPU features
8589
run: cargo build --workspace --features cpu
8690

8791
# Minimum Supported Rust Version check

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches: [main, master]
66
workflow_dispatch:
77

8+
# Note: CUDA features are opt-in (not default) so docs build succeeds without nvcc.
9+
810
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
911
permissions:
1012
contents: read

crates/ringkernel-cuda/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ parking_lot = { workspace = true }
3535

3636
[dev-dependencies]
3737
tokio = { workspace = true, features = ["test-util", "macros", "rt-multi-thread"] }
38-
# For GPU execution tests - needs cudarc directly
39-
cudarc = { version = "0.18.2", features = ["cuda-version-from-build-system"] }
38+
39+
# Note: GPU execution tests require the `cuda` feature to be enabled.
40+
# Run with: cargo test -p ringkernel-cuda --features cuda
4041

4142
[features]
4243
default = []

crates/ringkernel-cuda/tests/gpu_actor_integration.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
//! - Phase 1: Message queue operations (send_envelope, try_receive, receive)
55
//! - Phase 2: Safe cooperative launch via DirectPtxModule
66
//! - Phase 3: K2K GPU buffers and connections
7+
//!
8+
//! Run with: cargo test -p ringkernel-cuda --features cuda -- --nocapture
9+
10+
#![cfg(feature = "cuda")]
711

812
use cudarc::driver::CudaContext;
913

crates/ringkernel-cuda/tests/gpu_execution_verify.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
//! by performing real computations and verifying results.
55
//!
66
//! Updated for cudarc 0.18.2 API.
7+
//!
8+
//! Run with: cargo test -p ringkernel-cuda --features cuda -- --nocapture
9+
10+
#![cfg(feature = "cuda")]
711

812
use cudarc::driver::{CudaContext, LaunchConfig, PushKernelArg};
913
use cudarc::nvrtc::compile_ptx;

crates/ringkernel-ecosystem/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,8 @@ serde_json = { version = "1.0", optional = true }
109109

110110
[dev-dependencies]
111111
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
112+
113+
[[example]]
114+
name = "axum_persistent_api"
115+
path = "examples/axum_persistent_api.rs"
116+
required-features = ["persistent", "axum", "axum-sse"]

crates/ringkernel-wavesim/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ syn = { workspace = true, optional = true }
5050
criterion = { workspace = true }
5151

5252
[features]
53-
default = ["cpu", "cuda", "simd"]
53+
default = ["cpu", "simd"]
5454
cpu = ["ringkernel/cpu"]
5555
cuda = ["ringkernel/cuda", "dep:ringkernel-cuda", "dep:cudarc", "dep:bytemuck"]
5656
cuda-codegen = ["cuda", "dep:ringkernel-cuda-codegen", "dep:syn", "ringkernel-derive/cuda-codegen"]

crates/ringkernel-wavesim/src/gui/app.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ impl WaveSimApp {
306306
Message::SpeedChanged(speed) => {
307307
self.speed_of_sound = speed;
308308
let params = AcousticParams::new(speed, self.cell_size);
309+
#[allow(unused_variables)]
309310
let c2 = params.courant_number().powi(2);
311+
#[allow(unused_variables)]
310312
let damping = 1.0 - params.damping;
311313
self.courant_number = params.courant_number();
312314

@@ -374,7 +376,9 @@ impl WaveSimApp {
374376
Message::CellSizeChanged(size) => {
375377
self.cell_size = size;
376378
let params = AcousticParams::new(self.speed_of_sound, size);
379+
#[allow(unused_variables)]
377380
let c2 = params.courant_number().powi(2);
381+
#[allow(unused_variables)]
378382
let damping = 1.0 - params.damping;
379383
self.courant_number = params.courant_number();
380384

@@ -700,6 +704,7 @@ impl WaveSimApp {
700704
}
701705

702706
/// Update canvas from flat pressure array.
707+
#[allow(dead_code)]
703708
fn update_canvas_from_flat(&mut self, pressure: &[f32]) {
704709
let mut grid = Vec::with_capacity(self.grid_height as usize);
705710
for y in 0..self.grid_height as usize {

crates/ringkernel-wavesim3d/examples/test_persistent.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//! Test persistent backend creation and execution
2-
use ringkernel_wavesim3d::simulation::{grid3d::SimulationGrid3D, AcousticParams3D, Environment};
32
43
#[cfg(all(feature = "cuda", feature = "cuda-codegen"))]
5-
use ringkernel_wavesim3d::simulation::persistent_backend::{
6-
PersistentBackend, PersistentBackendConfig,
4+
use ringkernel_wavesim3d::simulation::{
5+
grid3d::SimulationGrid3D,
6+
persistent_backend::{PersistentBackend, PersistentBackendConfig},
7+
AcousticParams3D, Environment,
78
};
89

910
fn main() {

0 commit comments

Comments
 (0)