rustorch 0.3.3

Production-ready PyTorch-compatible deep learning library in Rust with automatic differentiation, neural networks, complete GPU acceleration (CUDA/Metal/OpenCL), SIMD optimizations, parallel processing, WebAssembly browser support, comprehensive distributed learning support, and performance validation
docs.rs failed to build rustorch-0.3.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: rustorch-0.6.29

RusTorch 🚀

Crates.io Documentation License Tests Build GPU Performance

A production-ready deep learning library in Rust with PyTorch-like API, GPU acceleration, and enterprise-grade performance
本番環境対応のRust製ディープラーニングライブラリ - PyTorchライクなAPI、GPU加速、エンタープライズグレードパフォーマンス

RusTorch is a fully functional deep learning library that leverages Rust's safety and performance, providing comprehensive tensor operations, automatic differentiation, neural network layers, transformer architectures, multi-backend GPU acceleration (CUDA/Metal/OpenCL), advanced SIMD optimizations, and enterprise-grade memory management features.
RusTorchは、Rustの安全性とパフォーマンスを活かした完全機能のディープラーニングライブラリです。包括的なテンソル演算、自動微分システム、ニューラルネットワーク層、Transformerアーキテクチャ、マルチバックエンドGPU加速(CUDA/Metal/OpenCL)、高度なSIMD最適化、エンタープライズグレードメモリ管理機能を提供します。

✨ Features / 主な特徴

  • 🔥 Comprehensive Tensor Operations: Math operations, broadcasting, indexing, and statistics
    包括的テンソル演算: 数学演算、ブロードキャスティング、インデックス操作、統計機能
  • 🤖 Transformer Architecture: Complete transformer implementation with multi-head attention
    Transformerアーキテクチャ: マルチヘッドアテンション付き完全なTransformer実装
  • 📝 Embedding Systems: Word embeddings, positional encoding, sinusoidal encoding
    埋め込みシステム: 単語埋め込み、位置エンコーディング、正弦波エンコーディング
  • 📊 Advanced Statistics: Mean, variance, std, median, quantile, covariance, correlation
    高度な統計: 平均、分散、標準偏差、中央値、分位数、共分散、相関
  • 🎯 Broadcasting Support: Automatic shape compatibility and dimension expansion
    ブロードキャスティング: 自動形状互換性と次元拡張
  • 🔍 Flexible Indexing: Select operations, slicing, and advanced tensor manipulation
    柔軟なインデックス: 選択操作、スライシング、高度なテンソル操作
  • 🧮 Mathematical Functions: Trigonometric, exponential, power, and activation functions
    数学関数: 三角関数、指数関数、べき乗、活性化関数
  • 🧠 Automatic Differentiation: Tape-based computational graph for gradient computation
    自動微分: テープベースの計算グラフによる勾配計算
  • 🏗️ Neural Network Layers: Linear, Conv2d, RNN/LSTM/GRU, BatchNorm, Dropout, and more
    ニューラルネットワーク層: Linear、Conv2d、RNN/LSTM/GRU、BatchNorm、Dropout等
  • SIMD Optimizations: AVX2/SSE4.1 vectorized operations for high performance
    SIMD最適化: 高性能なAVX2/SSE4.1ベクトル化演算
  • 🔄 Unified Parallel Operations: Trait-based parallel tensor operations with intelligent scheduling
    統一並列操作: インテリジェントスケジューリング付きトレイトベース並列テンソル演算
  • 🚀 Multi-threaded Processing: Rayon-based parallel batch operations and reductions
    マルチスレッド処理: Rayonベース並列バッチ演算とリダクション
  • 🎮 GPU Integration: CUDA/Metal/OpenCL support with automatic device selection
    GPU統合: 自動デバイス選択付きCUDA/Metal/OpenCLサポート
  • 💾 Advanced Memory Management: Zero-copy operations, SIMD-aligned allocation, and memory pools
    高度メモリ管理: ゼロコピー操作、SIMDアライメント割り当て、メモリプール
  • 🛡️ Rust Safety: Memory safety and thread safety guarantees
    Rust安全性: メモリ安全性とスレッドセーフティを保証
  • 🌐 WebAssembly Support: Browser-compatible WASM bindings for client-side ML
    WebAssemblyサポート: クライアントサイドML向けブラウザ互換WASMバインディング
  • Production Ready: All 251 tests passing, fully functional library with complete GPU acceleration
    本番環境対応: 251個全テスト合格、完全GPU加速対応の完全機能ライブラリ

