yasfpy.coupling.cuda_dense ========================== .. py:module:: yasfpy.coupling.cuda_dense .. autoapi-nested-parse:: CUDA implementation of the dense coupling matvec. This module implements :class:`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_row`` - ``YASF_GPU_COUPLING_AUTOTUNE``: enable/disable autotuning - ``YASF_GPU_COUPLING_AUTOTUNE_REPS``: repetitions per strategy candidate - ``YASF_GPU_COUPLING_PIPELINE``: enable chunked D2H overlap - ``YASF_GPU_COUPLING_CHUNK_ROWS``: chunk size (rows) for pipelining .. rubric:: Notes The coupling operator is based on VSWF translations as used in multiple-scattering approaches :cite:`Waterman-1971-ID50` and in CELES :cite:`Egel-2017-ID1`. Classes ------- .. autoapisummary:: yasfpy.coupling.cuda_dense.CudaDenseCouplingOps Module Contents --------------- .. py:class:: CudaDenseCouplingOps(sim) Bases: :py:obj:`yasfpy.coupling.ops.DenseCouplingOps` CUDA dense coupling linear operator. :param sim: Simulation instance providing precomputed pairwise lookup tables. .. rubric:: Notes This implementation caches device memory for lookup tables and uses pinned host buffers for asynchronous copies. .. py:method:: matvec(x, idx = None) Compute the dense coupling matvec on the GPU. :param x: Input array. For multi-wavelength usage, the trailing dimension is the wavelength/channel axis. :param idx: Optional wavelength/channel index. When provided, uses a single-wavelength kernel (avoids atomics). :returns: The product ``W @ x``. If ``idx`` is not ``None``, the result is squeezed to drop the singleton channel axis. :rtype: numpy.ndarray