Real-time GPU compute in the browser via WebGPU compute shaders (WGSL).
gpukernel runs a parallel N-body particle simulation on the GPU and benchmarks
the same kernel against a CPU baseline — with an automatic CPU fallback when
WebGPU isn't available, so it works in every browser.
- Real GPGPU. A WGSL compute shader with storage buffers, bind groups, and workgroup dispatch — one thread per particle. (ADR 0001)
- Honest capability handling. Runtime WebGPU detection with a CPU fallback; the app degrades gracefully instead of failing. (ADR 0002)
- A fair benchmark. Identical N-body math on GPU and CPU, compared by throughput (particle-updates/second). (ADR 0003)
| Path | What it is |
|---|---|
web/ |
Next.js frontend + all WebGPU/CPU compute |
docs/ |
Architecture + ADRs |
There is no backend — all computation runs client-side in the browser.
Prerequisites: Node 20+. (A .devcontainer ships it.)
cd web
npm install
npm run dev # http://localhost:3000Open in a WebGPU-capable browser (recent Chrome/Edge/Safari) for the GPU path; other browsers automatically use the CPU fallback.
Static frontend on Vercel — Root Directory = web. No backend, no env vars.
- WGSL compute kernel + GPU pipeline
- CPU fallback + runtime capability detection
- GPU vs CPU benchmark
- Deployed on Vercel