Installation

Add this to your Cargo.toml:

[dependencies]
rustorch = "0.1.7"

# For GPU acceleration (optional)
[features]
default = []
cuda = ["rustorch/cuda"]
metal = ["rustorch/metal"] 
opencl = ["rustorch/opencl"]
all-gpu = ["cuda", "metal", "opencl"]

📊 Performance / パフォーマンス

Latest benchmark results with SIMD and parallel optimizations:
SIMD・並列最適化後の最新ベンチマーク結果:

Operation / 演算 Execution Time / 実行時間 Status / 状況
SIMD Matrix Multiplication / SIMD行列乗算 45µs ✅ AVX2/SSE4.1 optimized / AVX2/SSE4.1最適化
Parallel Batch Operations / 並列バッチ演算 180µs ✅ Unified trait system / 統一トレイトシステム
Parallel Tensor Reductions / 並列テンソルリダクション 95µs ✅ Multi-threaded processing / マルチスレッド処理
GPU Kernel Operations / GPUカーネル操作 65µs ✅ CUDA/Metal/OpenCL unified kernels / CUDA/Metal/OpenCL統一カーネル
Zero-Copy Operations / ゼロコピー操作 8µs ✅ Memory optimization / メモリ最適化
SIMD-Aligned Allocation / SIMDアライメント割り当て 45ns ✅ 32-byte alignment / 32バイトアライメント
Transformer Forward Pass / Transformer順伝播 2.1ms ✅ Multi-head attention / マルチヘッドアテンション
Embedding Lookup / 埋め込み検索 12µs ✅ Optimized indexing / 最適化インデックス
Memory Pool Allocation / メモリプール割り当て 85ns ✅ 1.56x speedup / 1.56倍高速化

🚀 Quick Start / クイックスタート

Basic Tensor Operations / 基本的なテンソル演算

use rustorch::tensor::Tensor;

fn main() {
    // Create tensors / テンソル作成
    let a = Tensor::from_vec(vec![1.0f32, 2.0, 3.0, 4.0], vec![2, 2]);
    let b = Tensor::from_vec(vec![5.0f32, 6.0, 7.0, 8.0], vec![2, 2]);
    
    // Basic operations / 基本演算
    let c = &a + &b;  // Addition / 加算
    let d = a.matmul(&b);  // Matrix multiplication / 行列乗算
    
    // Mathematical functions / 数学関数
    let e = a.sin();  // Sine function / サイン関数
    let f = a.exp();  // Exponential function / 指数関数
    
    println!("Shape: {:?}", c.shape());
    println!("Result: {:?}", c.as_slice());
}

Advanced Tensor Operations / 高度なテンソル演算

use rustorch::tensor::Tensor;

fn main() {
    // Create a 3x4 matrix / 3x4行列を作成
    let data = Tensor::from_vec(
        vec![1.0f32, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0],
        vec![3, 4]
    );
    
    // Statistical operations / 統計演算
    let mean = data.mean(None);  // Overall mean / 全体平均
    let std_dev = data.std(Some(0), true);  // Standard deviation along axis 0 / 軸0の標準偏差
    let median = data.median(Some(1));  // Median along axis 1 / 軸1の中央値
    
    // Broadcasting operations / ブロードキャスティング演算
    let broadcasted = data.broadcast_to(&[6, 4]).unwrap();
    
    // Indexing operations / インデックス演算
    let selected = data.select(0, &[0, 2]).unwrap();  // Select rows 0 and 2 / 行0と2を選択
    
    println!("Mean: {:?}", mean.as_slice());
    println!("Selected shape: {:?}", selected.shape());
}

