yasfpy.coupling.cuda_dense#
CUDA implementation of the dense coupling matvec.
This module implements yasfpy.coupling.ops.DenseCouplingOps using Numba’s
CUDA backend. It caches device buffers (lookup tables, input/output vectors) and
can autotune between kernel strategies for the single-wavelength matvec.
Environment Variables#
The following environment variables influence kernel selection and data movement:
YASF_GPU_COUPLING_STRATEGY:auto|thread_row|block_rowYASF_GPU_COUPLING_AUTOTUNE: enable/disable autotuningYASF_GPU_COUPLING_AUTOTUNE_REPS: repetitions per strategy candidateYASF_GPU_COUPLING_PIPELINE: enable chunked D2H overlapYASF_GPU_COUPLING_CHUNK_ROWS: chunk size (rows) for pipelining
Notes
The coupling operator is based on VSWF translations as used in multiple-scattering approaches [Waterman, 1971] and in CELES [Egel et al., 2017].
Classes#
CUDA dense coupling linear operator. |
Module Contents#
- class yasfpy.coupling.cuda_dense.CudaDenseCouplingOps(sim)#
Bases:
yasfpy.coupling.ops.DenseCouplingOpsCUDA dense coupling linear operator.
- Parameters:
sim – Simulation instance providing precomputed pairwise lookup tables.
Notes
This implementation caches device memory for lookup tables and uses pinned host buffers for asynchronous copies.
- matvec(x, idx=None)#
Compute the dense coupling matvec on the GPU.
- Parameters:
x – Input array. For multi-wavelength usage, the trailing dimension is the wavelength/channel axis.
idx – Optional wavelength/channel index. When provided, uses a single-wavelength kernel (avoids atomics).
- Returns:
The product
W @ x. Ifidxis notNone, the result is squeezed to drop the singleton channel axis.- Return type: