A high-performance astronomical simulation capable of simulating over 1 million bodies in real-time. This project leverages CUDA for GPU acceleration and OpenMP for multi-core CPU processing, implementing the efficient Barnes-Hut algorithm (O(n log n)) to handle massive scale interactions.
- Massive Scale: Simulates 1,000,000+ astronomical objects.
- Utilizes:
- Custom CUDA kernels for GPU parallelism.
- OpenMP for multi-threaded execution (CPU Parallelism).
- Barnes-Hut tree algorithm for efficient force calculation.
- Generates high-resolution video visualizations of the universe evolution.
- Built with C++20.
- CMake (3.10+)
- C++20 Compiler
- CUDA Toolkit (11.0+)
The project is organized into labs. lab_3 contains the final, most advanced implementation.
cd lab_3
mkdir build && cd build
cmake .. && make
# Run simulation with CUDA (Mode 4) for 1000 bodies
./source/lab --num-bodies 1000 --simulation-mode 40: Sequential (Baseline)1: Parallel CPU (OpenMP)2: Barnes-Hut (Tree-based)4: CUDA (GPU Accelerated)
The simulation outputs frame data which can be rendered into video:
# Inside the build directory after running a simulation
../create_mp4.shGenerates out.mp4 showing the universe evolution.