https://github.com/quansight-labs/array-api-gpu-demo
Array API GPU Demo
https://github.com/quansight-labs/array-api-gpu-demo
Last synced: 7 months ago
JSON representation
Array API GPU Demo
- Host: GitHub
- URL: https://github.com/quansight-labs/array-api-gpu-demo
- Owner: Quansight-Labs
- Created: 2021-12-06T10:30:52.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-01T06:40:48.000Z (over 3 years ago)
- Last Synced: 2025-01-19T19:56:06.069Z (9 months ago)
- Language: Jupyter Notebook
- Homepage:
- Size: 880 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Demo: Segmentation on CPU and GPU
This is a demonstration of the performance benefits of using SciPy, scikit-learn
and scikit-image on GPUs (AMD or NVIDIA) using Array API.The changes to SciPy, scikit-learn, scikit-image and CuPy can be seen here:
- [CuPy](https://github.com/cupy/cupy/compare/master...aktech:array-api-gpu-demo?expand=1)
- [SciPy](https://github.com/scipy/scipy/compare/main...aktech:array-api-gpu-demo?expand=1)
- [scikit-learn](https://github.com/scikit-learn/scikit-learn/compare/main...aktech:array-api-gpu-demo?expand=1)
- [scikit-image](https://github.com/scikit-image/scikit-image/compare/main...aktech:array-api-gpu-demo?expand=1)## Running the demo
First login to Docker Registry
```bash
export CR_PAT=YOUR_PERSONAL_ACCESS_TOKEN_FOR_GITHUB
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin```
### On NVIDIA GPU
```
docker run --gpus all -it -p 8788:8788 ghcr.io/quansight-labs/array-api-gpu-demo-cuda:latest bash
```and then run jupyterlab inside the container:
```
jupyter lab --ip=0.0.0.0 --port=8788 --allow-root
```### On AMD GPU
```
docker run -it --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video ghcr.io/quansight-labs/array-api-gpu-demo-rocm:latest bash
```and then run jupyterlab inside the container:
```
jupyter lab --ip=0.0.0.0 --port=8788 --allow-root
```Now run the `plot_coin_segmentation.ipynb` notebook.
### Running Segmentation Performance script
Get into the docker container for either of the above mentioned GPU platform
and run the following script:```
python segmentation_performance.py
```This will run the segmentation for various proportions of the greek coins
image for cupy and numpy array, i.e. on CPU and GPU.This will also create a plot of the performance comparison between numpy and cupy,
which would look something like:#### On NVIDIA GPU
#### On AMD GPU
