diff --git a/crates/engine-cpu/src/lib.rs b/crates/engine-cpu/src/lib.rs
index b8bd9d2..b3bbe8e 100644
--- a/crates/engine-cpu/src/lib.rs
+++ b/crates/engine-cpu/src/lib.rs
@@ -51,6 +51,10 @@ pub enum EngineStatus {
Cancelled {
hash_count: u64,
},
+ /// GPU device lost or unresponsive. Worker should exit permanently.
+ DeviceLost {
+ hash_count: u64,
+ },
}
/// Cancellation checker passed to search_range.
diff --git a/crates/engine-gpu/benches/gpu_engine_bench.rs b/crates/engine-gpu/benches/gpu_engine_bench.rs
index 4517d91..6ad4b17 100644
--- a/crates/engine-gpu/benches/gpu_engine_bench.rs
+++ b/crates/engine-gpu/benches/gpu_engine_bench.rs
@@ -8,7 +8,7 @@ use std::sync::atomic::AtomicBool;
fn bench_cpu_vs_gpu_small(c: &mut Criterion) {
let cpu_engine = FastCpuEngine::new(10_000);
- let gpu_engine = GpuEngine::try_new(10_000_000, 0).expect("Failed to init GPU");
+ let gpu_engine = GpuEngine::try_new(10_000_000, 0, false).expect("Failed to init GPU");
let cancel_flag = AtomicBool::new(false);
let cancel_check = AtomicBoolCancelCheck(&cancel_flag);
@@ -59,7 +59,7 @@ fn bench_cpu_vs_gpu_small(c: &mut Criterion) {
fn bench_cpu_vs_gpu_medium(c: &mut Criterion) {
let cpu_engine = FastCpuEngine::new(10_000);
- let gpu_engine = GpuEngine::try_new(10_000_000, 0).expect("Failed to init GPU");
+ let gpu_engine = GpuEngine::try_new(10_000_000, 0, false).expect("Failed to init GPU");
let cancel_flag = AtomicBool::new(false);
let cancel_check = AtomicBoolCancelCheck(&cancel_flag);
@@ -110,7 +110,7 @@ fn bench_cpu_vs_gpu_medium(c: &mut Criterion) {
fn bench_cpu_vs_gpu_large(c: &mut Criterion) {
let cpu_engine = FastCpuEngine::new(10_000);
- let gpu_engine = GpuEngine::try_new(10_000_000, 0).expect("Failed to init GPU");
+ let gpu_engine = GpuEngine::try_new(10_000_000, 0, false).expect("Failed to init GPU");
let cancel_flag = AtomicBool::new(false);
let cancel_check = AtomicBoolCancelCheck(&cancel_flag);
@@ -161,7 +161,7 @@ fn bench_cpu_vs_gpu_large(c: &mut Criterion) {
fn bench_solution_finding(c: &mut Criterion) {
let cpu_engine = FastCpuEngine::new(10_000);
- let gpu_engine = GpuEngine::try_new(10_000_000, 0).expect("Failed to init GPU");
+ let gpu_engine = GpuEngine::try_new(10_000_000, 0, false).expect("Failed to init GPU");
let cancel_flag = AtomicBool::new(false);
let cancel_check = AtomicBoolCancelCheck(&cancel_flag);
@@ -212,7 +212,7 @@ fn bench_solution_finding(c: &mut Criterion) {
fn bench_throughput_per_second(c: &mut Criterion) {
let cpu_engine = FastCpuEngine::new(10_000);
- let gpu_engine = GpuEngine::try_new(10_000_000, 0).expect("Failed to init GPU");
+ let gpu_engine = GpuEngine::try_new(10_000_000, 0, false).expect("Failed to init GPU");
let cancel_flag = AtomicBool::new(false);
let cancel_check = AtomicBoolCancelCheck(&cancel_flag);
@@ -262,7 +262,7 @@ fn bench_throughput_per_second(c: &mut Criterion) {
}
fn bench_gpu_batch_efficiency(c: &mut Criterion) {
- let gpu_engine = GpuEngine::try_new(10_000_000, 0).expect("Failed to init GPU");
+ let gpu_engine = GpuEngine::try_new(10_000_000, 0, false).expect("Failed to init GPU");
let cancel_flag = AtomicBool::new(false);
let cancel_check = AtomicBoolCancelCheck(&cancel_flag);
diff --git a/crates/engine-gpu/examples/verify_nonce.rs b/crates/engine-gpu/examples/verify_nonce.rs
index fce9d22..8ad8215 100644
--- a/crates/engine-gpu/examples/verify_nonce.rs
+++ b/crates/engine-gpu/examples/verify_nonce.rs
@@ -26,7 +26,7 @@ fn main() {
// 3. Verify with GPU engine
log::info!("Initializing GPU engine...");
- let gpu_engine = GpuEngine::try_new(10_000_000, 0).expect("Failed to init GPU");
+ let gpu_engine = GpuEngine::try_new(10_000_000, 0, false).expect("Failed to init GPU");
// Search a small range around the valid nonce
let gpu_range = Range {
@@ -56,6 +56,9 @@ fn main() {
EngineStatus::Cancelled { .. } => {
log::error!("FAILURE: GPU search cancelled!");
}
+ EngineStatus::DeviceLost { .. } => {
+ log::error!("FAILURE: GPU device lost!");
+ }
EngineStatus::Running { .. } => {
log::error!("FAILURE: GPU returned Running status!");
}
diff --git a/crates/engine-gpu/src/lib.rs b/crates/engine-gpu/src/lib.rs
index efc33d5..cb0a6b3 100644
--- a/crates/engine-gpu/src/lib.rs
+++ b/crates/engine-gpu/src/lib.rs
@@ -47,6 +47,9 @@ pub struct GpuEngine {
thread_local! {
static ASSIGNED_GPU_DEVICE: RefCell