rustorch 0.5.16

Production-ready PyTorch-compatible deep learning library in Rust with special mathematical functions (gamma, Bessel, error functions), statistical distributions, Fourier transforms (FFT/RFFT), matrix decomposition (SVD/QR/LU/eigenvalue), automatic differentiation, neural networks, computer vision transforms, complete GPU acceleration (CUDA/Metal/OpenCL), SIMD optimizations, parallel processing, WebAssembly browser support, comprehensive distributed learning support, and performance validation
Documentation
# RusTorch GPU Dockerfile
# CUDA and OpenCL support for GPU acceleration

FROM nvidia/cuda:12.2-devel-ubuntu22.04 as builder

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    pkg-config \
    libssl-dev \
    cmake \
    clang \
    python3 \
    python3-dev \
    ocl-icd-opencl-dev \
    opencl-headers \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /usr/src/rustorch

# Copy manifests
COPY Cargo.toml Cargo.lock ./

# Create dummy main for dependency caching
RUN mkdir -p src && echo "fn main() {}" > src/main.rs
RUN cargo build --release --features "cuda opencl" && rm -rf src

# Copy source code
COPY src ./src
COPY examples ./examples

# Build with GPU features
RUN cargo build --release --features "cuda opencl"

# Production stage
FROM nvidia/cuda:12.2-runtime-ubuntu22.04

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
    ca-certificates \
    libssl3 \
    python3 \
    python3-pip \
    ocl-icd-opencl-dev \
    && rm -rf /var/lib/apt/lists/*

# Create app user
RUN useradd -m -u 1001 rustorch

# Create directories
RUN mkdir -p /app/data /app/models /app/output && \
    chown -R rustorch:rustorch /app

# Copy built artifacts
COPY --from=builder /usr/src/rustorch/target/release/deps/* /app/bin/
COPY --from=builder /usr/src/rustorch/target/release/librustorch.* /app/lib/
COPY --from=builder /usr/src/rustorch/examples /app/examples/

# Set environment variables
ENV RUST_LOG=info
ENV CUDA_VISIBLE_DEVICES=0
ENV RUSTORCH_GPU=true

# Switch to non-root user
USER rustorch
WORKDIR /app

# Health check with GPU validation
HEALTHCHECK --interval=60s --timeout=30s --start-period=10s --retries=3 \
    CMD nvidia-smi || exit 1

CMD ["bash"]