A CUDA-enabled version of Conway’s Game of Life written in C++.
- Pause and un-pause the simulation
- Click on cells to toggle their state
- Pan the grid
- Zoom in and out
- Clear the existing grid
- Randomize the existing grid
- Display current UPS/FPS
- Pre-built test cases
- Stretch Goal: Control the speed of the simulation
- Stretch Goal: Deploy “templates” of commonly-known entities in the Game of Life, e.g. gliders
The makefile is in src/GPU-Game-of-Life/
make CPU=1
to compile for the CPU; make CPU=0
or just make
to compile for the GPU
The project depends on SFML 2.5.1.
Edit SFML_root
in the makefile to point to wherever you place the compiled files.
You may also need to update cclibraries
, gpp
, and cudaroot
if compiling on a system other than Linux.
./life blockWidth blockHeight gridWidth gridHeight [numPasses] [p] [t<1|2>]
Parameters:
blockWidth
,blockHeight
,gridWidth
, andgridHeight
must be positive integers.- Non-square grids will be stretched to fit the window if using the GUI.
blockWidth
andblockHeight
will be ignored if running on the CPU.- If
numPasses
(a positive integer) is given, the GUI will be disabled. Instead, a starting grid will be generated and the program will execute exactlynumPasses
updates (or kernel calls). Note: Timings are averaged by ignoring the first iteration since it is abnormally slow on the GPU. - If
p
is given andnumPasses
is given, the program will print the grid after each iteration. - If
t#
is given, the program will no longer start with a random grid. Instead, it will contain a pre-defined test setup. This can be used to verify CPU / GPU correctness. The grid may be expanded automatically beyond the given arguments if it is too small.- t1: The grid will contain a light-weight space ship that should move horizontally across the grid.
- t2: The grid will contain a Gosper glider gun.