Changes

Jump to: navigation, search

DPS921 Team Optimize

3 bytes removed, 18:23, 28 November 2016
The Game of Life
* Cellular - the class which defines the cell. It keeps track of the generation, pointer to a world class which defines the dimensions in which the cell exists and a pointer to the rule class which governs the change in the cell on every generation.
[[File:cellular_class.png|600px|thumb|centernone|alt| Cellular Class ]]
* World - the class which defines the world, the environment for the cell in which the cell undergoes evolution. The class contains the dimensions for the 2D dimensional matrix where the cell is positioned. [[File:world_class.png|600px|thumb|centernone|alt| World Class ]]
* Rule - the class which defines the rule which govern the evolution in every generation. It contains pointers to two world object, the current and the next computed one.
[[File:rule_class.png|600px|thumb|centernone|alt| Rule Class ]]
==== Serial Hot Spot ====
The serial implementation basically applies the rule to every cell in the 2D dimensional matrix, and computes another world determining the position of every cell using the number of neighbours surrounding it. The following loop takes the maximum amount of computation time in determining the position of the cells in the next generation. This will be parallelized in the coming sections.
[[File:serial_hotspot.png|600px|thumb|centernone|alt| Apply Rules Class ]]
==== Results ====
The following diagram shows the serial implementation of The Game of Life, running in a 500x500 matrix. Every generation indicates a generation along with the number of live cells. Generation 1 has been hard coded with a fixed amount of live cells to initiate the process and then the rule class determines the number of live cells in coming generations.
[[File:serial_500x500.png|600px|thumb|centernone|alt| Serial 500x500 ]]
==== Code ====
The following code parallelizes the nested loop using, '''cilk_for'''
[[File:cilk_for.png|600px |thumb| none |alt=| cilk_for.]]
==== Results ====
91
edits

Navigation menu