How to compile Stockfish?

Discussion of chess software programming and technical issues.

Moderator: Ras

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: How to compile Stockfish?

Post by Sven »

lech wrote:
Sven Schüle wrote:
lech wrote:Thanks for help.
Stockfish can be improved. Each position may be considered in 4 ways (combinations of: white<->black and King<->Queen). Results are different e.g. 138, 2, 49, 85 seconds to find solution for the same (in fact) position. It gives huge possibilities to improve Stockfish.
It needs a team work.
Can you give an example position where mirroring (which is what I understood from your post) leads to such different solution times?

Sven

Code: Select all

Searching: 6bk/8/1P3P1K/6PB/4r3/q7/3P1B2/5R2 w - -
[...]
10     +5.94   00:02   483858 g6 Bf7 gxf7 Ra4 b7 Qf8+ Kg6 Ra6 Bd4 Qg7+ Kf5 Qh7+ 
                              Kg4 Qe4+ Kg3 Ra3+ Rf3 Qe1+ Kf4 
[...]
Searching: kb6/8/K1P3P1/BP6/3r4/7q/2B1P3/2R5 w - -
[...]
10     +4.93   00:02   671967 b6 Bc7 g7 Qe6 b7+ Kb8 Bxc7+ Kxc7 b8=Q+ Kxb8 g8=Q+ 
                              Qxg8 c7+ Kxc7 Bb3+ Kd6 Bxg8 Re4 Bc4 Ke5 
[...]
Searching: 2r5/2b1p3/7Q/3R4/bp6/k1p3p1/8/KB6 b - -
[...]
10  >  +5.41   00:02   892112 b3 Bc2 bxc2 Qe3 Kb3 Rc5 Be5 Rxc8 c1=R+ Qxc1 c2+ 
[...]
Searching: 5r2/3p1b2/Q7/4R3/6pb/1p3p1k/8/6BK b - -
[...]
10     +4.32   00:02   939045 g3 Bf2 gxf2 Re4 Be6 Qf1+ Kg3 Rxh4 Kxh4 Qxf2+ Kg4 
                              Qg1+ Kh5 Qh2+ Kg5 Qg3+ Kh6 Qf2 Kg6 Kg1 d5 Qf1 
[...]
So what are you comparing exactly? What was the termination condition for these four searches? Why does the output for the second search terminate after 10 iterations already? What I can see is that in all shown cases the solution (best move) was found much earlier than in the last iteration for which you reported its output.

The time used for finding the best move of iteration 10 is roughly the same in all four cases. However, you are right that there are differences, also for later iterations, and also in the evaluation that is displayed.

One possible explanation could be the order of move generation, e.g. left to right for pawns, although I would not expect a huge influence by that. Other explanations should indeed be given by the Stockfish team. But I don't have the impression that there is some major problem.

Sven
lech
Posts: 1169
Joined: Sun Feb 14, 2010 10:02 pm

Re: How to compile Stockfish?

Post by lech »

The third half move is crucial for the correct score. :cry:
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: How to compile Stockfish?

Post by mcostalba »

lech wrote:Thanks for help.
Stockfish can be improved. Each position may be considered in 4 ways (combinations of: white<->black and King<->Queen). Results are different e.g. 138, 2, 49, 85 seconds to find solution for the same (in fact) position. It gives huge possibilities to improve Stockfish.
It needs a team work.
The order of generated moves differs when you mirror / flip the position, so the search cannot be exactly the same for all the positions.

For instance suppose you generate 5 pawn moves at a given position, the search can choose to follow the first 2 ones and prune the last 3.

Now if you change the order it can happen that the 3 pruned moves are different from the previous case and you may end up pruning a good key pawn push that could lead quickly to a very good position so that in this unlucky case you have to search much more to find the correct answer.

Of course on average the lucky cases should match the unlucky ones, but on single cherry-picked positions you _could_ experience this behaviours.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: How to compile Stockfish?

Post by Sven »

lech wrote:The third half move is crucial for the correct score. :cry:
I see, that explains at which points the search had been stopped.

Sven
lech
Posts: 1169
Joined: Sun Feb 14, 2010 10:02 pm

Re: How to compile Stockfish?

Post by lech »

mcostalba wrote:
lech wrote:Thanks for help.
Stockfish can be improved. Each position may be considered in 4 ways (combinations of: white<->black and King<->Queen). Results are different e.g. 138, 2, 49, 85 seconds to find solution for the same (in fact) position. It gives huge possibilities to improve Stockfish.
It needs a team work.
The order of generated moves differs when you mirror / flip the position, so the search cannot be exactly the same for all the positions.

For instance suppose you generate 5 pawn moves at a given position, the search can choose to follow the first 2 ones and prune the last 3.

Now if you change the order it can happen that the 3 pruned moves are different from the previous case and you may end up pruning a good key pawn push that could lead quickly to a very good position so that in this unlucky case you have to search much more to find the correct answer.

Of course on average the lucky cases should match the unlucky ones, but on single cherry-picked positions you _could_ experience this behaviours.
Marco, thanks for your explain. I tested many positions (middle-game too). Since differences can be that big (time and quality), I thought it is worth to look at this. Many of us use engines only to analyze. :oops: