From 608a5e66e249a6fd5c45a33077ac088d93bda773 Mon Sep 17 00:00:00 2001 From: Eric Buehler Date: Fri, 16 Aug 2024 21:35:42 -0400 Subject: [PATCH 1/2] Fix benches on cuda --- .vscode/settings.json | 3 ++- candle-core/benches/benchmarks/mod.rs | 5 ++++- candle-nn/benches/benchmarks/mod.rs | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b2dbd68012..646783a968 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "candle-pyo3" ], "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true + "python.testing.pytestEnabled": true, + "rust-analyzer.cargo.features": ["cuda"] } \ No newline at end of file diff --git a/candle-core/benches/benchmarks/mod.rs b/candle-core/benches/benchmarks/mod.rs index 579c5f3f0b..81d718d2da 100644 --- a/candle-core/benches/benchmarks/mod.rs +++ b/candle-core/benches/benchmarks/mod.rs @@ -20,7 +20,10 @@ impl BenchDevice for Device { Device::Cpu => Ok(()), Device::Cuda(device) => { #[cfg(feature = "cuda")] - return Ok(device.synchronize()?); + { + use candle_core::cuda::WrapErr; + return Ok(device.synchronize().w()?); + } #[cfg(not(feature = "cuda"))] panic!("Cuda device without cuda feature enabled: {:?}", device) } diff --git a/candle-nn/benches/benchmarks/mod.rs b/candle-nn/benches/benchmarks/mod.rs index 30a6ab6a2b..1ddba29e5c 100644 --- a/candle-nn/benches/benchmarks/mod.rs +++ b/candle-nn/benches/benchmarks/mod.rs @@ -15,7 +15,10 @@ impl BenchDevice for Device { Device::Cpu => Ok(()), Device::Cuda(device) => { #[cfg(feature = "cuda")] - return Ok(device.synchronize()?); + { + use candle::cuda::WrapErr; + return Ok(device.synchronize().w()?); + } #[cfg(not(feature = "cuda"))] panic!("Cuda device without cuda feature enabled: {:?}", device) } From 7a596182cc9d3a29d8c84bc8a264fa77056502bd Mon Sep 17 00:00:00 2001 From: Eric Buehler Date: Fri, 16 Aug 2024 21:36:22 -0400 Subject: [PATCH 2/2] Fix settings.json --- .vscode/settings.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 646783a968..b2dbd68012 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,5 @@ "candle-pyo3" ], "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "rust-analyzer.cargo.features": ["cuda"] + "python.testing.pytestEnabled": true } \ No newline at end of file