Lux Docs
Gpu

Lux GPU

Go bindings for cross-platform GPU acceleration

Go bindings for luxcpp/gpu, providing GPU-accelerated array operations for crypto, ZK, and ML workloads. Used by github.com/luxfi/accel for high-level blockchain acceleration.

Backend Support

BackendPlatformDependenciesPriority
CUDALinux/WindowsCUDA Toolkit1 (highest)
MetalmacOS arm64Metal.framework2
WebGPUAllDawn3
CPUAllNone4 (fallback)

Backend is auto-detected at runtime in priority order. Override with LUX_GPU_BACKEND env var (cuda, metal, webgpu, cpu).

Build Modes

ModeCommandGPU Support
CPU onlyCGO_ENABLED=0 go build ./...No (pure Go fallback)
GPU enabledCGO_ENABLED=1 go build ./...Yes (requires luxcpp/gpu)

Data Types

TypeDescription
Float3232-bit float (default)
Float1616-bit float
BFloat16Brain float 16
Int32 / Int64Signed integers
Uint32 / Uint64Unsigned integers
BoolBoolean

Quick Start

import "github.com/luxfi/gpu"

a := gpu.Ones([]int{1024, 1024}, gpu.Float32)
b := gpu.Random([]int{1024, 1024}, gpu.Float32)
c := gpu.MatMul(a, b)
gpu.Synchronize()
fmt.Println(gpu.Info())

On this page