Giter Club home page Giter Club logo

conways-game's Introduction

Conway's Game of Life

This repo contains a few implementations of Conway's Game of Life. I mainly wrote these as a learning exercise in grid parallelization and Julia. They are probably not written particularly well but served their purpose. Some interesting results are:

  • Parallelizing Python by starting every grid point on a new thread made it several orders of magnitude slower, if I added a sleep to the points' calculation function it was faster, so this could be useful for grids with very complex calculations.
  • Splitting the grid sub grids with one sub grid for each CPU thread worked moderately well yielding a 6 times speed increase with 16 threads for an n=1280 grid (I would guess that this is because of the dispatch being slower than the actual grid computation)
  • Rewriting in Julia was very easy and yielded a 20 times speed increase over the single threaded version
  • Parallelization was then very easy again as you just have to add Threads.@threads before the for in a for loop and then run it with julia --threads n for n threads. This yielded a 3 times speed increase over the serial Julia version (again presumably because the grid is actually very simple)

An example grid: Example grid (looks kind of like CMB)

The quotes speed increases are from runs with n=1280, 10 time steps and 16 threads for parallel versions. The results are in the table below:

Name Time/s Increase
Python Serial 13.1±0.2 1
Python Parallel 2.33±0.08 5.62
Julia Serial 0.67±0.1 19.6
Julia Parallel 0.22±0.08 59.5

conways-game's People

Contributors

jagoosw avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.