-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e467e18
commit 796471c
Showing
1 changed file
with
9 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,18 @@ | ||
# NGSolve with Pyodide and WebGPU | ||
# WebGPU API for Python using Pyodide | ||
|
||
This repository contains an example setup for using NGSolve with Pyodide and WebGPU. Follow the instructions below to set up and run the project, either as a standalone HTML server or within a Jupyter Notebook. | ||
This repository contains a Python wrapper for the WebGPU API to be used in browser environments (for instance plain HTML or Jupyter Notebooks). | ||
|
||
You can test the hosted example here (takes a few seconds to init Pyodide): https://mhochsteger.github.io/webgpu_pyodide_experiments/ | ||
|
||
Note that you need a browser with webgpu support. | ||
An example jupyter notebook file is [here](example.ipynb), the executed html is available [here](https://cerbsim.github.io/webgpu/). | ||
|
||
## Setup | ||
|
||
To get started, download and extract the required NGSolve Pyodide package: | ||
To get started, just install the python package and run the jupyter notebook. | ||
|
||
```bash | ||
wget https://ngsolve.org/files/ngsolve_pyodide_0.26.2.tar.bz2 | ||
tar xvf ngsolve_pyodide_0.26.2.tar.bz2 | ||
python3 -m pip install -e . | ||
git clone https://github.com/cerbsim/webgpu | ||
cd webgpu | ||
python3 -m pip install . | ||
python3 -m jupyter notebook example.ipynb | ||
``` | ||
|
||
## Running the server | ||
|
||
Run `python dev.py` and open `http://localhost:8000/index.html`. Everytime you change some code, the website is automatically hot-reloaded (pyodide stays alive) and the `webgpu` package is reloaded and executed. | ||
For the hot-reload feature you need to have the python packages `websockets` and `watchdog` installed | ||
|
||
## Jupyter notebook | ||
|
||
``` | ||
jupyter notebook webgpu.ipynb | ||
``` | ||
Note that your browser needs WebGPU support, you can verify that by opening the [webgpureport](https://webgpureport.org) website. See [here](https://github.com/gpuweb/gpuweb/wiki/Implementation-Status) for more information about the current status and needed settings. |