Not logged inRybka Chess Community Forum
Up Topic The Rybka Lounge / Computer Chess / Chess Engine and GPU
- - By Fishpov (**) Date 2017-10-09 22:17
Why modern Chess Engines don't use GPU instructions for helping calculation like some video converter software or PhotoShop Filter or some Password cracker ... ?
Parent - By user923005 (****) Date 2017-10-09 22:35
There are some limitations with GPU cards.
While it is improving, GPU cards to not handle recursion well.  Chess programs are recursive by nature.
GPU cards are terrible when unpredicted branching happens.  Branching happens a lot in chess programs.
It is very slow to copy the data to and from GPU cards.

There are some experiments at using GPU cards for chess, but these programs are not as fast as a regular chess program.
Srdja Matovic's program tends to appear and disappear from github.  It's the strongest GPU based program that I know of.
There are several vapor-ware GPU chess programs out there.

On the other hand, GPU cards are used for the world's fastest move generator.
https://github.com/ankan-ban/perft_gpu
Parent - - By Labyrinth (*****) Date 2017-10-10 00:30
GPUs also tend to have large float performance, but little or non-existent integer performance. Making an engine that uses floats instead of integers is difficult.

It might work with a completely different approach, like maybe a fast GPU could be used for a machine learning program that works on pattern recognition. A single GPU might be far too slow to make a dent in the level of pattern recognition needed to play strong chess though. AlphaGo used a distributed system of 1920 CPUs and 280 GPUs..
Parent - - By user923005 (****) Date 2017-10-10 01:29
Latest GPUs do 32 bit integer and floating point at the same rate.
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#arithmetic-instructions__throughput-native-arithmetic-instructions

In order to do 64 bit operations, they have templates or types for that.

Banerjee's perft uses 64 bit integer arithmetic on the GPU and it is thousands of times faster than the fastest CPU based version.

Converting an integer based eval to floating point is trivial.
There is, however, uncertain reproducibility with floating point evaluation, which makes problems harder to debug.
Parent - - By Labyrinth (*****) Date 2017-10-10 15:53

>Converting an integer based eval to floating point is trivial.


Eval maybe, bitboards definitely not. Plus there's the issue of doing good parallelism over so many cores.
Parent - - By user923005 (****) Date 2017-10-10 21:00
Ankan Banerjee's perft GPU program uses bitboards:
https://github.com/ankan-ban/perft_gpu

Start position perft(11) in 1 hour using transposition tables.
No CPU based perft program can come anywhere close to this.

He ran a complete perft(14), and a complete perft(15) in 5 days:
http://talkchess.com/forum/viewtopic.php?t=64983&highlight=perft
Parent - - By Labyrinth (*****) Date 2017-10-10 22:42

>Ankan Banerjee's perft GPU program uses bitboards


Doesn't mean that it's trivial! :cool:
Parent - By user923005 (****) Date 2017-10-10 22:54
You're certainly right about that.

What GPUs are incredibly good at is executing loops where the internal instructions in the body of the loop don't branch much.
If there is a different path, the other loops all have to wait.
Otherwise, it basically does all the loops in one swoop (given enough threads, and they have a lot of threads).

But writing a chess program for a GPU has been only partly successful so far.

I suggest that Matthew Lai's engine would be a good candidate for a port, since it does so much floating point.
Up Topic The Rybka Lounge / Computer Chess / Chess Engine and GPU

Powered by mwForum 2.27.4 © 1999-2012 Markus Wichitill