Bug fixed!

Public forum

Moderator: Team

Bug fixed!

Postby Michel on Sun Oct 12, 2008 12:32 pm

I am starting a new thread since this is not a linux issue.

I turns out that in search_clear in search.cpp the depth entry
in

SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv]

was not reset to zero. So I added the line

SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv].depth = 0;


and things seem to work (although I did only do very limited testing)

Can the specialists in Toga's code base verify that this is a valid fix?

Michel
Michel
 
Posts: 64
Joined: Wed Oct 01, 2008 3:32 pm

Re: Bug fixed!

Postby Eelco de Groot on Mon Oct 20, 2008 7:33 pm

Michel wrote:I am starting a new thread since this is not a linux issue.

I turns out that in search_clear in search.cpp the depth entry
in

SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv]

was not reset to zero. So I added the line

SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv].depth = 0;


and things seem to work (although I did only do very limited testing)

Can the specialists in Toga's code base verify that this is a valid fix?

Michel


Hello Michel,

Thanks for taking a look at the code, I think we can use some more people on the forum that actually are good C++ programmers! I'm certainly not one of them..

  • I have really not much of a notion myself how this part of the code is working or when it is triggered. Let alone what it does in multithreaded operations, I only have Toga on single CPU at the moment. So I can't say much sensible about your fix being valid, Sorry!
  • On the other hand, because this just seems to clear some variables when the information is not needed anymore, I would guesss to add the fixed line would not do much harm there either.

I was just wondering if, in your own testing, did you detect any change in output anywhere after adding the new line?

I added your suggestion in Toga, mostly still Toga 1.4 Beta5c, here:


// SearchBest

SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv].move = MoveNone;
SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv].value = 0;
SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv].flags = SearchUnknown;
SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv].depth = 0;
PV_CLEAR(SearchBest[ThreadId][SearchCurrent[ThreadId]->multipv].pv);


but can't detect any change myself in Toga output, at least not in analysis mode and also not when I start analysis mode in two best line mode. I only tested this on my single CPU computer though. But the output was totally identical in PV and nodenumbers in the position that I tried for a Toga-version without the change and a version with the new line. So I'm not sure it really is a bug not to have this additional line in search.cpp?

Regards, Eelco
User avatar
Eelco de Groot
 
Posts: 69
Joined: Thu Jun 05, 2008 12:45 am

Re: Bug fixed!

Postby Michel on Tue Oct 21, 2008 6:42 am

I only tested this on my single CPU computer though.


That does not matter. The bug occurs when you set the number of threads > 1 in search.h, independently of the number of CPU's.

For reference I am reposting the instructions to reproduce the bug.

(1) Make sure performance.bin is in the current directory.
(2) Start Toga MP version in a terminal.
(3) Do

Code: Select all
go ponder
stop
go depth 5



The engine responds with

Code: Select all
bestmove a1a1 ponder b8c6


Of course this is a minimal example but this does (often) occur in real life.

The reason why this happens is that search_clear is executed after "stop". The second thread has been searched to a depth > 5 whereas the opening book move is only depth 1 (by convention), Since the depth variable of the second thread is not reset to 0, Toga thinks the second thread has the best move, leading to corruption,
Michel
 
Posts: 64
Joined: Wed Oct 01, 2008 3:32 pm

Re: Bug fixed!

Postby WHMoweryJr on Fri Nov 28, 2008 11:59 pm

