check for cuda or metal

This commit is contained in:
Kevaundray Wedderburn
2025-05-24 20:22:35 +01:00
parent 847dc0227f
commit b911ce818d
3 changed files with 660 additions and 8 deletions

653
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -17,5 +17,9 @@ tempfile = "3.3"
serde_json = "1.0"
thiserror = "2"
[features]
metal = ["risc0-zkvm/metal"]
cuda = ["risc0-zkvm/cuda"]
[lints]
workspace = true

View File

@@ -29,6 +29,17 @@ impl EreRisc0 {
program: <RV32_IM_RISCZERO_ZKVM_ELF as Compiler>::Program,
resource_type: ProverResourceType,
) -> Self {
match resource_type {
ProverResourceType::Cpu => {
#[cfg(any(feature = "cuda", feature = "metal"))]
panic!("CPU mode requires both 'cuda' and 'metal' features to be disabled");
}
ProverResourceType::Gpu => {
#[cfg(not(any(feature = "cuda", feature = "metal")))]
panic!("GPU selected but neither 'cuda' nor 'metal' feature is enabled");
}
}
Self {
program,
resource_type,