If we have 64 threads can we modify search?

Discussion of chess software programming and technical issues.

Moderator: Ras

Jouni
Posts: 3621
Joined: Wed Mar 08, 2006 8:15 pm
Full name: Jouni Uski

If we have 64 threads can we modify search?

Post by Jouni »

One idea: every thread search one possible move only and then best is selected. Will this made SMP search weaker than normal search?
Jouni
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: If we have 64 threads can we modify search?

Post by dangi12012 »

Suppose you had 4 legal moves. Would you run the CPU on 6% of its potential just because that seemed easier?
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
User avatar
j.t.
Posts: 263
Joined: Wed Jun 16, 2021 2:08 am
Location: Berlin
Full name: Jost Triller

Re: If we have 64 threads can we modify search?

Post by j.t. »

Jouni wrote: Thu Oct 06, 2022 5:08 pm One idea: every thread search one possible move only and then best is selected. Will this made SMP search weaker than normal search?
If you're not in multi pv mode, this will likely make the engine weaker, as many of the less good moves could be searched with a much higher alpha value if you'd wait for the first (or even second, third, ...) move to raise alpha.
AndrewGrant
Posts: 1957
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: If we have 64 threads can we modify search?

Post by AndrewGrant »

Jouni wrote: Thu Oct 06, 2022 5:08 pm One idea: every thread search one possible move only and then best is selected. Will this made SMP search weaker than normal search?
Massively, would be the guess. In Alphabeta, you spend almost all the time on the played move, 10% on the next best, and maybe a few% of the time on all remaining moves. Most moves are just bad. Now if you could, somehow brilliantly limit your search down to just a couple candidate moves instantly, then maybe splitting threads up to do proper searches would work. But I'm not entirely convinced of that even.

You could test this, in a scuffed way. Play games with 4 threads. At at search, move of your turn, do a multipv depth=15 search. Get those 4 moves. Now assign one thread to each for YOUR version of SMP. For the baseline, issue another search but limit it via searchmoves move1 move2 move3 move4.
abulmo2
Posts: 465
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: If we have 64 threads can we modify search?

Post by abulmo2 »

Jouni wrote: Thu Oct 06, 2022 5:08 pm One idea: every thread search one possible move only and then best is selected. Will this made SMP search weaker than normal search?
In his thesis (from 1995) Jean Christophe Weill called it the naive approach for parallelism. For a branching factor of 40, at best an asymptotic acceleration of 14.2 can be expected. In practice, measurements gave an acceleration of 6 only. On modern engine, it would probably be even worst.
Richard Delorme
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: If we have 64 threads can we modify search?

Post by dangi12012 »

Yesyes - then you start to take the first N moves no matter at which depth they occur.
Then you stop search on unpromising moves.
Then you keep upper and lower bounds shared between threats.
Then you would like these bounds to be known at high confidence before splitting the workload.

The path from naive to optimized inevidabely ends up at YBWC, which is also not very scalable.

You heard it here first. MCTS is the future, its already almost competitive, with a slope for the rate of improvement higher than that for alphabeta.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
smatovic
Posts: 3230
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: If we have 64 threads can we modify search?

Post by smatovic »

Jouni wrote: Thu Oct 06, 2022 5:08 pm One idea: every thread search one possible move only and then best is selected. Will this made SMP search weaker than normal search?
I suggested RMO - Randomized Move Order - for >=256 cores, maybe somebody will give it some day a try on CPU:

https://talkchess.com/forum3/viewtopic.php?f=7&t=72684

--
Srdja
Werewolf
Posts: 1992
Joined: Thu Sep 18, 2008 10:24 pm

Re: If we have 64 threads can we modify search?

Post by Werewolf »

I might have asked this question 5 years ago but in a different way:

Imagine a very rich man - Mr Filthy Rich - who wants to be the best at correspondence chess, where each opponent has 24 hours to move. To achieve this goal he wants the fastest computer on Earth. But he's no programmer and can't build himself a cluster or supercomputer.

So he comes up with a plan: he'll buy 100 of the fastest workstations available, say $20,000 each, so $2 Million in total. Each machine runs latest Stockfish. When his opponent makes a move he gets each machine to analyze a different legal possible reply move until every legal move is accounted for. Since most chess positions only have 30-50 legal moves, most of his machines don't do anything most of the time, but he has them just in case there's a position with a high number of legal moves.

His point is this: even the weird moves get serious attention: a full 24 hours of search. At the end of each 24 hours, he walks around his machines and picks the chess move with the highest score.

His opponent - Mr Fairly Rich - has ONE top-end workstation, like the ones Mr. Filthy Rich has, but only one of them. He also runs latest Stockfish for 24 hours, but it searches normally considering all legal moves.