DeepLearninToga UCI by WHMoweryJr, Thomas Gaksch and Fabien Letouzey.
Based on Toga II 1.4 Beta5c by Thomas Gaksch.
Based on Fruit 2.1 by Fabien Letouzey.
For use with 2 cpu's.
Settings by Dieter Eberle and Chris Formula {Toga II 1.4.1SE}.
Compilations and testing by Denis Mendoza.
Toga Developers Discussion Board and testing by Shaun Brewer.
Book expert: Kevin Frayer.
Systems Engineering: WHMoweryJr.
Systems Engineering: J Donald.
Learn Algorithm: WHMoweryJr.
toga_info.finf not loaded.
EgbbProbe 3.1 by Daniel Shawul
Cache Size = 8 Mb (1035 entries)
Egbbs loaded !
EgbbProbe IS Loaded!
go ponder
info multipv 1 depth 1 seldepth 1 score cp 6 time 0 nodes 2 pv b1a3
info multipv 1 depth 1 seldepth 1 score cp 34 time 0 nodes 3 pv b1c3
info depth 2
info depth 2
info multipv 1 depth 2 seldepth 2 score cp 20 time 0 nodes 23 pv b1c3 b8c6
info depth 3
info multipv 1 depth 3 seldepth 3 score cp 34 time 15 nodes 127 pv b1c3 b8c6 g1f
3
info multipv 1 depth 2 seldepth 2 score cp 20 time 15 nodes 44 pv b1c3 b8c6
info depth 2 seldepth 2 time 15 nodes 88 nps 0
info depth 3
info depth 4
info multipv 1 depth 3 seldepth 3 score cp 34 time 31 nodes 88 pv b1c3 b8c6 g1f3

