Projects

Game of Life

C++
CUDA
GPU
Google Collab

March 2024

Game of life screenshot

Description

The “Game of Life” project, implemented in C++, began with a CPU-based simulation of Conway’s Game of Life, where cells can be alive (1) or dead (0). After this, we optimized this simulation for NVIDIA GPUs using CUDA kernels, achieving a remarkable speedup of x927. This optimization involved meticulous selection of grid sizes and block sizes to maximize GPU performance.

The program initializes a grid with predefined initial configurations, visually displaying live cells as ‘X’ and dead cells as ’.‘. Originally executed on the CPU, the simulation iterated through each cell, computed live neighbors with a toroidal wrapping approach, and applied rules governing cell survival, death, and birth based on neighboring cell counts.

By transitioning to CUDA, we harnessed the parallel processing capabilities of NVIDIA GPUs, demonstrating substantial efficiency gains compared to traditional CPU-based methods.

Technology used

  • C++
  • CUDA
  • Google Collab