Skip to main content

Crate caroli_gpu

Crate caroli_gpu 

Source
Expand description

GPU backends for the Chebyshev kernels of caroli: kernel-polynomial moments and time propagation with a sparse Hamiltonian (caroli_model::SparseMatrix) rescaled so that its spectrum lies in (−1, 1).

The work is a chain of fused steps T_{n+1} = 2 H̃ T_n − T_{n−1}. Each step reduces ⟨r|T_{n+1}⟩ (KPM) or accumulates c_{n+1} T_{n+1} (propagation) as it goes, so a whole expansion runs on the GPU and only the moments or the final state come back. Several vectors go through each step together (stochastic traces, several wave packets).

  • Metal (macOS). Apple GPUs have no f64:
    • Precision::Single runs in f32, about 1e-6 relative;
    • Precision::DoubleSingle stores and computes every number as an unevaluated sum of two f32, about 1e-14 relative, for twice the memory traffic of f32.
  • CUDA (feature cuda): f64.

Re-exports§

pub use metal::MetalDevice;
pub use metal::MetalOperator;
pub use cuda::CudaDevice;
pub use cuda::CudaOperator;

Modules§

cuda
CUDA backend (chebyshev.cu, f64), compiled at run time by NVRTC. The CUDA libraries are loaded when the device is opened, so building needs no CUDA toolkit; running needs an NVIDIA driver and NVRTC.
metal
Metal backend (common.metal, chebyshev.metal, walk.metal). The kernels are compiled from source when the device is opened, without fast math (the double-single arithmetic needs exact IEEE rounding). Buffers live in shared memory: on Apple Silicon the CPU reads the results without a copy.

Structs§

MetalWalk
A walk state resident on the GPU, or the states of a batch of walks of one graph.
Options
Where a checked computation runs, and the error it may take before the CPU takes over.
Report
What a checked computation did.
WalkTables
What the kernels need to know about a walk.

Enums§

Device
Where a computation runs.
GpuError
Error of a GPU computation.
Precision
Floating-point format of a Metal computation.

Constants§

MAX_DEGREE
Largest node degree the kernels take (MAX_DEGREE in walk.metal).