williamgilpin / cphy

Class materials for computational physics course

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Taichi (instead of numba and jax) to write real-time simulations in Python?

neozhaoliang opened this issue · comments

@williamgilpin Hi, thank you very much for posting your course materials on GitHub, the topics covered in this course are really interesting.

I see there are quite a few animations in this repo, like GOL, Karman vortex, Gray-Scott model, etc. These models are too compute-intensive for Python to animate in real-time, and on the course homepage, you suggested using Numba and Jxx to accelerate. I would suggest using Taichi as a more suitable option since Taichi's JIT can compile your Python code and execute it on multi-CPU cores and GPUs. See this doc for an introduction.

And there are lots more physical simulations done by the Taichi community:
https://github.com/taichi-dev/awesome-taichi

Hope this information could help you better enjoy the visualizations.

Best.

Hi, thanks very much for checking out the course materials! I have always wanted to try Taichi, it looks like an incredible library. I'll look into playing around with it, especially in some more advanced materials later in the course.

Great! I sent you some quick examples via email, hope that can help save your effort to download those examples. 😃

Perfect! I haven't gotten the email yet, so if you don't hear from me please let me know so I can make sure it hasn't gotten lost

I should add that I'm very open to PRs modifying the course materials. Right now I'm trying to keep the "core" materials in numpy to make it easier for students new to Python. But Taichi would be perfect to incorporate into a lab, or an "advanced topic" at the end of existing lectures/notebooks

I haven't gotten the email yet, ...

Sorry, I probably didn't send the email address correctly, so here is the code attached to the email:

taichi-examples.zip.

Simply install Taichi via pip install taichi and then run the examples. Each script is a single animation.

Right now I'm trying to keep the "core" materials in NumPy to make it easier for students new to Python.

Fully agree. Taichi might be a bit advanced for starters in Python and NumPy.

But Taichi would be perfect to incorporate into a lab or an "advanced topic" at the end of existing lectures/notebooks.

Yep! If you have any questions about using Taichi or anything that I can help with, feel free to pull issues or contact me.