Just-in-time compiled
Python functions are compiled to native CPU and GPU kernels at runtime — no rewrite, no build step.

Kelvin turns plain Python into parallel kernels that run on your GPU. Simulation, rendering and numerics — at native speed.
Why Kelvin
Python functions are compiled to native CPU and GPU kernels at runtime — no rewrite, no build step.
One codebase targets CUDA, Vulkan, Metal and multi-threaded x86 back ends automatically.
Spatially sparse data structures, differentiable kernels and a physics-first standard library.
Zero-copy exchange with NumPy and PyTorch tensors keeps your existing pipeline intact.
Get started
Install from PyPI, decorate a function with @kv.kernel, and every loop at the outermost level is parallelized across your hardware.
import kelvin as kv
kv.init(arch=kv.gpu)
n = 320
pixels = kv.field(dtype=float, shape=(n * 2, n))
@kv.kernel
def paint(t: float):
for i, j in pixels: # parallelized
pixels[i, j] = kv.sin(i * 0.02 + t) * 0.5 + 0.5
gui = kv.GUI("Julia Set", res=(n * 2, n))
for frame in range(1_000_000):
paint(frame * 0.03)
gui.set_image(pixels)
gui.show()Trusted by the open source community and by leaders from academia and industry.