info depth 3 seldepth 3 time 31 nodes 176 nps 0
info depth 4
info multipv 1 depth 4 seldepth 6 score cp 20 time 31 nodes 653 pv b1c3 b8c6 g1f
3 g8f6
info multipv 1 depth 4 seldepth 4 score cp 20 time 46 nodes 154 pv b1c3 b8c6 g1f
3 g8f6
info depth 5
info depth 4 seldepth 6 time 78 nodes 2002 nps 0
info depth 5
info multipv 1 depth 5 seldepth 8 score cp 28 time 93 nodes 1634 pv b1c3 b8c6 g1
f3 g8f6 d2d4
info multipv 1 depth 5 seldepth 9 score cp 28 time 93 nodes 1777 pv b1c3 b8c6 g1
f3 g8f6 d2d4
info depth 6
info depth 5 seldepth 13 time 156 nodes 7924 nps 0
info depth 6
info multipv 1 depth 6 seldepth 13 score cp 20 time 218 nodes 6271 pv b1c3 b8c6
g1f3 g8f6 d2d4 d7d5
info multipv 1 depth 6 seldepth 12 score cp 20 time 218 nodes 4075 pv b1c3 b8c6
g1f3 g8f6 d2d4 d7d5
info depth 7
info depth 6 seldepth 12 time 280 nodes 11224 nps 0
info depth 7
info multipv 1 depth 7 seldepth 13 score cp 15 time 405 nodes 11894 pv b1c3 b8c6
g1f3 g8f6 d2d4 d7d5 c1f4
info multipv 1 depth 7 seldepth 12 score cp 15 time 436 nodes 9218 pv b1c3 b8c6
g1f3 g8f6 d2d4 d7d5 c1f4
info depth 8
info currmove b1c3 currmovenumber 1
info depth 7 seldepth 12 time 577 nodes 24548 nps 42544
info depth 8
info multipv 1 depth 8 seldepth 17 score cp 20 time 717 nodes 23820 pv b1c3 b8c6
g1f3 g8f6 d2d4 d7d5 c1f4 c8f5
info multipv 1 depth 8 seldepth 16 score cp 20 time 733 nodes 16268 pv b1c3 b8c6
g1f3 g8f6 d2d4 d7d5 c1f4 c8f5
info depth 9
info depth 8 seldepth 17 time 904 nodes 58128 nps 64301
info depth 9
info currmove b1c3 currmovenumber 1
info multipv 1 depth 9 seldepth 17 score cp 11 time 1107 nodes 35089 pv b1c3 b8c
6 g1f3 g8f6 d2d4 d7d5 c1g5 c8f5
info multipv 1 depth 9 seldepth 17 score cp 11 time 1154 nodes 30893 pv b1c3 b8c
6 g1f3 g8f6 d2d4 d7d5 c1g5 c8f5
info time 1544 nodes 80000 nps 51813 cpuload 997
info hashfull 3
info depth 10
info depth 9 seldepth 22 time 1981 nodes 111386 nps 56227
info depth 10
info currmove b1c3 currmovenumber 1
info time 2605 nodes 160000 nps 61420 cpuload 999
info hashfull 5
info multipv 1 depth 10 seldepth 23 score cp 26 time 3151 nodes 104044 pv b1c3 b
8c6 d2d4 d7d5 g1f3 g8f6 c1f4 c8f5 c3b5 a8c8
info currmove e2e3 currmovenumber 2
info multipv 1 depth 10 seldepth 24 score cp 26 time 3151 nodes 73471 pv b1c3 b8
c6 d2d4 d7d5 g1f3 g8f6 c1f4 c8f5 c3b5 a8c8
info currmove b2b3 currmovenumber 3
info currmove g2g3 currmovenumber 4
info currmove g2g4 currmovenumber 5
info currmove a2a4 currmovenumber 6
info currmove f2f4 currmovenumber 7
info currmove h2h4 currmovenumber 8
info currmove f2f3 currmovenumber 9
info currmove a2a3 currmovenumber 10
info currmove h2h3 currmovenumber 11
info currmove c2c4 currmovenumber 12
info currmove c2c3 currmovenumber 13
info currmove d2d3 currmovenumber 14
info depth 11
info currmove b1c3 currmovenumber 1
info depth 10 seldepth 24 time 3728 nodes 166346 nps 44621
info depth 11
info time 3853 nodes 260000 nps 67480 cpuload 1000
info hashfull 9
info time 5007 nodes 360000 nps 71899 cpuload 1000
info hashfull 12
info multipv 1 depth 11 seldepth 25 score cp 13 time 5101 nodes 113222 pv b1c3 g
8f6 g1f3 d7d5 d2d4 b8c6 d1d3 e7e6 c1f4 f8d6 f4d6 d8d6
info multipv 1 depth 11 seldepth 25 score cp 13 time 5101 nodes 183623 pv b1c3 g
8f6 g1f3 d7d5 d2d4 b8c6 d1d3 e7e6 c1f4 f8d6 f4d6 d8d6
info currmove e2e3 currmovenumber 2
info currmove b2b3 currmovenumber 3
info currmove g2g3 currmovenumber 4
info currmove g2g4 currmovenumber 5
info currmove a2a4 currmovenumber 6
info currmove f2f4 currmovenumber 7
info currmove h2h4 currmovenumber 8
info currmove f2f3 currmovenumber 9
info currmove a2a3 currmovenumber 10
info time 6052 nodes 440000 nps 72703 cpuload 1000
info hashfull 14
info currmove h2h3 currmovenumber 11
info currmove c2c4 currmovenumber 12
info currmove c2c3 currmovenumber 13
info currmove d2d3 currmovenumber 14
info currmove e2e4 currmovenumber 15
info currmove b2b4 currmovenumber 16
info depth 12
info depth 11 seldepth 25 time 7035 nodes 510766 nps 72604
info depth 12
info currmove b1c3 currmovenumber 1
info time 7160 nodes 520000 nps 72626 cpuload 1000
info hashfull 17
info time 8205 nodes 600000 nps 73126 cpuload 1000
info hashfull 19
info time 9391 nodes 700000 nps 74539 cpuload 999
info hashfull 22
info multipv 1 depth 12 seldepth 25 score cp 18 time 10062 nodes 377513 pv b1c3
g8f6 g1f3 d7d5 e2e3 b8c6 f1b5 c8d7 d2d4 a7a6 b5d3 e7e6
info currmove e2e3 currmovenumber 2
info multipv 1 depth 12 seldepth 25 score cp 18 time 10062 nodes 199718 pv b1c3
g8f6 g1f3 d7d5 e2e3 b8c6 f1b5 c8d7 d2d4 a7a6 b5d3 e7e6
info currmove b2b3 currmovenumber 3
info currmove g2g3 currmovenumber 4
info time 10670 nodes 800000 nps 74977 cpuload 1000
info hashfull 26
info currmove g2g4 currmovenumber 5
info currmove a2a4 currmovenumber 6
info currmove f2f4 currmovenumber 7
info currmove h2h4 currmovenumber 8
info currmove f2f3 currmovenumber 9
info currmove a2a3 currmovenumber 10
info currmove h2h3 currmovenumber 11
info currmove c2c4 currmovenumber 12
info time 11902 nodes 880000 nps 73937 cpuload 1000
info hashfull 29
info currmove c2c3 currmovenumber 13
info currmove d2d3 currmovenumber 14
info currmove e2e4 currmovenumber 15
info time 12948 nodes 940000 nps 72598 cpuload 1000
info hashfull 31
info currmove b2b4 currmovenumber 16
info currmove b1a3 currmovenumber 17
info currmove d2d4 currmovenumber 18
stop
info time 17659 nodes 860000 nps 48700 cpuload 1000
info hashfull 37
info depth 12 seldepth 25 score cp 18 time 17659 nodes 860000 pv b1c3 g8f6 g1f3
d7d5 e2e3 b8c6 f1b5 c8d7 d2d4 a7a6 b5d3 e7e6
bestmove b1c3 ponder g8f6
go depth 5
info multipv 1 depth 1 seldepth 1 score cp 6 time 0 nodes 2 pv b1a3
info multipv 1 depth 1 seldepth 1 score cp 34 time 0 nodes 3 pv b1c3
info depth 2
info depth 2
info multipv 1 depth 2 seldepth 2 score cp 20 time 15 nodes 43 pv b1c3 g8f6
info multipv 1 depth 2 seldepth 2 score cp 20 time 15 nodes 22 pv b1c3 g8f6
info depth 3
info depth 2 seldepth 2 time 31 nodes 44 nps 0
info depth 3
info multipv 1 depth 3 seldepth 3 score cp 34 time 46 nodes 127 pv b1c3 g8f6 g1f
3
info multipv 1 depth 3 seldepth 3 score cp 34 time 46 nodes 86 pv b1c3 g8f6 g1f3

