When should I consider parallel search ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Dirt
Posts: 2851
Joined: Wed Mar 08, 2006 10:01 pm
Location: Irvine, CA, USA

Re: When should I consider parallel search ?

Post by Dirt »

MahmoudUthman wrote:
hgm wrote:Never consider parallel search. It is an inefficient usage of resources.
Never as in never or not right now ? , I thought that current algorithms scale quite well on low number of cores which what I'm interested in "for now" , I only have a I7-5820k processor.
That was a troll post by HGM. You're better off ignoring it.
Deasil is the right way to go.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: When should I consider parallel search ?

Post by hgm »

Not entirely. As evidenced by the fact that almost none of my engines is SMP. After having tried it once (on HaQiKi D), I realized that it would bring me nothing.

Komodo also only implemented SMP after it had reached the top as single-threaded engine. It seems like something desperate you do only when you run entirely out of other ideas to improve your engine.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: When should I consider parallel search ?

Post by elcabesa »

MahmoudUthman wrote: :) I'm but I lack the experience to judge whether or not It's worth the effort (coding & debugging) at this level before trying other things like the ones I mentioned.
I think you program the engine for fun, it's your hobby. so, as soon as you want to have fun trying to implement a smp engine you can try :)

a standard implementation of lazy smp shuld give you 100 elo point boost when comparing 4cores vs 1core at CCRL conditions :)

For SMP you have probably to refactor some of your code because you nned to choose what data structure should be shared between threads and which should not. I share only the hashtable and the const structures for move generation. no other data is shared between threads. this means that each core hs his own killer table and history tables
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: When should I consider parallel search ?

Post by hgm »

elcabesa wrote:For SMP you have probably to refactor some of your code because you nned to choose what data structure should be shared between threads and which should not.
In HaQiKi D I avoided that by using processes instead of threads. They only share the hash table.

The processes fork off each other in response to the 'cores' command, forming a pipeline along which all commands are passed to keep them in sync. The 'cores' command causes a slave process to be forked off, connected to the parent process by pipes, if more than a single core is requested. It is subsequently passed to that slave with the number of cores decremented by one. The 'memory' command is passed with an extra, non-standard parameter indicating the OS name of the shared memory area, so that the slaves can attach to it, instead of allocating memory themselves. Without this extra parameter (as when received from the GUI) a shared memory area of the requested size is created. A 'go' command is passed to the slave as 'analyze', and 'force' command as 'exit'. When the master makes a move, it doesn't only send it to the GUI as 'move XXX', but also to the slave as 'usermove XXX'. Other commands are passed as they are received.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: When should I consider parallel search ?

Post by syzygy »

hgm wrote:Not entirely. As evidenced by the fact that almost none of my engines is SMP. After having tried it once (on HaQiKi D), I realized that it would bring me nothing.

Komodo also only implemented SMP after it had reached the top as single-threaded engine. It seems like something desperate you do only when you run entirely out of other ideas to improve your engine.
Yes, one should at least have reached the strength of HGM's engine (about 1800 Elo?).
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: When should I consider parallel search ?

Post by hgm »

Uh uh, you are talking about the silver medalist in Pamplona 2009! (When it was still single core.)
flok

Re: When should I consider parallel search ?

Post by flok »

Embla is smp yes - unfortunately it does not give any gain.

I've tried getting lazy smp to work. Took an hour. But: it did not work :-)
So I asked it because I was wondering what aspect I missed. Apparently there is one because of that one hour - a week difference.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: When should I consider parallel search ?

Post by syzygy »

flok wrote:Embla is smp yes - unfortunately it does not give any gain.

I've tried getting lazy smp to work. Took an hour. But: it did not work :-)
So I asked it because I was wondering what aspect I missed. Apparently there is one because of that one hour - a week difference.
You missed only three aspects: bugs, bugs and bugs.
elpapa
Posts: 211
Joined: Sun Jan 18, 2009 11:27 pm
Location: Sweden
Full name: Patrik Karlsson

Re: When should I consider parallel search ?

Post by elpapa »

flok wrote:it did not work
flok wrote:I was wondering what aspect I missed
Imagine you give me a Rubik's cube and ask me to solve it. I finish it in only 15 seconds and this is what it looks like:

Image


Now, what aspect of solving Rubik's cube would you say I missed?
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: When should I consider parallel search ?

Post by Guenther »

syzygy wrote:
hgm wrote:Not entirely. As evidenced by the fact that almost none of my engines is SMP. After having tried it once (on HaQiKi D), I realized that it would bring me nothing.

Komodo also only implemented SMP after it had reached the top as single-threaded engine. It seems like something desperate you do only when you run entirely out of other ideas to improve your engine.
Yes, one should at least have reached the strength of HGM's engine (about 1800 Elo?).
HGM has done several programs and a lot of them are non 'western' chess ones which are quite strong. BTW even Joker, one of his chess programs is at least 2300.
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy