Colorful soft-body letters piling up in a physics simulation

Graphics programming for everyone

Kelvin turns plain Python into parallel kernels that run on your GPU. Simulation, rendering and numerics — at native speed.

Why Kelvin

The performance of C++, written like Python.

Just-in-time compiled

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

Runs everywhere

One codebase targets CUDA, Vulkan, Metal and multi-threaded x86 back ends automatically.

Built for simulation

Spatially sparse data structures, differentiable kernels and a physics-first standard library.

Interops natively

Zero-copy exchange with NumPy and PyTorch tensors keeps your existing pipeline intact.

Get started

Up and running in one line.

Install from PyPI, decorate a function with @kv.kernel, and every loop at the outermost level is parallelized across your hardware.

pip install kelvin-lang
julia.py
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()

Adopted and trusted

Trusted by the open source community and by leaders from academia and industry.

14.8k+
Stars
on GitHub
500k+
Total downloads
from PyPI
60+
Active contributors
from the community
10+
Partners
in academia and industry

Start writing kernels tonight.

Read the docs