Project 1 - Flocking
- Your Name: Yi Liu
- Tested on: Windows 11, Intel i9-12900K @ 3.20GHz 32GB, NVIDIA RTX 4090 24GB (Moore 100 Lab)
In this project, I implemented a GPU-based simulation of flocking behavior using CUDA. The simulation demonstrates how boids (bird-like objects) follow three basic rules:
- Separation: Boids avoid getting too close to their neighbors.
- Alignment: Boids generally try to move with the same direction and speed as their neighbors.
- Cohesion: Boids move towards the perceived center of mass of their neighbors.
- CUDA-based parallel computation: The simulation leverages the GPU to process thousands of boids in parallel.
- Uniform Grid Optimization: Implemented a uniform grid to partition space, reducing the number of interactions each boid must check, thereby improving performance.
- Real-time visualization: Utilized OpenGL to visualize boid movement in real-time, allowing interactive exploration of flocking behavior.
The naive approach calculates interactions between all pairs of boids, leading to a computational complexity of O(n^2).
This method uses a uniform grid to partition space and limit boid interactions to neighboring grid cells, improving efficiency.
Optimized memory access by sorting boids based on their grid cells, enhancing data locality and overall performance.
Caption: 50,000 Boids Flocking using the Coherent Grid Approach