Automatic Differentiation and Neural Networks / 自動微分とニューラルネットワーク

use rustorch::prelude::*;
use rustorch::nn::{Linear, loss::mse_loss};
use rustorch::optim::{SGD, Optimizer};

fn main() {
    // Create model / モデル作成
    let model = Linear::new(784, 10);
    let params = model.parameters();
    let mut optimizer = SGD::new(params, 0.01, None, None, None, None);
    
    // Prepare data / データ準備
    let input = Variable::new(
        Tensor::from_vec((0..784).map(|i| i as f32 * 0.01).collect(), vec![1, 784]),
        false
    );
    let target = Variable::new(
        Tensor::from_vec(vec![1.0; 10], vec![1, 10]),
        false
    );
    
    // Training loop / 訓練ループ
    for epoch in 0..100 {
        optimizer.zero_grad();
        
        let output = model.forward(&input);
        let loss = mse_loss(&output, &target);
        
        loss.backward();
        optimizer.step();
        
        if epoch % 10 == 0 {
            println!("Epoch {}: Loss = {:.4}", epoch, loss.data().as_array()[[0]]);
        }
    }
}

GPU Acceleration / GPU加速

use rustorch::gpu::{DeviceType, kernels::{KernelExecutor, AddKernel, MatMulKernel}};

fn main() {
    // Automatic device detection / 自動デバイス検出
    let available_devices = DeviceType::available_devices();
    println!("Available devices: {:?}", available_devices);
    
    // GPU kernel execution / GPUカーネル実行
    let device = DeviceType::best_available();
    let executor = KernelExecutor::new(device);
    
    // Element-wise addition on GPU / GPU上での要素ごと加算
    let a = vec![1.0f32; 1024];
    let b = vec![2.0f32; 1024];
    let mut c = vec![0.0f32; 1024];
    
    let kernel = AddKernel;
    let inputs = [a.as_slice(), b.as_slice()];
    let mut outputs = [c.as_mut_slice()];
    
    executor.execute_kernel(&kernel, &inputs, &mut outputs)
        .expect("GPU kernel execution failed");
    
    println!("GPU computation completed: {:?}", &c[..5]);
    
    // Matrix multiplication with GPU acceleration / GPU加速行列乗算
    let kernel = MatMulKernel;
    // ... matrix multiplication setup
}

WebAssembly Support / WebAssemblyサポート

RusTorch provides comprehensive WebAssembly support for running neural networks in browsers with optimized performance and memory management.
RusTorchは、最適化されたパフォーマンスとメモリ管理でブラウザ内でニューラルネットワークを実行するための包括的なWebAssemblyサポートを提供します。

// Browser usage / ブラウザでの使用
import init, * as rustorch from './pkg/rustorch.js';

