Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory...
-
Upload
kevin-clark -
Category
Documents
-
view
212 -
download
0
Transcript of Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory...
![Page 1: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/1.jpg)
The Game Of LifeOhad ShitritAlon Gavra
Group - 1
BGUParallel Programming
2014
![Page 2: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/2.jpg)
Introduction
Computational Challenges
Serial Solutions
Distributed Memory Solution
Shared Memory Solution
Parallel Analysis
Conclusion
Introduction:Game of Life is a cellular automata exercise created by mathematician John H. Conway in 1970.
It's not really a game in the traditional sense since the outcome is decided solely by the initial set up and there aren't any players.
The game made Conway instantly famous, but it also opened up a whole new field of mathematical research, the field of cellular automata
Lets play…
![Page 3: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/3.jpg)
Introduction
Computational Challenges
Serial Solutions
Distributed Memory Solution
Shared Memory Solution
Parallel Analysis
Conclusion
The game rules:Any live cell with fewer than two live neighbours dies, as if caused by under-population.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overcrowding.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
![Page 4: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/4.jpg)
Introduction
Computational Challenges
Serial Solutions
Distributed Memory Solution
Shared Memory Solution
Parallel Analysis
Conclusion
Computational Challenges:The game board size is NxM=L
Each cell has to be evaluated according to the set of rules
A round or “generation” takes O(L) just to evaluate.
This is an embarrassingly parallel problem
Pseudo Code for Game of Life:
Bottleneck!
![Page 5: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/5.jpg)
Introduction
Computational Challenges
Serial Solutions
Distributed Memory Solution
Shared Memory Solution
Parallel Analysis
Conclusion
Serial Solutions:The serial solution is straight forward.
Unfortunately, when we simulate multiple generations with large boards this become a time consuming problem.
Each cell has to be individually evaluated by it’s nearby neighbours So it becomes clear why we should turn to parallel solutions.
![Page 6: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/6.jpg)
Introduction
Computational Challenges
Serial Solutions
Distributed Memory Solution
Shared Memory Solution
Parallel Analysis
Conclusion
Distributed Memory:Game of life takes place on a N x M grid
Distribute the grid on z processors (domain decomposition)
Simplest way: row wise or column wise More general approach: rectangular areas (checkerboard partitioning)
![Page 7: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/7.jpg)
Introduction
Computational Challenges
Serial Solutions
Distributed Memory Solution
Shared Memory Solution
Parallel Analysis
Conclusion
Distributed Memory:Initial (master) grid is in process 0
Parts must get distributed to the other processes
![Page 8: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/8.jpg)
Introduction
Computational Challenges
Serial Solutions
Distributed Memory Solution
Shared Memory Solution
Parallel Analysis
Conclusion
Distributed Memory:Ghost cell:
For updating the cells, we need all the neighbours of all the
Cells
“ghost cells” around each block are necessary
This mean that cells are not continuous in memory, neither
in the master nor in the worker grid
![Page 9: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/9.jpg)
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Shared Memory Solutions:For shared memory threads, this is almost a trivial exercise
Using a domain decomposition, put an OpenMP for pragma around one of the inner loops
Here!
![Page 10: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/10.jpg)
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Parallel Analysis:Amdahl’s law – strong scaling
* Parallelization: Conway’s Game of Life By Aaron Weeden , Shodor Education Foundation, Inc.
![Page 11: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/11.jpg)
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Parallel Analysis:
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Parallel Analysis:
* Parallelization: Conway’s Game of Life By Aaron Weeden , Shodor Education Foundation, Inc.
Gustafson’s Law– weak scaling
![Page 12: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/12.jpg)
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Parallel Analysis:
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Parallel Analysis:
Based on an article by Jon Skeet: https://msmvps.com/blogs/jon_skeet/archive/2008/06/01/more-parallelisation-fun-conway-s-game-of-life.aspx
Speed Up:In an article we came across, the author examined 5 different programs, from the simplest serial to the sophisticated parallel program.
Using the Shared memory approach he managed to achieve a speedup of 127 times the serial program.
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Parallel Analysis:
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Parallel Analysis:
Based on an article by Jon Skeet: https://msmvps.com/blogs/jon_skeet/archive/2008/06/01/more-parallelisation-fun-conway-s-game-of-life.aspx
Speed Up:In an article we came across, the author examined 5 different programs, from the simplest serial to the sophisticated parallel program.
Using the Shared memory approach he managed to achieve a speedup of 127 times the serial program.
![Page 13: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/13.jpg)
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Conclusion:
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Game of Life is the basis of much research in the field of cellular automata. As a result learning how to use parallel programming to solve the is problem has great potential in related fields of interest.
As we’ve seen the parallel solutions are easy to implement and provide improved performance.
So why not?
![Page 14: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/14.jpg)
Questions?
![Page 15: Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction:](https://reader038.fdocuments.in/reader038/viewer/2022110400/56649dbd5503460f94ab0b52/html5/thumbnails/15.jpg)
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
References:
Introduction Serial Solutions Shared Memory SolutionParallel Analysis
Conclusion
Jon Skeethttps://msmvps.com/blogs/jon_skeet/archive/2008/06/01/more-parallelisation-fun-conway-s-game-of-life.aspx
Dr. Dobbshttp://www.drdobbs.com/parallel/conways-game-of-life-in-parallel/240143844 http://www.drdobbs.com/parallel/game-of-life-with-mpi/240159390
Parallelization: Conway’s Game of Life By Aaron Weeden, Shodor Education Foundation,Inc.
Introduction to Parallel Programming with MPI, Hans Joachim Pflug, AACHEN UNIV.