Does LC0 get hardware advantage?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Uri Blass
Posts: 10267
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Does LC0 get hardware advantage?

Post by Uri Blass »

I think that energy consumption or price is not the way to test if an hardware is faster.
Hardware advantage simply means that you can do with that hardware things faster.

Now my question is the following:

Suppose that you write a new engine to calculate exact value of perft(number of legal games with n plies from a specific position) or to solve mates(tell the user what is the distance to mate and give all solutions).

What is better hardware to do it faster GPU that lc0 use in CCCC or CPU that stockfish use there?
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Does LC0 get hardware advantage?

Post by brianr »

For perft it has already been done and it's not even close.
https://github.com/ankan-ban/perft_gpu

Of course, perft is only a small part of actual game performance.
smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: Does LC0 get hardware advantage? Truck vs Race Car

Post by smatovic »

If you count only FLOPS or MIPS then of course GPUs have an hardware advantage.
The question is, how to make use of this horse power for chess.

The GPU is more like a truck, and the CPU like a race car.
The truck can play out his advantage only with a certain amount of payload,
when massive parallel work has to be done.

An example for payload are the batch sizes used in LC0.

Ankan showed with his perft_gpu that GPUs can be used for 64 bit chess move
generation with incredible speeds.

My own experiments with Zeta as chess playing engine were less successful,
as soon as i add more complex code which relies on branches and syncs
i loose a lot of compute cycles.

So the challenge is still open, to create an classic chess engine that makes
use of the horse power the GPU offers, good luck.

--
Srdja
Uri Blass
Posts: 10267
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Does LC0 get hardware advantage? Truck vs Race Car

Post by Uri Blass »

smatovic wrote: Fri Oct 05, 2018 11:31 am If you count only FLOPS or MIPS then of course GPUs have an hardware advantage.
The question is, how to make use of this horse power for chess.

The GPU is more like a truck, and the CPU like a race car.
The truck can play out his advantage only with a certain amount of payload,
when massive parallel work has to be done.

An example for payload are the batch sizes used in LC0.

Ankan showed with his perft_gpu that GPUs can be used for 64 bit chess move
generation with incredible speeds.

My own experiments with Zeta as chess playing engine were less successful,
as soon as i add more complex code which relies on branches and syncs
i loose a lot of compute cycles.

So the challenge is still open, to create an classic chess engine that makes
use of the horse power the GPU offers, good luck.

--
Srdja
I think that for playing chess you can use massive parallel work otherwise cpu chess engines could not earn much from having many cores
so I wonder if it is not possible with gpu to emulate stockfish with many thousands of cores.
smatovic
Posts: 2639
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: Does LC0 get hardware advantage? Truck vs Race Car

Post by smatovic »

Uri Blass wrote: Fri Oct 05, 2018 7:13 pm
I think that for playing chess you can use massive parallel work otherwise cpu chess engines could not earn much from having many cores
so I wonder if it is not possible with gpu to emulate stockfish with many thousands of cores.
I tried to port my simple CPU engine Zeta Dva to OpenCL to run on a GPU,
with little success.

I tried various designs.

In the end i had the choice of running thousands of threads with ~10 Knps
each, or to couple 64 threads to one worker with up to ~100 Knps each and
hundreds of workers in total.

In both cases i was not able to outperform CPU engines,
but maybe some more skilled coder will find a solution.

--
Srdja

***edit***
here some numbers:

http://talkchess.com/forum3/viewtopic.php?f=7&t=63517
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Does LC0 get hardware advantage?

Post by Dann Corbit »

I think that a far more interesting question than which type chess engine gets more NPS per MIP is which gets more Elo per dollar.
After all, that is the true goal.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
megamau
Posts: 37
Joined: Wed Feb 10, 2016 6:20 am
Location: Singapore

Re: Does LC0 get hardware advantage?

Post by megamau »

Dann Corbit wrote: Fri Oct 05, 2018 9:38 pm I think that a far more interesting question than which type chess engine gets more NPS per MIP is which gets more Elo per dollar.
After all, that is the true goal.
You are completely correct !
Very few people care about what is "fair" for some shaky definition of "fair". Many people care what performance (elo) they can get for their effort (dollars).