Pog3k / Metaballs

Pygame Metaballs speedup with numpy and cupy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metaballs

This project shows a pygame application > metaballs < which has been optimized with numpy and cupy.

  1. metaballs.py -> pure python/pygame implementation
  2. metaballs_numpy.py -> speedup with numpy
  3. metaballs_cupy.py -> speedup with cupy ( Nvidia CUDA )

On my PC with an intel I5-6600k @ 3.5Ghz & NVIDIA GeForce GTX 1060 6GB

variant fps
pure python ~0.6
numpy ~17
cupy ~111

 

metaballs.py metaballs_numpy.py metaballs_cupy.py

How to run

This project has been tested with Python 3.8.3.
Make sure you have pygame, numpy, and cupy installed on your python interpreter.
For cupy it is mandatory that you have the nvidia toolkit in the exact same version installed.
See https://docs.cupy.dev/en/stable/install.html.

Install necessary python packages with pip if you don't have them installed yet:

pip install -r requirements.txt

Run:

python metaballs.py
python metaballs_numpy.py
python metaballs_cuda.py

About

Pygame Metaballs speedup with numpy and cupy

License:MIT License


Languages

Language:Python 100.0%