Question: How much stronger is Mr Filthy Rich's setup than Mr Fairly Rich's?

Most people estimated less than 50 elo and that was 5 years ago.
Chessnut1071
Posts: 313
Joined: Tue Aug 03, 2021 2:41 pm
Full name: Bill Beame

Re: If we have 64 threads can we modify search?

Post by Chessnut1071 »

Werewolf wrote: Sun Oct 09, 2022 11:35 am I might have asked this question 5 years ago but in a different way:

Imagine a very rich man - Mr Filthy Rich - who wants to be the best at correspondence chess, where each opponent has 24 hours to move. To achieve this goal he wants the fastest computer on Earth. But he's no programmer and can't build himself a cluster or supercomputer.

So he comes up with a plan: he'll buy 100 of the fastest workstations available, say $20,000 each, so $2 Million in total. Each machine runs latest Stockfish. When his opponent makes a move he gets each machine to analyze a different legal possible reply move until every legal move is accounted for. Since most chess positions only have 30-50 legal moves, most of his machines don't do anything most of the time, but he has them just in case there's a position with a high number of legal moves.

His point is this: even the weird moves get serious attention: a full 24 hours of search. At the end of each 24 hours, he walks around his machines and picks the chess move with the highest score.

His opponent - Mr Fairly Rich - has ONE top-end workstation, like the ones Mr. Filthy Rich has, but only one of them. He also runs latest Stockfish for 24 hours, but it searches normally considering all legal moves.

Question: How much stronger is Mr Filthy Rich's setup than Mr Fairly Rich's?

Most people estimated less than 50 elo and that was 5 years ago.
"...Question: How much stronger is Mr Filthy Rich's setup than Mr Fairly Rich's?
Most people estimated less than 50 elo and that was 5 years ago."

Other objective: Fastest Checkmate
Case 1: Most classical mate puzzles:
Now Mr. Filthy Rich is at least 3x as fast. Most good evaluation functions can find the checkmate in the first 3-5 moves.

Case 2: Specially designed mates to befuddle a computer
Now Mr. Filthy Rich has HUGE advantage, about 20x on average, and more likely 30x or higher, since the solution will be a very unlikely move like a Queen sacrifice.

My guess if at least 150 ELO, especially if those workstations have multiple cores.

It pays to be rich these days.
Werewolf
Posts: 1992
Joined: Thu Sep 18, 2008 10:24 pm

Re: If we have 64 threads can we modify search?

Post by Werewolf »

Chessnut1071 wrote: Sun Oct 09, 2022 6:34 pm
Werewolf wrote: Sun Oct 09, 2022 11:35 am I might have asked this question 5 years ago but in a different way:

Imagine a very rich man - Mr Filthy Rich - who wants to be the best at correspondence chess, where each opponent has 24 hours to move. To achieve this goal he wants the fastest computer on Earth. But he's no programmer and can't build himself a cluster or supercomputer.

So he comes up with a plan: he'll buy 100 of the fastest workstations available, say $20,000 each, so $2 Million in total. Each machine runs latest Stockfish. When his opponent makes a move he gets each machine to analyze a different legal possible reply move until every legal move is accounted for. Since most chess positions only have 30-50 legal moves, most of his machines don't do anything most of the time, but he has them just in case there's a position with a high number of legal moves.

His point is this: even the weird moves get serious attention: a full 24 hours of search. At the end of each 24 hours, he walks around his machines and picks the chess move with the highest score.

His opponent - Mr Fairly Rich - has ONE top-end workstation, like the ones Mr. Filthy Rich has, but only one of them. He also runs latest Stockfish for 24 hours, but it searches normally considering all legal moves.

Question: How much stronger is Mr Filthy Rich's setup than Mr Fairly Rich's?

Most people estimated less than 50 elo and that was 5 years ago.
"...Question: How much stronger is Mr Filthy Rich's setup than Mr Fairly Rich's?
Most people estimated less than 50 elo and that was 5 years ago."

Other objective: Fastest Checkmate
Case 1: Most classical mate puzzles:
Now Mr. Filthy Rich is at least 3x as fast. Most good evaluation functions can find the checkmate in the first 3-5 moves.

Case 2: Specially designed mates to befuddle a computer
Now Mr. Filthy Rich has HUGE advantage, about 20x on average, and more likely 30x or higher, since the solution will be a very unlikely move like a Queen sacrifice.

My guess if at least 150 ELO, especially if those workstations have multiple cores.

It pays to be rich these days.
Yes agreed, with those aims the rewards are much higher.