As a first step, I wrote a move generator using bit-boards (kogge-stone for sliding piece move generation).
I know perft speed is not a measure of chess engine strength and there are many other things that I should be doing before trying to optimize move generation but I got somewhat addicted and decided to try a GPU version.
Here is my move-generator/perft tool for GPUs:
https://github.com/ankan-ban/perft_gpu
The program will work only on Nvidia GK110 or later as it uses CUDA dynamic parallelism (currently GTX 780, GTX Titan, or more expensive server class K20/K20X GPUs).
Note that my code is optimized only for perft (e.g, bulk-counting at leaves, no separate generation of captures, etc) and probably would need complete re-write to be used in a chess engine.
Currently it doesn't make use of hash tables (probably the next thing I am going to try...). It's almost 100X faster than my 32 bit single-threaded CPU version running on a core i7 2600k.
Here are some runs on a GTX 780:
start position:
Code: Select all
GPU Perft 1: 20, Time taken: 2.16e-005 seconds, nps: 925925
GPU Perft 2: 400, Time taken: 0.000134368 seconds, nps: 2976899
GPU Perft 3: 8902, Time taken: 0.000221888 seconds, nps: 40119338
GPU Perft 4: 197281, Time taken: 0.000602656 seconds, nps: 327352582
GPU Perft 5: 4865609, Time taken: 0.00123642 seconds, nps: 3935252431
GPU Perft 6: 119060324, Time taken: 0.0105882 seconds, nps: 11244597713
GPU Perft 7: 3195901860, Time taken: 0.262085 seconds, nps: 12194124526
GPU Perft 8: 84998978956, Time taken: 7.13521 seconds, nps: 11912610760
GPU Perft 9: 2439530234167, Time taken: 199.261 seconds, nps: 12242907844
Code: Select all
GPU Perft 1: 48, Time taken: 2.1248e-005 seconds, nps: 2259036
GPU Perft 2: 2039, Time taken: 0.000131424 seconds, nps: 15514670
GPU Perft 3: 97862, Time taken: 0.00034736 seconds, nps: 281730781
GPU Perft 4: 4085603, Time taken: 0.00159635 seconds, nps: 2559337193
GPU Perft 5: 193690690, Time taken: 0.0090281 seconds, nps: 21454212020
GPU Perft 6: 8031647685, Time taken: 0.49178 seconds, nps: 16331775849
GPU Perft 7: 374190009323, Time taken: 18.8954 seconds, nps: 19803269462