Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emmanuelmess/collisionbasedgassimulator
Leveraging GPU with OpenCL to run a particle simulator
https://github.com/emmanuelmess/collisionbasedgassimulator
c gpu opencl
Last synced: about 4 hours ago
JSON representation
Leveraging GPU with OpenCL to run a particle simulator
- Host: GitHub
- URL: https://github.com/emmanuelmess/collisionbasedgassimulator
- Owner: EmmanuelMess
- Created: 2024-10-11T22:07:11.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2024-10-25T02:59:13.000Z (21 days ago)
- Last Synced: 2024-10-25T15:56:02.163Z (21 days ago)
- Topics: c, gpu, opencl
- Language: C
- Homepage:
- Size: 56.5 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# First-collision timestep gas simulator with OpenCL
This simulator computes all possible intersections, then checks which of those possible intersections is soonest to
occur, and does some checks, the simulator then runs for time for enough time for the collision to occur. Once the
intersection occurs, the whole process runs again.The idea is that GPUs allow this to go very fast, by computing a lot of data in parallel (all segments and
intersections), this method of simulation is very precise as intersections are computed analytically, not
in steps.## Architecture
The general arch is in [architecture.md](architecture.md).
# Gallery
# Compilation and running
First compile with:
```bash
cd code
./generate_kernels.sh
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -G Ninja -S ./ -B ./cmake-build-debug
cmake --build ./cmake-build-debug --target CollisionBasedGasSimulator -j 3
```Then run with:
```bash
./cmake-build-debug/CollisionBasedGasSimulator
```# Some refrences and thanks
* [Colliding balls](https://garethrees.org/2009/02/17/physics/): An explanation for the basic idea, but without much implementation info.
* [raylib](https://www.raylib.com/): All the drawing, and window management is done with raylib.
* [First-collision timestep gas simulator with CUDA](https://github.com/EmmanuelMess/FirstCollisionTimestepRarefiedGasSimulator): My old implementation of this same algorithm for CUDA
----