JSPM

wave-gpu

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q66502F
  • License Apache-2.0

Write GPU kernels in TypeScript, run on any GPU

Package Exports

  • wave-gpu
  • wave-gpu/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wave-gpu) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

WAVE TypeScript/JavaScript SDK

Write GPU kernels in TypeScript, run on any GPU.

Install

npm install wave-gpu

Usage

import { device, kernel, array, zeros } from 'wave-gpu';

const dev = await device();
const vectorAdd = kernel(`
    function vector_add(a: f32[], b: f32[], out: f32[], n: u32) {
        const gid = thread_id();
        if (gid < n) { out[gid] = a[gid] + b[gid]; }
    }
`, 'typescript');

const a = array([1, 2, 3, 4]);
const b = array([5, 6, 7, 8]);
const out = zeros(4);
await vectorAdd.launch(dev, [a, b, out], [4], [1,1,1], [256,1,1]);
console.log(out.toArray());

License

Apache 2.0 - see LICENSE