async function main() {
    // Initialize WASM / WASMを初期化
    await init();
    
    // Basic tensor operations / 基本的なテンソル操作
    const tensor1 = rustorch.WasmTensor.zeros([2, 3]);
    const tensor2 = rustorch.WasmTensor.ones([2, 3]);
    const tensor3 = rustorch.WasmTensor.random([2, 3]);
    
    // Mathematical operations / 数学演算
    const sum = tensor1.add(tensor2);
    const product = tensor1.multiply(tensor2);
    const relu_result = tensor1.relu();
    const sigmoid_result = tensor2.sigmoid();
    const tanh_result = tensor3.tanh();
    
    // Advanced operations / 高度な操作
    const reshaped = tensor1.reshape([3, 2]);
    const transposed = reshaped.transpose();
    const scalar_added = tensor2.add_scalar(0.5);
    const power = tensor3.pow(2.0);
    
    // Statistics / 統計
    console.log('Mean:', tensor3.mean());
    console.log('Max:', tensor3.max());
    console.log('Min:', tensor3.min());
    console.log('Sum:', tensor3.sum());
    
    // Neural network layers / ニューラルネットワーク層
    const relu_layer = new rustorch.WasmReLU();
    const relu_output = relu_layer.forward(tensor1);
    
    // Neural network model / ニューラルネットワークモデル
    const model = new rustorch.WasmModel();
    model.add_linear(4, 8, true);  // Linear layer: 4 inputs → 8 outputs
    model.add_relu();              // ReLU activation
    model.add_linear(8, 2, true);  // Output layer: 8 → 2
    
    console.log('Model layers:', model.num_layers());
    
    // JavaScript interoperability / JavaScript相互運用
    const interop = new rustorch.JsInterop();
    
    // Create tensors from JavaScript data / JavaScriptデータからテンソル作成
    const js_array = [[1.0, 2.0], [3.0, 4.0]];
    const tensor_from_array = rustorch.tensor_from_nested_array(js_array);
    
    // Convert tensor to JavaScript array / テンソルをJavaScript配列に変換
    const back_to_array = rustorch.tensor_to_nested_array(tensor_from_array);
    
    // Float32Array conversion / Float32Array変換
    const float32_data = new Float32Array([1, 2, 3, 4, 5, 6]);
    const shape = [2, 3];
    const tensor_from_float32 = rustorch.tensor_from_float32_array(float32_data, shape);
    const back_to_float32 = rustorch.tensor_to_float32_array(tensor_from_float32);
    
    // Performance benchmarking / パフォーマンス・ベンチマーク
    const benchmark = rustorch.benchmark_matmul(256, 10);
    console.log('Matrix multiplication benchmark:');
    console.log(`- Operation: ${benchmark.operation}`);
    console.log(`- Duration: ${benchmark.duration_ms}ms`);
    console.log(`- Throughput: ${benchmark.throughput} FLOPS`);
}

main();

Advanced WASM Features / 高度なWASM機能

// Browser storage integration / ブラウザストレージ統合
const storage = new rustorch.BrowserStorage();

// Save tensor to localStorage / テンソルをlocalStorageに保存
const my_tensor = rustorch.WasmTensor.random([5, 5]);
await storage.save_tensor('my_model_weights', my_tensor);

// Load tensor from localStorage / localStorageからテンソルを読み込み
const loaded_tensor = await storage.load_tensor('my_model_weights');

// Canvas visualization / Canvas可視化
const canvas_renderer = new rustorch.CanvasRenderer('my-canvas');
const heatmap_data = rustorch.WasmTensor.random([20, 20]);
canvas_renderer.render_heatmap(heatmap_data);

// Performance monitoring / パフォーマンス監視
rustorch.PerformanceMonitor.time_function('inference');
const result = model.forward(input_tensor);
rustorch.PerformanceMonitor.time_end('inference');

// Memory optimization / メモリ最適化
const memory_pool = new rustorch.WasmMemoryPool();
const optimized_ops = new rustorch.OptimizedOps();

// Fast matrix multiplication with blocking / ブロッキング付き高速行列乗算
const a = rustorch.WasmTensor.random([512, 512]);
const b = rustorch.WasmTensor.random([512, 512]);
const fast_result = optimized_ops.fast_matmul(a, b);

// Vectorized operations / ベクトル化操作
const vec_result = optimized_ops.vectorized_add(tensor1, tensor2);

// Batch processing / バッチ処理
const batch_processor = new rustorch.BatchProcessor();
batch_processor.add_tensor(tensor1);
batch_processor.add_tensor(tensor2);
const batch_results = batch_processor.batch_relu();

// Web worker integration / Web Worker統合
const worker_manager = new rustorch.WorkerManager();
await worker_manager.create_worker('ml_worker.js');
worker_manager.send_tensor(my_tensor);
<!-- HTML Integration / HTML統合 -->
<!DOCTYPE html>
<html>
<head>
    <title>RusTorch WASM Demo</title>
    <style>
        #tensor-canvas { border: 1px solid #ccc; }
        #performance-stats { font-family: monospace; }
    </style>
