Hw5 parallelization
Download
1 / 7

HW5: Parallelization - PowerPoint PPT Presentation


  • 85 Views
  • Uploaded on

HW5: Parallelization. Conway’s 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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' HW5: Parallelization' - byron


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Conway s game of life
Conway’s 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


Interesting stable patterns
Interesting Stable Patterns

Glider

LightWeight

Space Ship

Pulsar



Typical random initial universe
Typical Random Initial Universe

DEMO

NOTE: board wraps around (top/bottom, L/R)


Key part of the code
Key Part of the Code:

  • for (curgen = 0; curgen < gens_max; curgen++)

  • for (i = 0; i < nrows; i++){

  • for (j = 0; j < ncols; j++){

  • intinorth = mod (i-1, nrows); intisouth = mod (i+1, nrows);

  • intjwest = mod (j-1, ncols); intjeast = 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 );

  • }


Hw5 your goal
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


ad