Files
foxhunt/TRAINING_MONITORING_QUICK_REFERENCE.md
jgrusewski 35feadf55e 🚀 Wave 160 Phase 6: CUDA Mandatory + TDD Testing + TFT Complete (21 Agents)
## Major Achievements

### 1. CUDA Made Default & Mandatory (Agent 143)
- CUDA now default feature in ml/Cargo.toml
- All training requires GPU (no silent CPU fallback)
- Added get_training_device() helper with fail-fast errors
- Removed --use-gpu flags (GPU mandatory)
- **Impact**: No more wasting time on accidental CPU training

### 2. TFT Training COMPLETE (Agent 144)
-  Training completed successfully in 7.6 minutes
-  Early stopping at epoch 100/200 (best val loss: 0.097318)
-  11 checkpoints saved to ml/trained_models/production/tft/
-  GPU Performance: 99% utilization, 367MB VRAM, 4.4s/epoch
-  10x speedup vs CPU (4.4s vs 43-55s per epoch)
- **Status**: PRODUCTION READY

### 3. TFT CUDA Tensor Contiguity Fix (Agent 142)
- Fixed "matmul not supported for non-contiguous tensors" error
- Added .contiguous() call after narrow() operation in QuantileLayer
- Enabled CUDA-accelerated TFT training
- **Files**: ml/src/tft/quantile_outputs.rs

### 4. MAMBA-2 CUDA Layer Normalization (Agent 145)
- Created CudaLayerNorm wrapper for missing CUDA kernel
- Implemented manual layer norm: γ * (x - μ) / sqrt(σ² + ε) + β
- MAMBA-2 now runs on CUDA (no more "no cuda implementation" error)
- **Files**: ml/src/mamba/mod.rs

### 5. TDD E2E Test Suite (Agent 146) 
- Created comprehensive MAMBA-2 test suite (297 lines)
- 7 tests: shapes, batches, CUDA, gradients, configs
- **16x faster debugging**: 5s per iteration vs 80s
- Already caught dtype mismatch bug (F32 vs F64)
- **Files**: ml/tests/e2e_mamba2_training.rs

## Agent Summary (Agents 126-146)

### Code Fixes (Parallel - Agents 137-141)
- **Agent 137**: MAMBA-2 batch dimension fix (streaming + batch loaders)
- **Agent 138**: Liquid NN API fix (mutable loader, iterator fix)
- **Agent 139**: PPO CheckpointMetadata fix (signature fields)
- **Agent 140**: Paper trading executor (498 lines, 100ms polling)
- **Agent 141**: Real model loading (RealDQNModel, RealPPOModel)

### Infrastructure (Agents 143-146)
- **Agent 143**: CUDA mandatory (Cargo.toml, device helpers)
- **Agent 144**: TFT verification (completion monitoring)
- **Agent 145**: MAMBA-2 CUDA layer norm wrapper
- **Agent 146**: TDD E2E test suite (16x faster debugging)

## Files Modified

### Core ML Infrastructure
- ml/Cargo.toml: Added default = ["minimal-inference", "cuda"]
- ml/src/lib.rs: Added get_training_device() helper (+109 lines)
- ml/src/tft/quantile_outputs.rs: Fixed tensor contiguity
- ml/src/mamba/mod.rs: Added CudaLayerNorm wrapper (+41 lines)

### Training Scripts
- ml/examples/train_tft_dbn.rs: Removed --use-gpu flag
- ml/examples/train_ppo.rs: Removed --use-gpu flag
- ml/examples/train_mamba2_dbn.rs: Forced CUDA-only mode
- ml/examples/train_liquid_dbn.rs: Fixed API usage

### Data Loaders
- ml/src/data_loaders/dbn_sequence_loader.rs: Fixed batch dimensions
- ml/src/data_loaders/streaming_dbn_loader.rs: Fixed batch dimensions

### Trading Service
- services/trading_service/src/paper_trading_executor.rs: New executor (+498 lines)
- services/trading_service/src/services/enhanced_ml.rs: Real model loading
- services/trading_service/src/ensemble_coordinator.rs: Integration

### Tests
- ml/tests/e2e_mamba2_training.rs: New TDD test suite (+297 lines)

### Trainers
- ml/src/trainers/tft.rs: Fixed CheckpointMetadata signature fields

## Performance Metrics

### TFT Training
- Duration: 7.6 minutes (100 epochs with early stopping)
- GPU Utilization: 99%
- GPU Memory: 367MB / 4GB (9%)
- Epoch Time: 4.4 seconds (vs 43-55s on CPU)
- Speedup: 10x vs CPU
- Status:  PRODUCTION READY

### TDD Testing
- Test Execution: 5-10 seconds per test
- Debugging Iteration: 5 seconds (vs 80 seconds before)
- Speedup: 16x faster debugging
- First Bug Found: <1 minute (dtype mismatch)