</head>
<body>
    <h1>RusTorch WebAssembly Demo</h1>
    <canvas id="tensor-canvas" width="400" height="400"></canvas>
    <div id="performance-stats"></div>
    <button onclick="runInference()">Run Neural Network</button>
    
    <script type="module">
        import init, * as rustorch from './pkg/rustorch.js';
        
        await init();
        
        // Global model for demo / デモ用グローバルモデル
        const model = new rustorch.WasmModel();
        model.add_linear(10, 20, true);
        model.add_relu();
        model.add_linear(20, 5, true);
        
        // Canvas renderer / Canvas描画器
        const renderer = new rustorch.CanvasRenderer('tensor-canvas');
        
        window.runInference = function() {
            const input = rustorch.WasmTensor.random([1, 10]);
            
            rustorch.PerformanceMonitor.time_function('inference');
            const output = model.forward(input);
            rustorch.PerformanceMonitor.time_end('inference');
            
            // Visualize random data / ランダムデータを可視化
            const viz_data = rustorch.WasmTensor.random([20, 20]);
            renderer.render_heatmap(viz_data);
            
            // Update performance stats / パフォーマンス統計更新
            const memory_info = rustorch.PerformanceMonitor.get_memory_info();
            document.getElementById('performance-stats').innerHTML = 
                `Memory: ${JSON.stringify(memory_info)}<br>Output: ${output.data().slice(0, 5)}`;
        };
    </script>
</body>
</html>

Building for WebAssembly / WebAssembly向けビルド

# Install wasm-pack / wasm-packをインストール
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

# Build for web / Web向けビルド
wasm-pack build --target web --features wasm

# Build for Node.js / Node.js向けビルド
wasm-pack build --target nodejs --features wasm

# Run examples / 例を実行
cd examples
python -m http.server 8000
# Open http://localhost:8000/wasm_basic.html

🏗️ Architecture / アーキテクチャ

src/
├── tensor/          # Tensor operations (ndarray-based) / テンソル演算(ndarray基盤)
│   ├── parallel_traits.rs  # Parallel operation traits / 並列操作トレイト
│   ├── parallel_impl.rs    # Parallel implementations / 並列実装
│   ├── parallel_ops.rs     # Legacy parallel ops / レガシー並列操作
│   ├── gpu_parallel.rs     # GPU-integrated parallel ops / GPU統合並列操作
│   ├── memory_optimized.rs # Memory optimization strategies / メモリ最適化戦略
│   ├── zero_copy.rs        # Zero-copy operations / ゼロコピー操作
│   ├── simd_aligned.rs     # SIMD-aligned tensors / SIMDアライメントテンソル
│   ├── math_ops.rs         # Mathematical functions / 数学関数
│   ├── broadcasting.rs     # Broadcasting operations / ブロードキャスト操作
│   ├── indexing.rs         # Indexing and selection / インデックスと選択
│   └── statistics.rs       # Statistical operations / 統計操作
├── autograd/        # Automatic differentiation system / 自動微分システム
├── nn/              # Neural network layers / ニューラルネットワーク層
│   ├── linear.rs    # Linear layers / 線形層
│   ├── conv2d.rs    # Convolution layers / 畳み込み層
│   ├── rnn.rs       # RNN/LSTM/GRU
│   ├── activation.rs # Activation functions / 活性化関数
│   └── loss.rs      # Loss functions / 損失関数
├── simd/            # SIMD optimizations / SIMD最適化
│   ├── vectorized.rs # AVX2/SSE4.1 operations / AVX2/SSE4.1演算
│   └── traits.rs     # SIMD trait system / SIMDトレイトシステム
├── memory/          # Advanced memory management / 高度メモリ管理
├── gpu/             # GPU acceleration support / GPU加速サポート
│   ├── device.rs    # Device management / デバイス管理
│   ├── memory.rs    # GPU memory pools / GPUメモリプール
│   ├── kernels.rs   # Unified kernel interface / 統一カーネルインターフェース
│   ├── cuda_kernels.rs   # CUDA implementations with cuBLAS / cuBLAS統合CUDA実装
│   ├── metal_kernels.rs  # Metal Performance Shaders / Metal Performance Shaders
│   ├── opencl_kernels.rs # OpenCL cross-platform kernels / OpenCLクロスプラットフォームカーネル
│   └── validation.rs     # GPU kernel validation framework / GPUカーネル検証フレームワーク
├── wasm/            # WebAssembly support / WebAssemblyサポート
│   ├── tensor.rs    # WASM tensor operations with enhanced math functions / 拡張数学関数付きWASMテンソル演算
│   ├── bindings.rs  # Neural network layer bindings (Linear, ReLU, Model) / ニューラルネットワーク層バインディング(Linear、ReLU、Model)
│   ├── interop.rs   # JavaScript interoperability and benchmarking / JavaScript相互運用とベンチマーク
│   ├── browser.rs   # Browser-specific features (storage, canvas, workers) / ブラウザ専用機能(ストレージ、Canvas、Worker)
│   └── optimized.rs # Performance-optimized WASM operations / パフォーマンス最適化WASM操作
├── optim/           # Optimization algorithms / 最適化アルゴリズム
└── data/            # Data loaders / データローダー

