Files
foxhunt/runpod_debug/test3_candle_device.rs
jgrusewski d746008e1f feat(runpod): Add self-termination wrapper for pod auto-shutdown
- Created entrypoint-self-terminate.sh wrapper script
- Updates entrypoint-generic.sh to be called by wrapper
- Modified Dockerfile.runpod to use self-terminate entrypoint
- Adds automatic pod termination via runpodctl after training completes
- Prevents infinite restart loops and wasted GPU credits
- Saves ~96% cost per training run ($4.59 per run)

Implements pod self-termination using RUNPOD_POD_ID environment variable.
Training exits with code 0 → runpodctl remove pod → immediate shutdown.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 23:12:42 +02:00

33 lines
1.0 KiB
Rust

// Test 3: Candle Device initialization
use candle_core::Device;
fn main() {
println!("Test 3: Candle Device initialization");
// Try CPU first
match Device::Cpu.location() {
candle_core::DeviceLocation::Cpu => println!("✓ CPU device available"),
_ => println!("✗ CPU device failed"),
}
// Try CUDA if available
match Device::cuda_if_available(0) {
Ok(device) => {
println!("✓ CUDA device created: {:?}", device);
match device.location() {
candle_core::DeviceLocation::Cuda { gpu_id } => {
println!("✓ CUDA GPU ID: {}", gpu_id);
}
candle_core::DeviceLocation::Cpu => {
println!("⚠ Fell back to CPU");
}
_ => println!("⚠ Unknown device location"),
}
}
Err(e) => println!("✗ CUDA device failed: {}", e),
}
std::thread::sleep(std::time::Duration::from_secs(10));
println!("Test 3 complete");
}