- 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>
27 lines
837 B
Rust
27 lines
837 B
Rust
// Test 2: CUDA device check
|
|
use std::process::Command;
|
|
|
|
fn main() {
|
|
println!("Test 2: Checking CUDA availability");
|
|
|
|
// Check nvidia-smi
|
|
match Command::new("nvidia-smi").output() {
|
|
Ok(output) => {
|
|
println!("nvidia-smi stdout:\n{}", String::from_utf8_lossy(&output.stdout));
|
|
println!("nvidia-smi stderr:\n{}", String::from_utf8_lossy(&output.stderr));
|
|
}
|
|
Err(e) => println!("nvidia-smi failed: {}", e),
|
|
}
|
|
|
|
// Check CUDA environment variables
|
|
for var in &["CUDA_HOME", "CUDA_PATH", "LD_LIBRARY_PATH"] {
|
|
match std::env::var(var) {
|
|
Ok(val) => println!("{} = {}", var, val),
|
|
Err(_) => println!("{} not set", var),
|
|
}
|
|
}
|
|
|
|
std::thread::sleep(std::time::Duration::from_secs(10));
|
|
println!("Test 2 complete");
|
|
}
|