Skip to main content

OpenCL-accelerated cellular automata simulator

Project description


clcell is an OpenCL-accelerated cellular automata simulator for Python 3.


  • OpenCL-based hardware acceleration
  • Custom rulesets via clcell.RuleSet
  • Parallel simulations via clcell.CASimulator.batch_simulate


  • Only binary cell states
  • No support for infinite grids
  • Grid boundary cells must be unpopulated


Regardless of the installation method you choose, you will need OpenCL drivers for your hardware.

Using pip

$ pip install --user clcell

Building from Source


Clone this repository:

$ git clone

Enter the project directory:

$ cd clcell

Build and install this package:

$ make install


import numpy as np
import clcell

# Instantiate a simulator using Conway's Game of Life as the ruleset.
sim = clcell.CASimulator(clcell.LIFE)

# Create a randomized game state to use as a seed.
seed_state = np.random.randint(0, 2, (1023, 1023), dtype=np.int8)
# Pad state with zeros (required for now).
seed_state = np.pad(seed_state, 1, constant_values=0)

# Simulate 10,000 generations based on that seed.
final_state = sim.simulate(10000, seed_state)

# Create a batch of 1,000 randomized, padded game states to use as seeds.
seed_states = np.array([
    np.random.randint(0, 2, (127, 127), dtype=np.int8),
  for num
  in range(1000)

# Simulate 1,000 generations based on each of those seeds.
final_states = sim.batch_simulate(1000, seed_states)



  • Simplified how the device code checks for boundary cells.
  • Refactored device code to use grids of 8-bit cells as opposed to 32-bit.
  • Fixed incorrectly placed size annotations in one device function.


  • Initial release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for clcell, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size clcell-1.0.1-py3-none-any.whl (19.6 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page