wgmath is a set of Rust libraries exposing re-usable WebGPU shaders for scientific computing including:
- The wgcore crate, a centerpiece of the wgmath ecosystem, exposes a set of proc-macros to facilitate sharing and composing shaders across Rust libraries.
- Linear algebra with the wgebra crate.
- AI (Large Language Models) with the wgml crate.
- Collision-detection with the wgparry2d and wgparry3d crates.
- Rigid-body physics with the wgrapier2d and wgrapier3d crates.
By targeting WebGPU, these libraries run on most GPUs, including on mobile and on the web. It aims to promote open and cross-platform GPU computing for scientific applications, a field currently strongly dominated by proprietary solutions (like CUDA).
When running on the Web, best results are achieved with chrome-based browsers (including Edge).
Note that:
- We found WebGPU to be 10x slower on linux (tested on Ubuntu) compared to Windows or MacOS.
- We found Firefox (nightly) to be 10x slower than Chrome on all platforms (including MacOS/Windows).
- Keep in mind that some browsers don’t have WebGPU enabled by default and/or has an experimental WebGPU implementation (like safari) that might not work.
See the readme of each individual crate (on the crates directory) for additional details.