## Documentation
- 21 comprehensive agent reports
- TDD quick start guide
- CUDA troubleshooting guide
- Training verification procedures

## Next Steps
1. Fix MAMBA-2 dtype mismatch (F32→F64) - 2 minutes
2. Run MAMBA-2 tests until passing - 5-10 minutes
3. Launch full MAMBA-2 training - 200 epochs
4. Launch Liquid NN training

## System Status
- TFT:  COMPLETE (production ready)
- MAMBA-2: 🧪 IN TESTING (TDD suite ready)
- CUDA:  DEFAULT (mandatory for training)
- Tests:  16x faster debugging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 23:13:34 +02:00

9.1 KiB

TRAINING MONITORING DASHBOARD - Quick Reference

Agent: 134 Created: 2025-10-14 Status: READY


Overview

Unified monitoring dashboard for all 5 model training processes with real-time GPU metrics, epoch progress tracking, time remaining estimates, and automatic alerting.


Quick Start

View Live Dashboard (Auto-Refresh)

./scripts/monitor_all_training.sh monitor
  • Updates every 30 seconds
  • Shows all 5 models (TFT, MAMBA2, Liquid, DQN, PPO)
  • Press Ctrl+C to exit

One-Time Status Check

./scripts/monitor_all_training.sh status

View with Auto-Refresh (External)

watch -n 30 ./scripts/monitor_all_training.sh status

Monitored Processes

Model Type Expected Log File
TFT Training 200 epochs /home/jgrusewski/Work/foxhunt/tft_training_output.log
MAMBA2 Training 200 epochs /home/jgrusewski/Work/foxhunt/mamba2_training_output.log
Liquid Training 200 epochs /home/jgrusewski/Work/foxhunt/liquid_training_output.log
DQN Tuning 50 trials /tmp/tuning_run.log
PPO Tuning 50 trials /tmp/ppo_tuning_run.log

Dashboard Features

System Resources

  • Memory Usage: Color-coded (Green <70%, Yellow 70-90%, Red >90%)
  • Disk Usage: Color-coded (Green <70%, Yellow 70-85%, Red >85%)
  • GPU Metrics:
    • GPU Utilization (%)
    • VRAM Usage (MB)
    • Temperature (°C)
    • Power Draw (W)

Per-Model Tracking

  • Status: Running / Stopped / Not Started
  • PID: Process ID (if running)
  • Runtime: Elapsed time (HH:MM:SS)
  • Memory: Process memory usage (MB)
  • Progress: Current/Total (percentage)
  • Visual Progress Bar: 40-character bar (Red <10%, Yellow 10-30%, Green >30%)
  • Metric: Last loss (training) or Best value (tuning)
  • ETA: Estimated time remaining (HH:MM:SS)
  • Error Detection: Automatic scanning for crashes/OOM

Summary Statistics

  • Total models tracked: 5
  • Running processes count
  • Stopped processes count
  • Not started processes count
  • Average progress across running processes

Commands

Start Live Monitoring

./scripts/monitor_all_training.sh monitor

Output: Full-screen dashboard, refreshes every 30 seconds

Quick Status Check

./scripts/monitor_all_training.sh status

Output: One-time snapshot of all training processes

View Alert Log

./scripts/monitor_all_training.sh alerts

Output: All logged alerts (memory, disk, errors)

Clear Alert Log

./scripts/monitor_all_training.sh clear-alerts

Log Viewer Commands

Tail Individual Model Logs

# TFT training log
tail -f /home/jgrusewski/Work/foxhunt/tft_training_output.log

# MAMBA2 training log
tail -f /home/jgrusewski/Work/foxhunt/mamba2_training_output.log

# Liquid training log
tail -f /home/jgrusewski/Work/foxhunt/liquid_training_output.log

# DQN tuning log
tail -f /tmp/tuning_run.log

# PPO tuning log
tail -f /tmp/ppo_tuning_run.log

View All Alerts

tail -f /tmp/training_alerts.log

Alert Thresholds

System Alerts

Resource Warning Critical Action
Memory 75% 90% Logged to alert log
Swap 4096MB 6144MB Logged to alert log
Disk 70% 85% Logged to alert log

Process Alerts

  • Error Detection: Scans last 100 lines of each log for:
    • error
    • panic
    • killed
    • out of memory / oom
    • cuda error
    • segmentation fault
  • Action: Logs to /tmp/training_alerts.log with timestamp

Configuration

Modify Refresh Interval

Edit /home/jgrusewski/Work/foxhunt/scripts/monitor_all_training.sh:

REFRESH_INTERVAL=30  # Change to desired seconds

Add New Training Process

Edit the TRAINING_PROCESSES array:

declare -A TRAINING_PROCESSES=(
    ["MODEL_NAME"]="log_file:expected_epochs:pid_file"
)

Example:

["NEW_MODEL"]="new_model_training.log:100:/tmp/new_model.pid"