info depth 4
info depth 3 seldepth 3 time 62 nodes 172 nps 0
info depth 4
info multipv 1 depth 4 seldepth 8 score cp 20 time 93 nodes 472 pv b1c3 g8f6 g1f
3 b8c6
info depth 5
info multipv 1 depth 4 seldepth 8 score cp 20 time 124 nodes 555 pv b1c3 g8f6 g1
f3 b8c6
info depth 4 seldepth 8 time 124 nodes 1110 nps 0
info depth 5
info multipv 1 depth 5 seldepth 10 score cp 26 time 140 nodes 1333 pv b1c3 g8f6
g1f3 d7d5 d2d4
info depth 6
info multipv 1 depth 5 seldepth 10 score cp 26 time 156 nodes 1372 pv b1c3 g8f6
g1f3 d7d5 d2d4
info depth 5 seldepth 10 time 171 nodes 2744 nps 0
info multipv 1 depth 6 seldepth 13 score cp 20 time 218 nodes 3614 pv b1c3 g8f6
g1f3 d7d5 d2d4 b8c6
info time 234 nodes 5390 nps 0 cpuload 940
info hashfull 0
bestmove b1c3 ponder g8f6
=======================================

The above is from DeepLearninToga 1.5.16

So the bug is not in my version.
Musta fixed somthin a long time ago.



Bill
WHMoweryJr
 
Posts: 597
Joined: Fri Apr 11, 2008 7:32 pm
Location: Ellenton FL


Return to Public

Who is online

Users browsing this forum: No registered users and 1 guest

cron