Xiangyu-Hu / SPHinXsys

SPHinXsys provides C++ APIs for engineering simulation and optimization. It aims at complex systems driven by fluid, structure, multi-body dynamics and beyond. The multi-physics library is based on a unique and unified computational framework by which strong coupling has been achieved for all involved physics.
https://www.sphinxsys.org/
Apache License 2.0
259 stars 197 forks source link

[SYCL] Substitute system configuration with direct search #529

Closed nR3D closed 2 months ago

nR3D commented 2 months ago

Changes

SYCL code will now iterate over the entire list of particles contained within neighboring cells instead of relying on pre-computed kernel values coming from a configuration update step.

A new method forEachNeighbor has been added to CellLinkedListKernel, which replaces searchNeighborsByParticles and the need to update configuration variables. In fact, all variables and methods concerning configuration information for device code have been removed.

Benchmarks

A performance comparison between the old configuration-based execution and the new direct search version shows an improvement up to 6x for larger simulations.

Benchmark

More importantly, removing configuration variables significantly reduced GPU memory usage. For instance, 2 million particles required up to 12GiB of RAM on the old version, while it now only takes 900MiB, ultimately enabling larger simulation on the same graphic cards.

Xiangyu-Hu commented 2 months ago

Great! It is great to hear that direct search is actually much faster.