Skip to main content

Crate refloxide_gpu

Crate refloxide_gpu 

Source
Expand description

Portable GPU backend for the decoupled uniaxial recursion.

Dispatches refloxide_tmm::kernel::solve_point_recursive as a WGSL compute shader through wgpu, which targets Metal (Apple), Vulkan (NVIDIA, AMD, Intel, Linux/Windows) and DX12 (Windows) from one source. Arithmetic is single precision; the recursion’s cancellation-free formulation keeps relative reflectance error near 1e-5 against the double-precision 4x4 reference (see the kernel_precision example of refloxide-tmm).

GpuContext::reflectivity_points_general additionally runs the general dielectric-tensor 4x4 engine (refloxide_tmm::kernel::solve_point_general). It needs double precision to be accurate for tilted and biaxial layers, which requires native f64 shaders (wgpu SHADER_F64: Vulkan and DX12 adapters, not Metal); see GpuContext::supports_f64.

This module does not provide amplitude transmission, and it does not validate physics inputs beyond buffer shapes. A GpuContext owns one device and compiled pipelines and should be created once and reused: device acquisition and shader compilation cost far more than a dispatch.

Structs§

GpuContext
Device, queue, and compiled recursion pipelines for one GPU adapter.

Enums§

Df64Op
Operation probed by GpuContext::df64_selftest.
GeneralPrecision
Numeric precision of the general-tensor shader build.

Functions§

shared_context
Process-wide GpuContext, created on first use and reused thereafter.
uniaxial_reflectivity_batch
GPU counterpart of refloxide_tmm::uniaxial::uniaxial_reflectivity_batch.
uniaxial_reflectivity_points
GPU counterpart of refloxide_tmm::uniaxial::uniaxial_reflectivity_points.
uniaxial_reflectivity_points_jvp
GPU counterpart of refloxide_tmm::uniaxial::uniaxial_reflectivity_points_jvp.