Getting Started
Install
Section titled “Install”Install the public core package:
pnpm add @volten/coreYou can also use another package manager:
npm install @volten/coreyarn add @volten/corebun add @volten/coreRun a Kernel
Section titled “Run a Kernel”This example creates one GPU buffer, multiplies each value by a uniform, and reads the result back.
If the result contains [10, 20, 30, 40], Volten is working in your environment.
import { volten, Buffer, Kernel, Uniform } from '@volten/core';
const v = await volten();const inout = new Buffer([1, 2, 3, 4], 'f32', 'rw');const mult = new Uniform(10, 'f32');
const kernel = new Kernel(` fn main(gid: vec3u) { inout[gid.x] = inout[gid.x] * mult; }`);
const node = v.pass(kernel, { inout, mult });v.run(node);
console.log(await v.read(inout));// Float32Array [10, 20, 30, 40]Browser Support
Section titled “Browser Support”Volten needs WebGPU, and in a browser, that means navigator.gpu must be available.