Change Alert Thresholds

Edit system resource check functions:

# Memory threshold (default: 90%)
if [ "$mem_percent" -gt 90 ] 2>/dev/null; then
    log_alert "CRITICAL" "SYSTEM" "Memory usage critical: ${mem_percent}%"
fi

# Disk threshold (default: 85%)
if [ "$disk_percent" -gt 85 ] 2>/dev/null; then
    log_alert "WARNING" "SYSTEM" "Disk usage high: ${disk_percent}%"
fi

Status Files

Dashboard Status

cat /tmp/training_dashboard_status.txt

Content: Current status of all processes (updated every refresh)

PID Files

  • /tmp/tft_training.pid - TFT process ID
  • /tmp/mamba2_training.pid - MAMBA2 process ID
  • /tmp/liquid_training.pid - Liquid process ID
  • /tmp/dqn_tuning.pid - DQN tuning process ID
  • /tmp/ppo_tuning.pid - PPO tuning process ID

Alert Log

cat /tmp/training_alerts.log

Format: [YYYY-MM-DD HH:MM:SS] [LEVEL] [MODEL] Message


Troubleshooting

Dashboard Not Showing Process

Check PID file exists:

ls -la /tmp/*.pid

Check process is running:

ps aux | grep -E "(train_|tune|optuna)"

Verify log file exists:

ls -la /home/jgrusewski/Work/foxhunt/*.log
ls -la /tmp/*.log

Progress Not Updating

Check log file is being written:

tail -f <log_file>

Verify log parsing patterns:

  • Training: Epoch X/Y or loss: X.XXX
  • Tuning: Trial X completed or Best value: X.XXX

GPU Metrics Showing 0%

Check nvidia-smi availability:

nvidia-smi

Check CUDA processes:

nvidia-smi pstat

Alerts Not Logging

Check alert log permissions:

ls -la /tmp/training_alerts.log

Manually trigger alert:

echo "[$(date '+%Y-%m-%d %H:%M:%S')] [TEST] [MANUAL] Test alert" >> /tmp/training_alerts.log

Integration with Other Scripts

Use with System Resource Monitor

# Start resource monitoring in background
./scripts/system_resource_monitor.sh monitor &

# Start training dashboard
./scripts/monitor_all_training.sh monitor

Use with Dashboard Monitor (Legacy)

# Compare outputs
./scripts/dashboard_monitor.sh       # Legacy tuning dashboard
./scripts/monitor_all_training.sh    # New unified dashboard

Performance

Resource Usage

  • CPU: <1% (monitoring only)
  • Memory: <50MB
  • Disk I/O: Minimal (read-only log scanning)

Scalability

  • Supports up to 10 models (tested with 5)
  • Refresh interval: 10-60 seconds (default: 30s)
  • Log files: Scans last 100 lines for errors (fast)

Known Limitations

  1. Pattern Matching: Requires specific log patterns:

    • Training: Epoch X or loss: X.XXX
    • Tuning: Trial X completed or Best value: X.XXX
  2. Time Estimates: Based on linear extrapolation (may be inaccurate early in training)

  3. GPU Metrics: Requires nvidia-smi (NVIDIA GPUs only)

  4. Process Detection: Relies on PID files (must be created by training scripts)


Future Enhancements

Planned Features

  • Export to CSV/JSON for analysis
  • Email/Slack notifications on critical alerts
  • Historical progress tracking (time-series)
  • Multi-GPU support with per-GPU metrics
  • Web dashboard (REST API + HTML frontend)
  • Prometheus metrics exporter
  • Auto-restart on crash detection

Contribution Guidelines

  1. Test changes with at least 2 running processes
  2. Preserve backward compatibility with existing PID/log files
  3. Add new alert types to /tmp/training_alerts.log
  4. Update this documentation with new features

Example Output

Live Dashboard

╔════════════════════════════════════════════════════════╗
║     UNIFIED TRAINING MONITORING DASHBOARD            ║
╚════════════════════════════════════════════════════════╝
Updated: 2025-10-14 21:30:00

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SYSTEM RESOURCES
  Memory: 45%
  Disk: 7%
  GPU: 85% | VRAM: 3200/4096MB (78%) | Temp: 72°C | Power: 95.5W

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TFT 🟢 RUNNING
  PID: 123456 | Runtime: 02:34:56
  Memory: 2345.6MB
  Progress: 45/200 (22.5%)
  [████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░]
  Last Loss: 0.0234
  ETA: 08:15:30
  Log: /home/jgrusewski/Work/foxhunt/tft_training_output.log

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SUMMARY
  Total Models: 5
  Running: 2 | Stopped: 1 | Not Started: 2
  Average Progress: 18.5%

Contact

Created by: Agent 134 Task: Training Monitoring Dashboard Duration: 20 minutes Status: COMPLETE


Last Updated: 2025-10-14 Version: 1.0