Accelerating Simulation

73 views
Skip to first unread message

david yu

unread,
Nov 13, 2025, 7:50:32 AMNov 13
to basilisk-fr
Hello,

I am an undergraduate student working on a simulation of two colliding vortex rings, based on the Basilisk code found here:

https://basilisk.fr/sandbox/Antoonvh/two_rings.c

In my initial tests on a personal laptop, I used a reduced scale (200 particles and a maximum grid refinement level of 8) to match the computational resources available. Even with these settings, the simulation required approximately five hours to complete. This is significantly longer than the runtime for the demonstration video, which used a higher resolution (10^5 particles, maxlevel 11).

My goal is to run this simulation more efficiently. I now have access to my university's GPU cluster and would like guidance on how to leverage this resource.

Could you please advise on the best way to accelerate this code? Specifically:

GPU Acceleration: Is it possible to adapt this specific simulation (which uses an octree grid) for GPU computation? If so, what would be the recommended approach?

Parallel Computing: Would standard CPU-based parallelization (e.g., OpenMP) be a more straightforward path for performance gains with this code?

Simplifications: Are there other optimizations or simplifications I could implement to reduce the computational cost without sacrificing the core physics?

Any advice or pointers to relevant documentation would be greatly appreciated.

Thank you for your time and assistance.

j.a.v...@gmail.com

unread,
Nov 13, 2025, 9:26:13 AMNov 13
to basilisk-fr
Hallo David, 

There are a few general tips regarding speed performance:

* Does the multigrid solver converge quickly? (check if mgp.i, mgpf.i are low number).
* Does the adaptive mesh seem reasonable? (check for unexpected regions of high-resolution areas) 
* Do a speed profiling of your code, to check if the time is being spend on relevant routines. 
* Consider using openMP or MPI, or GPU (not on trees) for computations. 

I believe points 1 and 2 are OK for this setup. But for 3, you will likely find that the rendering process is expensive, this may not improve much with parallelization.  
Are you using the tinyrenderer? Its implementation is not verywell optimized for speed (I know point rendering is implemented in a naive way), you have better luck using a more optimized external openGL library. This is how the original movie was made. I remember (vaguely) that adding 10^5 particles did not affect performance much. 


Antoon
Op donderdag 13 november 2025 om 13:50:32 UTC+1 schreef david20...@gmail.com:
Reply all
Reply to author
Forward
0 new messages