Designing an analysis friendly Stockfish?
Re: Designing an analysis friendly Stockfish?
I agree that the assert should fail when the score is between alpha and beta. My opinion is that the assert is unnecessary. It is merely saying (for the previous code) that the last move considered is the one that caused the fail-high. But now that doesn't need to be the case anymore.
Re: Designing an analysis friendly Stockfish?
If you ignore the assert you will count the successfull move also as a failure. Maybe it is better to do it this way.BB+ wrote:I agree that the assert should fail when the score is between alpha and beta. My opinion is that the assert is unnecessary. It is merely saying (for the previous code) that the last move considered is the one that caused the fail-high. But now that doesn't need to be the case anymore.
Code: Select all
void update_history(const Position& pos, Move move, Depth depth,
Move movesSearched[], int moveCount) {
Move m;
H.success(pos.piece_on(move_from(move)), move_to(move), depth);
for (int i = 0; i < moveCount - 1; i++)
{
m = movesSearched[i];
if (m != move && !pos.move_is_capture_or_promotion(m))
H.failure(pos.piece_on(move_from(m)), move_to(m), depth);
}
}
-
- Site Admin
- Posts: 1226
- Joined: Wed Jun 09, 2010 7:49 am
- Real Name: Jeremy Bernstein
- Location: Berlin, Germany
- Contact:
Re: Designing an analysis friendly Stockfish?
New builds with the above change, and re-introducing most of Peter's changes for the last GTB he submitted, but with ProbeOnlyAtRoot turned back off by default, since I find it confusing that the TBs more or less stop working when it's turned on attached. Test away!fruity wrote:If you ignore the assert you will count the successfull move also as a failure. Maybe it is better to do it this way.BB+ wrote:I agree that the assert should fail when the score is between alpha and beta. My opinion is that the assert is unnecessary. It is merely saying (for the previous code) that the last move considered is the one that caused the fail-high. But now that doesn't need to be the case anymore.But this would be a functional change and therefore should be tested with real games again.Code: Select all
void update_history(const Position& pos, Move move, Depth depth, Move movesSearched[], int moveCount) { Move m; H.success(pos.piece_on(move_from(move)), move_to(move), depth); for (int i = 0; i < moveCount - 1; i++) { m = movesSearched[i]; if (m != move && !pos.move_is_capture_or_promotion(m)) H.failure(pos.piece_on(move_from(m)), move_to(m), depth); } }
- Attachments
-
- Stockfish_PA_I_GTBc.7z
- (543.66 KiB) Downloaded 221 times
Re: Designing an analysis friendly Stockfish?
The change should be totally harmless apart for a slightly slow down in the common case of !PvNode where the test is not needed.fruity wrote: But this would be a functional change and therefore should be tested with real games again.
Anyhow for the real nitpicker among you, I can even add that the assert is not correct yes, it never fires in the original code, but it is wrong to assume that the last move is the one that produced the cut-off in the general case. This is corrcet in case of single thread but in case of multi-thread we could have a ss->bestMove originated by a slave thread sub-search so that in that case all the movesSearched[] array (that is populated only by the split node master thread), contains moves different from the cut-off move.
Anyhow this is just an academic digression because real effect is harmless anyway.....
P.S: Interesting to see all you people toying around SF sources, it is a good sign and a pleasure for us, SF developers, too see. It means that SF sources are fun to hack on, as we aim to.
Re: Designing an analysis friendly Stockfish?
select() is a system call. The only buffers it looks at are the kernel buffers, so any userspace buffering needs to be disabled. If anything, I'd guess that the C++ version should be used, in case there are separate buffers in the C/C++ IO libraries (I don't really know much about C++ IO, and I'd prefer to keep it that way). Since Fruit uses the C fgets(), then it should be using setbuf().BB+ wrote:The other thing you might want to do is change how the buffering is set in main.cpp -- see an exchange I had with Marco Costalba about it. I think the fix is to replaceby (used by Fruit, for instance)Code: Select all
cout.rdbuf()->pubsetbuf(NULL, 0); cin.rdbuf()->pubsetbuf(NULL, 0);
The reason for this seems to be that "select" is used, and this is (presumably) a C function, and so the C methods to set buffers should also be used, rather than those of C++. But I really don't know the underlying specifics.Code: Select all
setvbuf(stdin,NULL,_IONBF,0); setvbuf(stdout,NULL,_IONBF,0);
Re: Designing an analysis friendly Stockfish?
Slightly, uneccessary slow down in the common non-PV case, but also a functional change in the PV case, where the original code makes a noop on the successfull move, first H.success(), then H.failure(). Anyhow first tests indicate it is better to throw away the assert and leave the update_history() function otherwise as it is.mcostalba wrote:The change should be totally harmless apart for a slightly slow down in the common case of !PvNode where the test is not needed.fruity wrote: But this would be a functional change and therefore should be tested with real games again.
-
- Site Admin
- Posts: 1226
- Joined: Wed Jun 09, 2010 7:49 am
- Real Name: Jeremy Bernstein
- Location: Berlin, Germany
- Contact:
Re: Designing an analysis friendly Stockfish?
Engine Score SFSFSFSpSFSt S-B SF Release 64 4,5/5 · 1 1 = 1 1 9,50 SF PGO 64 3,0/5 0 · = 1 = 1 5,25 SF Release 32 2,5/5 0 = · = = 1 4,50 Spike1.4 2,0/5 = 0 = · = = 5,00 SF PGO 32 2,0/5 0 = = = · = 4,25 Stockfish-201-64-ja 1,0/5 0 0 0 = = · 2,00 15 of 300 games played
Re: Designing an analysis friendly Stockfish?
Note: It's about twice as fast with it on.Jeremy Bernstein wrote:New builds with the above change, and re-introducing most of Peter's changes for the last GTB he submitted, but with ProbeOnlyAtRoot turned back off by default, since I find it confusing that the TBs more or less stop working when it's turned on attached. Test away!
I guess this is the analysis Stockfish though, and it's behavior is much more intuitive with it on.
Peter
Re: Designing an analysis friendly Stockfish?
Peter C wrote:Note: It's about twice as fast with it on.Jeremy Bernstein wrote:New builds with the above change, and re-introducing most of Peter's changes for the last GTB he submitted, but with ProbeOnlyAtRoot turned back off by default, since I find it confusing that the TBs more or less stop working when it's turned on attached. Test away!
I guess this is the analysis Stockfish though, and it's behavior is much more intuitive with it on.
Peter
I mean off.I guess this is the analysis Stockfish though, and it's behavior is much more intuitive with it on.
Whoops. Can't believe I didn't notice that till now.
Peter
Re: Designing an analysis friendly Stockfish?
Jeremy, you might want to add Makefiles to the GitHub repo so that us non-VS users can build it.
I attached the files included with the GTB library and the file I use for compiling Stockfish PA GTB (which is only slightly different from the standard SF makefile).
Peter
I attached the files included with the GTB library and the file I use for compiling Stockfish PA GTB (which is only slightly different from the standard SF makefile).
Peter
- Attachments
-
- makefiles.zip
- (4.38 KiB) Downloaded 158 times