|
1 |
| -# Examples (Work-in-Progress) |
| 1 | +# gpu.cpp examples |
2 | 2 |
|
3 |
| -Here are some standalone projects exemplifying how to use this library as well |
4 |
| -as what's under the hood. |
| 3 | +This directory contains examples of how to use gpu.cpp. |
5 | 4 |
|
6 |
| -Note some of these examples are still a work-in-progress and may not be fully |
7 |
| -functional. |
| 5 | +Each example is a standalone project that can be built and run independently by |
| 6 | +running `make` from within the example directory. |
8 | 7 |
|
9 |
| -In order of beginning to advanced: |
| 8 | +Before running any of these examples, make sure you've downloaded the Dawn |
| 9 | +native webgpu installation binary by running `make dawnlib` from the root |
| 10 | +directory of the repository. |
| 11 | + |
| 12 | +## Basic Examples |
10 | 13 |
|
11 | 14 | | Example | Description |
|
12 | 15 | |---------|-------------|
|
13 | 16 | | [hello_world](hello_world) | Minimal example to get started with gpu.cpp, implements a GELU neural network activation function. |
|
14 |
| -| [gpu_puzzles](gpu_puzzles) | (WIP) Implementation of Sasha Rush's GPU puzzles |
15 |
| -| [render](render) | GPU rendering of a signed distance function for a 3D sphere. | |
16 |
| -| [shadertui](shadertui) | A terminal UI taker on shadertoy demonstrating runtime live reloading of WGSL. | |
| 17 | +| [gpu_puzzles](gpu_puzzles) | Implementation of Sasha Rush's GPU puzzles. | |
| 18 | +| [shadertui](shadertui) | An example of runtime live reloading of WGSL - demonstrated using a terminal shadertoy-like scii rendering. | |
| 19 | +| [render](render) | GPU ascii rendering of a signed distance function for two rotating 3D spheres. | |
17 | 20 | | [physics](physics) | Parallel physics simulation of a double pendulum with each thread starting at a different initial condition. |
|
| 21 | +| [web](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](https://emscripten.org/docs/getting_started/downloads.html) and run `source emsdk_env.sh` from the `emsdk/` directory that was created when you cloned the emscripten repository. | |
| 22 | + |
| 23 | +## Advanced Examples |
| 24 | + |
| 25 | +| Example | Description | |
| 26 | +|---------|-------------| |
18 | 27 | | [matmul](matmul) | Tiled matrix multiplication. |
|
19 | 28 | | [transpose](transpose) | Tiled matrix transpose. |
|
20 | 29 | | [webgpu_from_scratch](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. |
|
0 commit comments