Why is MultiPV so slow?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Why is MultiPV so slow?

Post by Ferdy »

Opening position, mpv is faster.

[d]r1bqr1k1/ppp2pbp/2np1np1/8/2PP4/1QN2N2/PP2BPPP/R1B2RK1 w - - 2 10

Image

legal moves: 38

Plot data

Code: Select all

search depth = [16, 20, 24]
mpv time = [10, 43, 176]
spv time = [11, 49, 195]
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Why is MultiPV so slow?

Post by Dann Corbit »

This one is complex and about even. There are other reasonable looking alternatives:
1r4k1/3n1pp1/1q2pb1p/1pp5/8/1QNP2P1/1P1NPPKP/R7 w - - acd 50; acs 918; bm Nce4; c0 "Artemiev-Caruana after 19... Rb8"; c1 "http://talkchess.com/forum3/viewtopic.p ... 01#p827201"; ce 0; pm Nce4; pv Nce4 Bd8 Nf3 Qc6 Kg1 f5 Ned2 Bf6 Ra7 Kh7 h3 Ne5 Nxe5 Bxe5 Qa2 Bc7 b3 Bb6 Ra6 Qc7 Kg2 Qb7+ Kg1;

This one is dead lost, so I guess there will be a fail low for every ply of every search:
8/1Q3r2/3k4/6p1/6P1/3p1P2/2qb2K1/3R4 w - - acd 50; acs 56; bm Qb8+; c1 "http://talkchess.com/forum3/viewtopic.p ... 01#p827201"; ce -32725; dm -21; pm Qb8+; pv Qb8+ Kd5 Qa8+ Kc5 Qc8+ Kd4 Qh8+ Kc4 Qc8+ Kb3 Qe6+ Kb2 Qb6+ Bb4+ Kg3 Qxd1 Qxb4+ Qb3 Qd2+ Kb1 Qe1+ Kc2 Qe4 Qc3 Kg2 Kc1 Qe3+ Qd2+ Qxd2+ Kxd2 Kf2 Rf4 Kg3 Ke2 Kg2 Rxf3 Kh1 Kf2 Kh2 Kf1 Kh1 Rh3+;

I wonder also about the timing for won positions with a single best move and won positions with many winning moves.
I guess that the won positions with many winning moves will behave like a dead lost position because of fail highs.
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.
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: Why is MultiPV so slow?

Post by Sesse »

Heh, so it depends on the position?

I wonder; when we change positions, do we automatically get the 8 ply penalty for hash table replacement? Could turning that off help spv search win more of the time?
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Why is MultiPV so slow?

Post by Ferdy »

Ferdy wrote: Tue Jan 28, 2020 5:50 am Position where searching moves individually is faster than multipv.

[d]8/1Q3r2/3k4/6p1/6P1/3p1P2/2qb2K1/3R4 w - - 13 55

Image

Plot data:

Code: Select all

search depth = [20, 36, 46]
mpv time = [2, 20, 30]
spv time = [2, 5, 9]
There is a bug in the script, sorry. Re-run the test, and mpv is actually faster.

Image

[d]8/1Q3r2/3k4/6p1/6P1/3p1P2/2qb2K1/3R4 w - - 13 55
legal moves: 34

Plot data

Code: Select all

search depth = [20, 36, 46]
mpv time(s) = [4, 12, 19]
spv time(s) = [5, 32, 127]

Engine: Stockfish 11
Threads: 4
Hash(mb): 256

CPU: i7-2600K, 3.4 Ghz, 4 cores, 8 threads
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Why is MultiPV so slow?

Post by bob »

hgm wrote: Sat Jan 25, 2020 5:42 pm Multi-PV with N moves should not take more than N times as much time as a single-move search. If it does, it is not properly implemented.
Don't agree with this. I don't have the file any longer, but Harry Nelson had an extremely pathological position that violated this. The best move was easy to find. The others required varying degrees of very large searches (due to lots of checks, promotions, etc.) Once you find the best move, all the deep crap gets cut away pretty easily. I will look to see if I can find the thing as we used to use it as one of our debugging positions on Cray Blitz...

In games, I have seen positions where a fail high took FAR longer to resolve than the PV move found at the beginning of the search. Doesn't happen every time. Really can't say how often it happens.. But I can definitely say > 0 times. :)
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Why is MultiPV so slow?

Post by Ferdy »

Only 1 single move that does not lose. spv is faster.

[d]r2q2k1/pQp2p1p/3p2p1/8/8/7P/PP3PP1/2r2RK1 w - - 0 19
legal moves: 28
Carlsen, Magnus;Giri, Anish;82nd Tata Steel GpA

Image

Plot data

Code: Select all

search depth = [18, 20, 22]
mpv time(ms) = [13124, 37905, 71508]
spv time(ms) = [9696, 18096, 31853]

Engine: Stockfish 11
Threads: 4
Hash(mb): 256

CPU: i7-2600K, 3.4 Ghz, 4 cores, 8 threads

Multipv result on depth 22.

Code: Select all

f1c1 {'score': -17}
b7e4 {'score': -927}
b7d5 {'score': -968}
f2f4 {'score': -1092}
b7b4 {'score': -1115}
b2b3 {'score': -1336}
b7f3 {'score': -1365}
h3h4 {'score': -1395}
b7b5 {'score': -1407}
b7a6 {'score': -1437}
b2b4 {'score': -1437}
b7b3 {'score': -1463}
f2f3 {'score': -1467}
g2g3 {'score': -1475}
a2a3 {'score': -1483}
g2g4 {'score': -1495}
a2a4 {'score': -1500}
b7a8 {'score': -1684}
g1h2 {'score': -2123}
b7c6 {'score': -2925}
f1d1 {'score': -2936}
f1e1 {'score': -6347}
g1h1 {'score': -6538}
b7a7 {'score': -31980}
b7c8 {'score': -31980}
b7b8 {'score': -31982}
b7b6 {'score': -31982}
b7c7 {'score': -31984}