Expand description
Optional, off-by-default, NVIDIA-only CUDA acceleration for the
Hessian-vector products at the heart of the Newton-CG inner loop, calling
the pure-Rust oxicuda-* library crates directly.
This module is ADDITIVE and entirely feature-gated behind the cuda feature
(off by default). It does not replace or modify the existing gpu subsystem
(src/gpu/) or the wgpu Newton-CG / CG / L-BFGS paths
(src/unconstrained/{newton_gpu,cg_gpu,lbfgs_gpu}.rs). Every public function
is f64-native — there is no silent f32 downcast at the boundary, which is
the advantage of the oxicuda CUDA path over the f32 wgpu path.
Each entry point degrades safely when no NVIDIA device is present:
cuda_is_available never panics, and the compute functions return an
crate::error::OptimizeError::ComputationError rather than aborting.
§Library-call pattern
The inner CG loop of the Newton-CG subsystem performs, per iteration, a
Hessian-vector product H · p (a dense matrix×vector multiply, O(n²))
that dominates the per-iteration cost for large n. This module hands that
product off to the pre-built, battle-tested oxicuda-blas GEMM rather than
authoring any bespoke kernels, mirroring the proven matrix×vector layout of
the Phase-1 interpolate reference
(scirs2-interpolate/src/gpu_cuda.rs::cuda_eval_gemm).
§Scoping note
This is a standalone additive function, deliberately NOT wired into
minimize_newton_cg / newton.rs — exactly like the Phase-1 crates kept
their cuda_* functions standalone.
Functions§
- cuda_
hessian_ vector_ product - Compute the Hessian-vector product
H · von the GPU inf64. - cuda_
is_ available - Returns
trueiff the CUDA driver initializes and at least one NVIDIA device is visible. Never panics.