Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 1: ADITHYA RAJEEV #33

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 41 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
**University of Pennsylvania, CIS 5650: GPU Programming and Architecture,
Project 1 - Flocking**
Project 1 Flocking
====================

* (TODO) YOUR NAME HERE
* (TODO) [LinkedIn](), [personal website](), [twitter](), etc.
* Tested on: (TODO) Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)
**University of Pennsylvania, CIS 5650: GPU Programming and Architecture, Project 0**

### (TODO: Your README)
* ADITHYA RAJEEV
* [LinkedIn](https://www.linkedin.com/in/adithyar262/)
* Tested on: Windows 11, i7 13th Gen @ 2.40GHz 16GB, GeForce RTX 4050 8GB (Personal)

Include screenshots, analysis, etc. (Remember, this is public, so don't put
anything here that you don't want to share with the world.)
# Boid Simulation

![](images/Flocking_GIF.gif)

# Performance Analysis

## 1. FPS vs No. of Boids

![](images/Boid_FPS_Table.png)

![](images/Boid_FPS_Plot.png)

## 2. FPS vs Block Size

![](images/Block_Size_FPS_Table.png)

![](images/Block_Size_FPS_Plot.png)

# Questions

## 1. For each implementation, how does changing the number of boids affect performance? Why do you think this is?
The increase in the number of boids leads to a decrease in frames per second (FPS). The inverse relationship between the number of boids and FPS is a natural consequence of the increased computational load and resource requirements as the simulation scales up. This effect is observed across both naive and optimized implementations, although optimized versions may scale better with increasing boid counts.

## 2. For each implementation, how does changing the block count and block size affect performance? Why do you think this is?
Changing the block size and number of blocks does not significantly affect the FPS (Frames Per Second) in the boids simulation. Changing the block size and number of blocks is more about optimizing how the work is distributed on the GPU rather than changing the fundamental amount or speed of parallel operations being performed. As a result, these changes typically don't lead to significant variations in FPS for the boids simulation.

## 3. For the coherent uniform grid: did you experience any performance improvements with the more coherent uniform grid? Was this the outcome you expected? Why or why not?
The coherent uniform grid implementation demonstrated a significant performance improvement over the scattered grid approach. In the coherent grid method, we eliminate the need for an additional matrix to redirect to the position and velocity array indices for boids. This removal of indirection means one less memory lookup operation (or warp) to complete for each data access. By directly accessing the boid data, we reduce the overall number of memory operations, leading to faster execution times. The coherent grid approach also organizes boid data in a way that results in more contiguous and sequential memory accesses when retrieving position and velocity information.
The combination of reduced indirection and more coherent memory access patterns results in more efficient use of the GPU's memory subsystem. This leads to reduced latency, increased throughput, and ultimately, the observed performance improvement in the coherent uniform grid implementation.

## 4. Did changing cell width and checking 27 vs 8 neighboring cells affect performance? Why or why not? Be careful: it is insufficient (and possibly incorrect) to say that 27-cell is slower simply because there are more cells to check!
Changing the number of neighboring cells checked to 27 (3x3x3 grid) improves performance in the boid simulation. This quantization of the search space leads to checking smaller volumes around each boid, often resulting in fewer overall boid comparisons. The more compact search area enhances spatial locality and cache usage, leading to more efficient memory access patterns. Despite checking more cells, the total volume searched is smaller, reducing computational overhead. This demonstrates that a finer-grained approach to neighbor searching can yield significant performance benefits by decreasing workload and enhancing memory efficiency.



Binary file added images/Block_Size_FPS_Plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Block_Size_FPS_Table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Boid_FPS_Plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Boid_FPS_Table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Flocking_GIF.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Flocking_Video.mp4
Binary file not shown.
Loading