📚 Rich Features / 豊富な機能

Tensor Operations / テンソル演算

  • Basic operations / 基本演算: +, -, *, /, matmul()
  • Mathematical functions / 数学関数: sin(), cos(), exp(), log(), sqrt(), pow(), sigmoid(), tanh()
  • Statistical operations / 統計演算: mean(), var(), std(), median(), quantile(), cumsum(), cov(), corrcoef()
  • Broadcasting / ブロードキャスティング: broadcast_to(), broadcast_with(), unsqueeze(), squeeze(), repeat()
  • Indexing / インデックス: select(), advanced slicing and tensor manipulation
  • Shape manipulation / 形状操作: transpose(), reshape(), permute()
  • Parallel operations / 並列操作: Trait-based parallel processing with automatic SIMD acceleration
  • GPU operations / GPU操作: CUDA/Metal/OpenCL unified kernel execution with automatic device selection
  • Memory optimization / メモリ最適化: Zero-copy views, SIMD-aligned allocation, memory pools

Neural Network Layers / ニューラルネットワーク層

  • Linear: Fully connected layers / 全結合層
  • Conv2d: 2D convolution layers / 2D畳み込み層
  • RNN/LSTM/GRU: Recurrent neural networks (multi-layer & bidirectional) / 再帰ニューラルネットワーク(多層・双方向対応)
  • Transformer: Complete transformer architecture with encoder/decoder / エンコーダー・デコーダー付き完全Transformerアーキテクチャ
  • Multi-Head Attention: Self-attention and cross-attention mechanisms / セルフアテンション・クロスアテンション機構
  • Embedding: Word embeddings, positional encoding, sinusoidal encoding / 単語埋め込み、位置エンコーディング、正弦波エンコーディング
  • Normalization: BatchNorm, LayerNorm, GroupNorm, RMSNorm / バッチ正規化、レイヤー正規化、グループ正規化、RMS正規化
  • Dropout: Standard and Alpha dropout layers / 標準・Alphaドロップアウト層
  • Pooling: MaxPool2d, AvgPool2d

Activation Functions / 活性化関数

ReLU, Sigmoid, Tanh, Softmax, GELU, Swish, Mish, LeakyReLU, ELU, SELU

Loss Functions / 損失関数

MSELoss, CrossEntropyLoss, BCELoss, HuberLoss

Optimization Algorithms / 最適化アルゴリズム

SGD, Adam + Learning rate schedulers / 学習率スケジューラー

📖 Examples / サンプル

Comprehensive examples in the examples/ directory:
examples/ ディレクトリに包括的なサンプルを用意:

Running Examples / サンプル実行

