Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 1.96 KB

README.md

File metadata and controls

30 lines (23 loc) · 1.96 KB

gpu.cpp examples

This directory contains examples of how to use gpu.cpp.

Each example is a standalone project that can be built and run independently by running make from within the example directory.

Before running any of these examples, make sure you've downloaded the Dawn native webgpu installation binary by running make dawnlib from the root directory of the repository.

Basic Examples

Example Description
hello_world Minimal example to get started with gpu.cpp, implements a GELU neural network activation function.
gpu_puzzles Implementation of Sasha Rush's GPU puzzles.
shadertui An example of runtime live reloading of WGSL - demonstrated using a terminal shadertoy-like scii rendering.
render GPU ascii rendering of a signed distance function for two rotating 3D spheres.
physics Parallel physics simulation of a double pendulum with each thread starting at a different initial condition.
web A minimal example of how to use gpu.cpp to build a WebAssembly module that runs in the browser. Before building this example, make sure you've installed the emscripten sdk by following the instructions here and run source emsdk_env.sh from the emsdk/ directory that was created when you cloned the emscripten repository.

Advanced Examples

Example Description
float16 Hello World example using the float16 WebGPU extension, instead of the default float32.
matmul Tiled matrix multiplication.
transpose Tiled matrix transpose.
webgpu_from_scratch A minimal from-scratch example of how to use WebGPU directly without this library. This is useful to understand the code internals of gpu.cpp. Note this takes a while to build as it compiles the WebGPU C API implementation.