Enhancing Performance through Parallelization in Conways Game of Life
In this project, the goal is to improve the performance of Conway's Game of Life through parallelization using pthreads and implementing various optimizations. The project involves optimizing code, utilizing cache optimizations, implementing locks/synchronization, improving cell representation, eliminating redundancy, and using compiler flags to further boost efficiency in the simulation. Check out the provided images showcasing key components and interesting patterns within the game.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Conways Game of Life Simple 2D universe with simple rules, complex results! 1. Any live cell with fewer than two live neighbors dies 2. Any live cell with more than three live neighbors dies 3. Any live cell with two or three live neighbors lives on 4. Any dead cell with three live neighbors becomes alive 2
Interesting Stable Patterns Glider LightWeight Space Ship Pulsar 3
Typical Random Initial Universe DEMO DEMO NOTE: board wraps around (top/bottom, L/R) 5
Key Part of the Code: for (curgen = 0; curgen < gens_max; curgen++) for (i = 0; i < nrows; i++){ for (j = 0; j < ncols; j++){ int inorth = mod (i-1, nrows); int isouth = mod (i+1, nrows); int jwest = mod (j-1, ncols); int jeast = mod (j+1, ncols); const char neighbor_count = BOARD (inboard, inorth, jwest) + BOARD (inboard, inorth, j) + BOARD (inboard, inorth, jeast) + BOARD (inboard, i, jwest) + BOARD (inboard, i, jeast) + BOARD (inboard, isouth, jwest) + BOARD (inboard, isouth, j) + BOARD (inboard, isouth, jeast); BOARD(outboard, i, j) = alivep (neighbor_count, BOARD (inboard, i, j)); } } SWAP_BOARDS( outboard, inboard ); } 6
HW5: Your Goal Improve performance via parallelization use pthreads use at least 2 threads (probably 4 since 4 CPUs on UG*) Further improve performance via other optimizations by putting what we learnt all together hand code optimizations cache optimizations locks/synchronization better cell representation eliminating redundancy and/or unnecessary work compiler flags 7