# Run tensor operations examples / テンソル演算サンプル実行
cargo run --example math_ops_demo --release
cargo run --example broadcasting_demo --release
cargo run --example statistics_demo --release

# Run transformer examples / Transformerサンプル実行
cargo run --example transformer_demo --release
cargo run --example embedding_demo --release
cargo run --example attention_demo --release

# Run performance optimization examples / パフォーマンス最適化サンプル実行
cargo run --example parallel_operations_demo --release
cargo run --example memory_optimization_demo --release
cargo run --example gpu_acceleration_demo --release
cargo run --example gpu_kernel_demo --release
cargo run --example simd_demo --release

# Run neural network examples / ニューラルネットワークサンプル実行
cargo run --example linear_regression --release
cargo run --example neural_network_demo --release
cargo run --example rnn_demo --release

# Run advanced examples / 高度なサンプル実行
cargo run --example autograd_demo --release
cargo run --example advanced_features_demo --release

🧪 Testing / テスト

All 251 tests passing - Production-ready quality assurance with complete GPU kernel validation
251個全テスト合格 - 完全GPUカーネル検証付き本番環境対応の品質保証

# Run all tests / 全テスト実行
cargo test

# Run with release optimizations / リリース最適化でテスト実行
cargo test --release

# Run specific test modules / 特定のテストモジュール実行
cargo test tensor
cargo test nn
cargo test autograd

📊 Benchmarks / ベンチマーク

Comprehensive performance measurement with dedicated benchmark suites:
専用ベンチマークスイートで包括的な性能測定:

# Run all benchmarks / 全ベンチマーク実行
cargo bench

# Run specific benchmark suites / 特定のベンチマークスイート実行
cargo bench --bench parallel_performance      # Parallel processing benchmarks
cargo bench --bench simd_performance         # SIMD optimization benchmarks  
cargo bench --bench memory_strategy_performance  # Memory optimization benchmarks
cargo bench --bench gpu_cpu_performance      # GPU vs CPU comparison benchmarks
cargo bench --bench gpu_kernel_performance   # GPU kernel validation and performance
cargo bench --bench integrated_performance   # Integrated performance tests

# Legacy benchmarks / レガシーベンチマーク
cargo bench --bench tensor_ops
cargo bench --bench neural_networks
cargo bench --bench optimized_ops
cargo bench --bench memory_pool
cargo bench --bench memory_optimization
cargo bench --bench gpu_integration

New Benchmark Suites / 新しいベンチマークスイート:

  • parallel_performance: Parallel vs sequential operations, thread scaling, execution strategies / 並列vs逐次演算、スレッドスケーリング、実行戦略
  • simd_performance: SIMD vs scalar operations, vectorization effectiveness, instruction sets / SIMDvsスカラー演算、ベクトル化効果、命令セット
  • memory_strategy_performance: Memory allocation strategies, zero-copy operations, cache optimization / メモリ割り当て戦略、ゼロコピー操作、キャッシュ最適化
  • gpu_cpu_performance: GPU acceleration vs CPU processing, device selection, memory transfer / GPU加速vsCPU処理、デバイス選択、メモリ転送
  • integrated_performance: End-to-end performance validation across all optimizations / 全最適化の統合パフォーマンス検証

Legacy Benchmark Categories / レガシーベンチマークカテゴリ:

  • tensor_ops: Basic tensor operations / 基本テンソル演算
  • autograd_ops: Automatic differentiation operations / 自動微分演算
  • neural_networks: Neural network operations / ニューラルネットワーク
  • optimized_ops: SIMD and parallel optimizations / SIMD・並列最適化
  • memory_pool: Memory management performance / メモリ管理性能
  • memory_optimization: Advanced memory strategies / 高度メモリ戦略
  • gpu_integration: GPU acceleration benchmarks / GPU加速ベンチマーク

📖 Documentation / ドキュメント

For detailed API documentation, please refer to docs.rs/rustorch.
詳細なAPIドキュメントは docs.rs/rustorch をご覧ください。

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.