{"id":26867,"library":"cuda-wasm","title":"cuda-wasm: CUDA to WebAssembly/WebGPU Transpiler","description":"cuda-wasm (v1.1.1) is a high-performance transpiler that converts CUDA C++ code to WebAssembly and WebGPU, enabling GPU-accelerated computing in browsers and Node.js without NVIDIA hardware. It uses a clean-room implementation based on public CUDA specifications, translating CUDA syntax to Rust/WebGPU patterns. Ships with TypeScript types, supports Node >=16.0.0. Key differentiators: no NVIDIA dependencies, near-native performance via WebGPU, ruv-FANN neural network integration. Released under MIT/Apache-2.0. Active development.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/ruvnet/ruv-FANN","tags":["javascript","cuda","webassembly","wasm","webgpu","gpu","parallel-computing","transpiler","rust","typescript"],"install":[{"cmd":"npm install cuda-wasm","lang":"bash","label":"npm"},{"cmd":"yarn add cuda-wasm","lang":"bash","label":"yarn"},{"cmd":"pnpm add cuda-wasm","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CommonJS require not supported.","wrong":"const cudaWasm = require('cuda-wasm')","symbol":"cudaWasm","correct":"import { cudaWasm } from 'cuda-wasm'"},{"note":"Subpath export: use '/transpile' for the transpiler function.","wrong":"import { transpileCUDA } from 'cuda-wasm'","symbol":"transpileCUDA","correct":"import { transpileCUDA } from 'cuda-wasm/transpile'"},{"note":"Runtime execution is in '/runtime' subpath.","wrong":"import { runKernel } from 'cuda-wasm'","symbol":"runKernel","correct":"import { runKernel } from 'cuda-wasm/runtime'"},{"note":"Neural network module is at '/neural'.","wrong":"import { NeuralNetwork } from 'cuda-wasm/neural-network'","symbol":"NeuralNetwork","correct":"import { NeuralNetwork } from 'cuda-wasm/neural'"}],"quickstart":{"code":"import { transpileCUDA } from 'cuda-wasm/transpile';\nimport { runKernel } from 'cuda-wasm/runtime';\n\nconst cudaCode = `\n__global__ void vectorAdd(const float* A, const float* B, float* C, int N) {\n  int i = threadIdx.x + blockIdx.x * blockDim.x;\n  if (i < N) C[i] = A[i] + B[i];\n}\n`;\n\nasync function main() {\n  const wasmModule = await transpileCUDA(cudaCode);\n  const result = await runKernel(wasmModule, 'vectorAdd', {\n    args: [new Float32Array([1,2,3]), new Float32Array([4,5,6]), new Float32Array(3), 3],\n    grid: [1, 1, 1],\n    block: [3, 1, 1]\n  });\n  console.log(result); // Float32Array [5, 7, 9]\n}\nmain();","lang":"typescript","description":"Transpile a CUDA kernel and run it on WebGPU, demonstrating vector addition."},"warnings":[{"fix":"Use transpileCUDA and runKernel for kernels; do not expect CUDA runtime functions.","message":"CUDA runtime API and driver API are NOT supported. Only kernel execution is transpiled.","severity":"breaking","affected_versions":"all"},{"fix":"Consult the documentation for supported features; avoid dynamic parallelism and PTX.","message":"Not all CUDA features are implemented. See compatibility table.","severity":"breaking","affected_versions":"all"},{"fix":"Serve your app over HTTPS or use localhost; do not open HTML directly from filesystem.","message":"WebGPU requires HTTPS or localhost. Using file:// or non-secure origins will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Use cuda-wasm directly; no need for additional packages.","message":"The separate @cuda-wasm/web package is deprecated and merged into main package.","severity":"deprecated","affected_versions":"<=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use a browser with WebGPU enabled (Chrome 113+, Edge 113+, Firefox Nightly).","cause":"Browser lacks WebGPU support (e.g., Safari, older Chrome).","error":"TypeError: WebGPU not supported in this browser"},{"fix":"Rewrite kernel to avoid runtime API; allocate memory outside and pass as args.","cause":"Using CUDA runtime API calls (e.g., cudaMalloc) in the transpiled code.","error":"Error: CUDA_RUNTIME_API_NOT_SUPPORTED"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}