Skip to main content

GpuIntegrator

Trait GpuIntegrator 

Source
pub trait GpuIntegrator: Send {
    // Required methods
    fn integrate_simpsons_gpu(
        &mut self,
        file_path: &Path,
        offset: u64,
        size: u64,
        step_size: f32,
    ) -> Result<f64, GpuError>;
    fn integrate_simpson_38_gpu(
        &mut self,
        file_path: &Path,
        offset: u64,
        size: u64,
        step_size: f32,
    ) -> Result<f64, GpuError>;
    fn available_vram(&self) -> u64;
}
Expand description

Platform-agnostic GPU integration interface.

Abstracts over DirectStorage, GPUDirect, and WebGPU to provide a unified API for GPU-accelerated calculus operations.

Required Methods§

Source

fn integrate_simpsons_gpu( &mut self, file_path: &Path, offset: u64, size: u64, step_size: f32, ) -> Result<f64, GpuError>

Executes Simpson’s rule integration on the GPU.

§Arguments
  • file_path - Path to the data file (NVMe storage)
  • offset - Byte offset in file (must be 4096-byte aligned)
  • size - Number of bytes to process (must be 4096-byte aligned)
  • step_size - Integration step size (f32 for Quin packing)
§Returns

The integrated value as f64, ready to pack into Quin metadata.

Source

fn integrate_simpson_38_gpu( &mut self, file_path: &Path, offset: u64, size: u64, step_size: f32, ) -> Result<f64, GpuError>

Executes composite Simpson 3/8 quadrature on the GPU.

Source

fn available_vram(&self) -> u64

Returns available VRAM in bytes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl GpuIntegrator for WebGpuIntegrator

WebGPU-based GPU integrator (cross-platform fallback).

Uses wgpu to execute compute shaders when DirectStorage or GPUDirect are unavailable. Data flows: NVMe → CPU RAM → GPU VRAM.