387 lines
10 KiB
Markdown
387 lines
10 KiB
Markdown
# RustyTorch++ Demo Platform
|
||
|
||
A comprehensive suite of GPU-accelerated demos powered by RustyTorch++, packaged as a single-binary Tauri desktop application. Features 18 interactive demos across medical imaging, scientific computing, AI/ML, finance, and computer vision.
|
||
|
||
## Overview
|
||
|
||
All demos use the unified **rtx-tensor** backend for GPU acceleration, supporting:
|
||
- NVIDIA CUDA (Windows/Linux)
|
||
- Apple Metal (M1/M2/M3/M4/M5)
|
||
- CPU fallback (all platforms)
|
||
|
||
## Demo Categories
|
||
|
||
### Medical / Science (6 demos)
|
||
|
||
| Demo | Description | Physics/Algorithm |
|
||
|------|-------------|-------------------|
|
||
| **Virtual Catheter** | Real-time hemodynamics PINN | Inverse Navier-Stokes |
|
||
| **MRE Elastography** | Tissue stiffness estimation | Inverse Helmholtz |
|
||
| **Thermal Ablation** | 3D thermal therapy simulation | Pennes Bioheat Equation |
|
||
| **SlideScope Pathology** | Stain separation for digital pathology | Non-negative Matrix Factorization |
|
||
| **RustyNeuro MEG/EEG** | Neuroimaging analysis platform | Signal processing, source localization |
|
||
| **Medical Digital Twin** | Patient-specific ablation planning | Interactive physics simulation |
|
||
|
||
### AI / ML (6 demos)
|
||
|
||
| Demo | Description | Model/Method |
|
||
|------|-------------|--------------|
|
||
| **Neural Operator PDE** | Real-time PDE solving | Fourier Neural Operator (FNO) |
|
||
| **Physics-Informed Diffusion** | Generative PDE solving | PIDDM (diffusion + physics loss) |
|
||
| **FNO Benchmark** | Compare solvers | FNO vs FEM vs FDM |
|
||
| **PINN Benchmark** | Multi-PDE benchmark | Heat, Burgers, Poisson equations |
|
||
| **Inference Profiler** | Model performance analysis | Latency, throughput, memory |
|
||
| **Model Zoo** | Pre-trained model gallery | Classification, detection, NLP |
|
||
|
||
### Finance (3 demos)
|
||
|
||
| Demo | Description | Method |
|
||
|------|-------------|--------|
|
||
| **Portfolio Optimizer** | Mean-variance optimization | Markowitz efficient frontier |
|
||
| **Risk Analyzer** | VaR and stress testing | Monte Carlo simulation |
|
||
| **Time Series Forecast** | Multi-model forecasting | ARIMA, Prophet, Transformer |
|
||
|
||
### Vision (3 demos)
|
||
|
||
| Demo | Description | Model |
|
||
|------|-------------|-------|
|
||
| **Image Classifier** | Real-time classification | ViT, ConvNeXt (ImageNet) |
|
||
| **Object Detector** | Bounding box detection | YOLOv8 (COCO 80 classes) |
|
||
| **Segmentation** | Pixel-wise segmentation | DeepLabV3, SegFormer, UNet |
|
||
|
||
## Architecture
|
||
|
||
```
|
||
demos/
|
||
├── shared/ # Hemodynamics IPC types
|
||
├── mre-shared/ # MRE elastography types
|
||
├── bioheat-shared/ # Bioheat transfer types
|
||
├── slidescope-shared/ # SlideScope types
|
||
├── neuro-shared/ # RustyNeuro types
|
||
├── neural-operator-shared/ # FNO demo types
|
||
├── piddm-shared/ # Physics-informed diffusion types
|
||
├── digital-twin-shared/ # Digital twin types
|
||
├── fno-benchmark-shared/ # FNO benchmark types
|
||
├── pinn-benchmark-shared/ # PINN benchmark types
|
||
├── inference-profiler-shared/ # Inference profiler types
|
||
├── model-zoo-shared/ # Model zoo types
|
||
├── portfolio-shared/ # Portfolio optimizer types
|
||
├── risk-shared/ # Risk analyzer types
|
||
├── timeseries-shared/ # Time series types
|
||
├── image-classifier-shared/ # Image classifier types
|
||
├── object-detector-shared/ # Object detector types
|
||
├── segmentation-shared/ # Segmentation types
|
||
│
|
||
├── rtx-hemodynamics/ # Virtual Catheter backend
|
||
├── rtx-mre/ # MRE elastography backend
|
||
├── rtx-bioheat/ # Bioheat simulation backend
|
||
├── rtx-slidescope/ # SlideScope NMF backend
|
||
├── rtx-neuro/ # RustyNeuro backend
|
||
├── rtx-neural-operator-demo/ # FNO demo backend
|
||
├── rtx-piddm-demo/ # PIDDM backend
|
||
├── rtx-digital-twin-demo/ # Digital twin backend
|
||
├── rtx-fno-benchmark/ # FNO benchmark backend
|
||
├── rtx-pinn-benchmark/ # PINN benchmark backend
|
||
├── rtx-inference-profiler/ # Inference profiler backend
|
||
├── rtx-model-zoo/ # Model zoo backend
|
||
├── rtx-portfolio/ # Portfolio optimizer backend
|
||
├── rtx-risk-analyzer/ # Risk analyzer backend
|
||
├── rtx-timeseries/ # Time series backend
|
||
├── rtx-image-classifier/ # Image classifier backend
|
||
├── rtx-object-detector/ # Object detector backend
|
||
├── rtx-segmentation-demo/ # Segmentation backend
|
||
│
|
||
├── server/ # Service layer (all demos)
|
||
└── ui/ # Tauri + React frontend
|
||
```
|
||
|
||
## Quick Start
|
||
|
||
```bash
|
||
# Install dependencies
|
||
cd demos/ui
|
||
pnpm install
|
||
|
||
# Development mode
|
||
pnpm tauri dev
|
||
|
||
# Production build
|
||
pnpm tauri build
|
||
```
|
||
|
||
## Demo Details
|
||
|
||
### Medical / Science
|
||
|
||
#### 1. Virtual Catheter (Hemodynamics)
|
||
|
||
Solves the **inverse Navier-Stokes problem** - inferring pressure fields from velocity data for non-invasive virtual catheterization.
|
||
|
||
**Features:**
|
||
- Real-time PINN inference with GPU acceleration
|
||
- Interactive geometry editing (stenosis, aneurysm, stent)
|
||
- Pulsatile flow animation with cardiac waveforms
|
||
- Multi-field visualization (velocity, pressure, WSS)
|
||
|
||
**Physics:**
|
||
```
|
||
Momentum: ρ(∂u/∂t + u·∇u) = -∇p + μ∇²u
|
||
Continuity: ∇·u = 0
|
||
```
|
||
|
||
#### 2. MRE Elastography
|
||
|
||
Estimates tissue stiffness from MRI wave propagation using the **Helmholtz equation**.
|
||
|
||
**Features:**
|
||
- 2D/3D stiffness map reconstruction
|
||
- Wave field visualization
|
||
- Configurable frequency and wavelength
|
||
- Real-time GPU-accelerated solver
|
||
|
||
**Physics:**
|
||
```
|
||
∇²u + k²u = 0 (Helmholtz)
|
||
G = ρω²/k² (Shear modulus estimation)
|
||
```
|
||
|
||
#### 3. Thermal Ablation (Bioheat)
|
||
|
||
Simulates thermal therapy using the **Pennes bioheat equation**.
|
||
|
||
**Features:**
|
||
- 3D temperature field simulation
|
||
- Heat source placement and configuration
|
||
- Thermal dose (CEM43) calculation
|
||
- Treatment planning visualization
|
||
|
||
**Physics:**
|
||
```
|
||
ρc(∂T/∂t) = k∇²T + ρ_b·c_b·ω_b(T_a - T) + Q
|
||
```
|
||
|
||
#### 4. SlideScope Pathology
|
||
|
||
GPU-accelerated stain separation using **Non-negative Matrix Factorization**.
|
||
|
||
**Features:**
|
||
- H&E and IHC stain unmixing
|
||
- Deep zoom tile viewing
|
||
- Real-time processing with progress
|
||
- Unified rtx-tensor backend
|
||
|
||
**Algorithm:**
|
||
```
|
||
V ≈ W × H (NMF decomposition)
|
||
```
|
||
|
||
#### 5. RustyNeuro MEG/EEG
|
||
|
||
Comprehensive neuroimaging analysis platform.
|
||
|
||
**Features:**
|
||
- Signal visualization and filtering
|
||
- Epoching and averaging
|
||
- Source localization
|
||
- Connectivity analysis
|
||
- Inspired by Brainstorm
|
||
|
||
#### 6. Medical Digital Twin
|
||
|
||
Patient-specific organ simulation for treatment planning.
|
||
|
||
**Features:**
|
||
- Organ geometry selection
|
||
- Probe placement configuration
|
||
- Interactive bioheat simulation
|
||
- What-if analysis
|
||
|
||
### AI / ML
|
||
|
||
#### 7. Neural Operator PDE
|
||
|
||
Real-time PDE solving with Fourier Neural Operators.
|
||
|
||
**Features:**
|
||
- Draw boundary conditions interactively
|
||
- Instant solutions for Darcy flow, heat equation
|
||
- 1000x faster than traditional methods
|
||
- Train custom models
|
||
|
||
#### 8. Physics-Informed Diffusion (PIDDM)
|
||
|
||
Generative PDE solving with physics-consistent diffusion.
|
||
|
||
**Features:**
|
||
- Train diffusion models with physics loss
|
||
- Sample PDE solutions
|
||
- Supports Poisson, Heat, Darcy, Burgers
|
||
- Physics consistency visualization
|
||
|
||
#### 9. FNO Benchmark
|
||
|
||
Compare Neural Operators vs classical solvers.
|
||
|
||
**Features:**
|
||
- Side-by-side: FNO vs FEM vs FDM
|
||
- Resolution sweep (32x32 to 256x256)
|
||
- Metrics: time, accuracy, memory
|
||
- CSV export
|
||
|
||
#### 10. PINN Benchmark
|
||
|
||
Interactive Physics-Informed Neural Network benchmark.
|
||
|
||
**Features:**
|
||
- Heat, Burgers, Poisson equations
|
||
- Training convergence visualization
|
||
- Architecture comparison
|
||
- Loss curve charts
|
||
|
||
#### 11. Inference Profiler
|
||
|
||
Model performance analysis tool.
|
||
|
||
**Features:**
|
||
- Latency metrics (p50, p95, p99)
|
||
- Throughput measurement
|
||
- Memory profiling
|
||
- GPU utilization
|
||
- Batch size sweeps
|
||
|
||
#### 12. Model Zoo
|
||
|
||
Pre-trained model gallery for common ML tasks.
|
||
|
||
**Features:**
|
||
- Image classification (ResNet, ViT, ConvNeXt)
|
||
- Object detection (YOLO)
|
||
- Segmentation (DeepLab, SegFormer)
|
||
- Text generation, NLP, audio
|
||
- One-click inference
|
||
|
||
### Finance
|
||
|
||
#### 13. Portfolio Optimizer
|
||
|
||
Mean-variance portfolio optimization.
|
||
|
||
**Features:**
|
||
- Efficient frontier visualization
|
||
- Asset correlation matrix
|
||
- Risk/return trade-off analysis
|
||
- GPU-accelerated covariance estimation
|
||
|
||
#### 14. Risk Analyzer
|
||
|
||
Value-at-Risk and stress testing.
|
||
|
||
**Features:**
|
||
- Historical and parametric VaR
|
||
- Monte Carlo simulation
|
||
- Stress scenarios
|
||
- Risk decomposition
|
||
|
||
#### 15. Time Series Forecast
|
||
|
||
Multi-model time series forecasting.
|
||
|
||
**Features:**
|
||
- ARIMA/SARIMA models
|
||
- Prophet integration
|
||
- Transformer architectures
|
||
- Confidence intervals
|
||
- Sample datasets
|
||
|
||
### Vision
|
||
|
||
#### 16. Image Classifier
|
||
|
||
Real-time image classification.
|
||
|
||
**Features:**
|
||
- ViT and ConvNeXt models
|
||
- 1000 ImageNet classes
|
||
- GPU acceleration
|
||
- Confidence visualization
|
||
|
||
#### 17. Object Detector
|
||
|
||
YOLO-style object detection.
|
||
|
||
**Features:**
|
||
- YOLOv8 variants (Nano to XLarge)
|
||
- 80 COCO classes
|
||
- Adjustable confidence threshold
|
||
- NMS configuration
|
||
- Bounding box visualization
|
||
|
||
#### 18. Segmentation
|
||
|
||
Pixel-wise semantic segmentation.
|
||
|
||
**Features:**
|
||
- DeepLabV3, SegFormer, UNet, FCN
|
||
- PASCAL VOC (21 classes)
|
||
- ADE20K (150 classes)
|
||
- Cityscapes (19 classes)
|
||
- Mask overlay visualization
|
||
|
||
## GPU Backend
|
||
|
||
All demos use **rtx-tensor** for GPU operations:
|
||
|
||
```toml
|
||
[features]
|
||
default = ["cpu"]
|
||
cpu = ["rtx-tensor/cpu"]
|
||
cuda = ["rtx-tensor/cuda"]
|
||
metal = ["rtx-tensor/metal"]
|
||
```
|
||
|
||
### Supported Operations
|
||
- Matrix multiplication (matmul)
|
||
- Element-wise operations (add, sub, mul, div)
|
||
- Activation functions (relu, sigmoid, tanh, gelu, silu)
|
||
- Trigonometric functions (sin, cos) for Fourier features
|
||
- Reduction operations (sum, mean, max, min)
|
||
- Transpose, reshape, convolution
|
||
|
||
## Testing
|
||
|
||
```bash
|
||
# Run all backend tests
|
||
cargo test --workspace -p "*-shared" -p "rtx-*"
|
||
|
||
# Run specific demo tests
|
||
cargo test -p rtx-hemodynamics
|
||
cargo test -p inference-profiler-shared
|
||
cargo test -p segmentation-shared
|
||
|
||
# Frontend tests
|
||
cd demos/ui && pnpm test
|
||
```
|
||
|
||
### Test Coverage
|
||
|
||
| Category | Crates | Tests |
|
||
|----------|--------|-------|
|
||
| Medical/Science | 12 | 600+ |
|
||
| AI/ML | 12 | 500+ |
|
||
| Finance | 6 | 200+ |
|
||
| Vision | 6 | 250+ |
|
||
| **Total** | **36** | **1,550+** |
|
||
|
||
## Performance Targets
|
||
|
||
| Metric | Target |
|
||
|--------|--------|
|
||
| Inference latency | <50ms for 10k points |
|
||
| UI responsiveness | 30+ FPS |
|
||
| GPU memory | <2GB per simulation |
|
||
| Build time | <5 min full rebuild |
|
||
|
||
## License
|
||
|
||
Part of RustyTorch++. See repository root for license information.
|