WAVE 22: All examples, benchmarks, and data loaders updated Files Modified (41 files): - DQN examples: 7 files (train_dqn, evaluate_dqn, validate_dqn, etc.) - PPO examples: 6 files (train_ppo, continuous_ppo, benchmark_ppo, etc.) - TFT examples: 9 files (train_tft, validate_tft, benchmark_tft, etc.) - MAMBA-2 examples: 3 files (train_mamba2, verify_dimensions, etc.) - Benchmarks: 5 files (cuda_speedup, weight_caching, future_decoder, etc.) - Data loaders: 7 files (parquet_utils, dbn_sequence_loader, tlob_loader, etc.) - Integration: 4 files (load_parquet_data, streaming loaders, etc.) Key Changes: - state_dim: 225 → 54 (DQN, PPO) - input_dim: 225 → 54 (TFT) - d_model: 225 → 54 (MAMBA-2) - Memory: 1.8KB → 0.43KB per vector (76% reduction) - All tensor shapes updated: (batch, 225) → (batch, 54) Agents Deployed: 5 parallel agents Validation: cargo check PASSING Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
3.5 KiB
Rust
68 lines
3.5 KiB
Rust
//! Basic CUDA functionality test
|
|
//! Tests if basic tensor operations work on CUDA device without hanging
|
|
|
|
use anyhow::Result;
|
|
use candle_core::{Device, Tensor};
|
|
|
|
fn main() -> Result<()> {
|
|
println!("╔═══════════════════════════════════════════════════════════╗");
|
|
println!("║ Basic CUDA Test ║");
|
|
println!("╚═══════════════════════════════════════════════════════════╝");
|
|
|
|
// Test 1: Device creation
|
|
println!("\n[TEST 1] Creating CUDA device...");
|
|
let device = Device::new_cuda(0)?;
|
|
println!("✓ CUDA device created successfully");
|
|
|
|
// Test 2: Simple tensor creation on CUDA
|
|
println!("\n[TEST 2] Creating tensor on CUDA...");
|
|
let tensor_cuda = Tensor::zeros((32, 54), candle_core::DType::F64, &device)?;
|
|
println!("✓ Tensor created on CUDA: {:?}", tensor_cuda.dims());
|
|
|
|
// Test 3: CPU tensor creation and device transfer
|
|
println!("\n[TEST 3] Creating CPU tensor and transferring to CUDA...");
|
|
let data: Vec<f64> = (0..100).map(|i| i as f64).collect();
|
|
let tensor_cpu = Tensor::new(&data[..], &Device::Cpu)?;
|
|
println!(" CPU tensor shape: {:?}", tensor_cpu.dims());
|
|
|
|
let tensor_moved = tensor_cpu.to_device(&device)?;
|
|
println!("✓ Tensor moved to CUDA: {:?}", tensor_moved.dims());
|
|
|
|
// Test 4: Basic arithmetic on CUDA
|
|
println!("\n[TEST 4] Testing arithmetic operations on CUDA...");
|
|
let a = Tensor::ones((10, 10), candle_core::DType::F64, &device)?;
|
|
let b = Tensor::ones((10, 10), candle_core::DType::F64, &device)?;
|
|
let c = (&a + &b)?;
|
|
println!("✓ Addition completed: result shape {:?}", c.dims());
|
|
|
|
// Test 5: Matrix multiplication on CUDA
|
|
println!("\n[TEST 5] Testing matmul on CUDA...");
|
|
let x = Tensor::randn(0.0, 1.0, (32, 54), &device)?;
|
|
let y = Tensor::randn(0.0, 1.0, (54, 16), &device)?;
|
|
let z = x.matmul(&y)?;
|
|
println!("✓ Matmul completed: result shape {:?}", z.dims());
|
|
|
|
// Test 6: Concatenation on CUDA
|
|
println!("\n[TEST 6] Testing concatenation on CUDA...");
|
|
let t1 = Tensor::ones((1, 60, 54), candle_core::DType::F64, &device)?;
|
|
let t2 = Tensor::ones((1, 60, 54), candle_core::DType::F64, &device)?;
|
|
let t_cat = Tensor::cat(&[&t1, &t2], 0)?;
|
|
println!("✓ Concatenation completed: result shape {:?}", t_cat.dims());
|
|
|
|
// Test 7: Device transfer after concatenation
|
|
println!("\n[TEST 7] Testing device transfer after concatenation...");
|
|
let t1_cpu = Tensor::ones((1, 60, 54), candle_core::DType::F64, &Device::Cpu)?;
|
|
let t2_cpu = Tensor::ones((1, 60, 54), candle_core::DType::F64, &Device::Cpu)?;
|
|
let t_cat_cpu = Tensor::cat(&[&t1_cpu, &t2_cpu], 0)?;
|
|
println!(" CPU concatenated tensor: {:?}", t_cat_cpu.dims());
|
|
|
|
let t_cat_cuda = t_cat_cpu.to_device(&device)?;
|
|
println!("✓ Device transfer completed: {:?}", t_cat_cuda.dims());
|
|
|
|
println!("\n╔═══════════════════════════════════════════════════════════╗");
|
|
println!("║ All CUDA Tests PASSED ║");
|
|
println!("╚═══════════════════════════════════════════════════════════╝");
|
|
|
|
Ok(())
|
|
}
|