← Back to projects

Genetic algorithms in C and CUDA

A series of reference genetic algorithm implementations in C and CUDA, from 'hello world' to the Robby problem.

About

Evolutionary computation is the subject that took me back to university and that I still study on my own. Over the years I’ve published the reference implementations I wrote to study with, almost all in plain C with a CUDA counterpart.

The idea is that each repository stays small enough to read end to end, and that the C/CUDA pairing makes it obvious what actually changes when the same algorithm moves onto the GPU.

What’s there

  • simpleHelloGA and cuHelloGA — the smallest useful genetic algorithm, in C and in CUDA, a good starting point for study
  • robbyga and cuRobby — the Robby problem, the can-collecting robot from Melanie Mitchell’s Complexity: A Guided Tour
  • mastermindGA — solving Mastermind with a GA
  • cga and cuCGA — cellular automata, the subject of my master’s
  • cuda_snippets — short CUDA snippets
  • cuAutotools — an Autotools template for CUDA projects on Linux, because setting that up from scratch every time is tedious