Published
Edited
Feb 11, 2020
Importers
1 star
Insert cell
md`# GPU-Matrix-Compute`
Insert cell
md`
## Reference
- [Get started with GPU Compute on the Web](https://developers.google.com/web/updates/2019/08/get-started-with-gpu-compute-on-the-web)

- Dogfood🐾: WebGPU is available for now in Chrome 78 for macOS behind an experimental flag. You can enable it at chrome://flags/#enable-unsafe-webgpu.

- If console.log inform you gpu not find, you may Should use this version to get visit on navigator.gpu [Google Chrome Canary]https://github.com/yyc-git/MyData/blob/master/3d/googlechrome(canary).dmg

- [WebGPU Official Doc](https://gpuweb.github.io/gpuweb/#enumdef-gpubindingtype) link will guide you know about GPUBindingType, explain why we use storage-buffer instead of readonly-storage-buffer although doc says the two both fine to use but actually readonly-storage-buffer not work.`
Insert cell
md`## Usage
- Note that matrix convert to a Linear array as parameters,and first two means how many rows and columns.`
Insert cell
firstMatrix = new Float32Array([
3 /* rows */,
3 /* columns */,
1,
2,
3,
4,
5,
6,
7,
8,
9
])
Insert cell
secondMatrix = new Float32Array([
3 /* rows */,
3 /* columns */,
1,
0,
0,
0,
1,
0,
0,
0,
1
])
Insert cell
gpuMatrixCompute(firstMatrix, secondMatrix)
Insert cell
md`## Code
There are much code and have detail comment`
Insert cell
Insert cell
md`## Imports`
Insert cell
adapter = navigator.gpu.requestAdapter()
Insert cell
device = adapter.requestDevice()
Insert cell
glslangModule = import('https://unpkg.com/@webgpu/glslang@0.0.13/dist/web-devel/glslang.js')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more