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: Yichen Shou #5

Open
wants to merge 6 commits into
base: master
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
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
**University of Pennsylvania, CIS 565: GPU Programming and Architecture,
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)
* Yichen Shou
* [LinkedIn](https://www.linkedin.com/in/yichen-shou-68023455/), [personal website](http://www.yichenshou.com/)
* Tested on: Windows 10, i7-6500U @ 2.50GHz 12GB RAM, GeForce 940M 8GB (Personal Laptop)

### (TODO: Your README)
## Project Overview
This project is a flocking simulation that implements the [Reynolds Boids algorithm](http://www.vergenet.net/~conrad/boids/pseudocode.html). CUDA is used to increase simulation efficiency. I tested three different performances and analyzed their performance.

Include screenshots, analysis, etc. (Remember, this is public, so don't put
anything here that you don't want to share with the world.)
![](images/Boids.gif)

## Performance Analysis
### Boids vs. Performance
![](images/boidNumber.PNG)
* Performance for the naive implementation decreases as expected as boid number increase, since there are simply more boids to check.
* Performance shows an interesting dip for both Scatter and Coherent grids as the number of simulated boids increase. Framerate drops past the 1000 boid mark, and doesn't come back up until past 9000. My theory is that in the middle range, there are a lot of individual boid groups, not close enough to form big groups but not small enough to be trivial, that end up slowing down the framerate.

### Blocks vs. Performance
![](images/blockNumber.PNG)

* Naive grids are not effected by block size as expected, since it always just checks every other boid.
* Scatter and Coherent grids actually suffer a framerate drop once block size is increased, which is a bit unexpected since increased block size usually increased performance. I suspect that this might have something to do with memory. One hypothesis is that the increased block size is causing more memory to be loaded than needed, thus wasting time to copying memory.

### Grids vs. Performance
* Coherent performs faster than Scatter, as expected due to the improved algorithm. Compared to the scatter grid, the coherent grid does a little more preprocessing (using a buffer array to reorder data), but yields a good chunk of performance increase especially at high boid numbers.
* Surprisingly, changing te cell width and checking 27 as opposed to 8 neighboring cells did not affect performance all that much. One would expect that as there are more cells to check, it would be slower, but the result was not so. My theory is that the process of checking boid distance turned out to be quite trivial, and it is actually calculating the rules' effects that take time. Thus simply checking with more boids does not affect the framerate too much.
Binary file added images/Boids.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/blockNumber.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/boidNumber.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 performanceAnalysis.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ set(SOURCE_FILES

cuda_add_library(src
${SOURCE_FILES}
OPTIONS -arch=sm_20
OPTIONS -arch=sm_50
)
Loading