Gpu

GPU tensor primitives (CuPy-backed). Imported automatically by the ``@gpu`` decorator, or via ``open Gpu``. Maps, filters, reductions, and dot products over ``Tensor`` values. For explicit CUDA device buffers with linear types, use ``Cuda`` — see ``docs/cuda.md``.
Table of Contents

Types

GpuConfig

(type)
type GpuConfig

Functions

gpu_map

Map ``f`` over every element of ``t``.
def gpu_map (f : (x : a) → b) (t : Tensor) : Tensor

gpu_imap

Map index ``i`` to an element with ``f``.
def gpu_imap (f : (i : Int) → b) (t : Tensor) : Tensor

gpu_reduce

Left-fold ``t`` with ``f`` and initial accumulator ``initial``.
def gpu_reduce (f : (acc : a) → (x : a) → a) (initial : a) (t : Tensor) : a

gpu_filter

Keep elements where ``f`` returns ``true``.
def gpu_filter (f : (x : a) → Bool) (t : Tensor) : Tensor

gpu_dot

Dot product of two tensors.
def gpu_dot (a : Tensor) (b : Tensor) : Float

run_gpu

Run ``kernel`` on ``input`` with launch ``config``; return the scalar/aggregate result.
def run_gpu (kernel : (x : Tensor) → a) (config : GpuConfig) (input : Tensor) : a