Thanks Jim for you good service to us.
Gerald Grimsley
Stockfish v2.1 now available
Moderator: Ras
-
- Posts: 149
- Joined: Thu Nov 19, 2009 4:58 pm
- Location: College Station, Texas
-
- Posts: 2053
- Joined: Wed Mar 08, 2006 8:30 pm
Re: Stockfish v2.1 now available
Thanks Jim!Jim Ablett wrote:Here is re-compile which will show correct searched nodes.
Now on my Intel Core2 Duo, I get indeed the same infinite analysis.
...and here, the Intel compile is 6% faster than the Msvc compile!

Intel compiler
info depth 21 seldepth 32 multipv 1 score cp 20 nodes 32817584 nps 821713 time 3
9938 pv e2e4 e7e6 g1f3 d7d5 b1c3 g8f6 e4d5 e6d5 d2d4 f8d6 f1d3 e8g8 e1g1 b8c6 c1
g5 c6b4 c3b5 c8g4 f1e1 h7h6 b5d6 d8d6
info depth 22
Msvc compiler
info depth 21 seldepth 32 multipv 1 score cp 20 nodes 32817584 nps 775884 time 4
2297 pv e2e4 e7e6 g1f3 d7d5 b1c3 g8f6 e4d5 e6d5 d2d4 f8d6 f1d3 e8g8 e1g1 b8c6 c1
g5 c6b4 c3b5 c8g4 f1e1 h7h6 b5d6 d8d6
info depth 22
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: Stockfish v2.1 now available
The limit of elegance is correctnessmcostalba wrote:The problem is here, in book.h file:This line recurively reads from the book file a number of chars specified by <int n>.Code: Select all
template<int n> inline uint64_t Book::get_int() { return 256 * get_int<n-1>() + get(); }
For this to work it is critical that the recursive function get_int<n-1>() is called _before_ reading the next character through calling get().
[...]
I would assume this bug is mine, not of MSVC because C++ standard does not seem to guarantee the order of evaluation of a term in a sum expression, so that we have to rewrite the code in a way to enforce the ordering, one quick hack (that works with MSVC) is to substitute the above line with:so that 'v' is evaluated before get(), but I don't like it a lot and probably I will find something less tricky....Code: Select all
template<int n> inline uint64_t Book::get_int() { uint64_t v = 256 * get_int<n-1>(); return v + get(); }

What about this? It is a lot less "tricky", comes without the ugly cast from uint64_t to the concrete type, avoids the special case get_int<1>(), shows the order of operation at runtime, keeps the elegance of the operator>> usage in Book::read_entry(), and should generate about the same code as the "tricky" one, after unrolling the loop ...
Code: Select all
template<typename T>
inline void Book::get_int(T& v) {
v = bookFile.get();
for (int i = 2; i <= sizeof(T); i++) {
v = 256 * v + bookFile.get();
}
}
template<typename T>
inline Book& Book::operator>>(T& n) { get_int(n); return *this; }
-
- Posts: 4186
- Joined: Tue Mar 14, 2006 11:34 am
- Location: Ethiopia
Re: Stockfish v2.1 now available
Best use of template meta-programming I have encounted so far is with tensor operations. One template class is enough for all tensor dimensions and single/double precision unlike its fortran counterpars. And all are optimized at compile time by loop unrolling using that method. Another nice use is for operator overloading on two big matrices. To get the c++ equivalent with templates of the following code, some nifty tricks are used to avoid storing a 'copy' of one of the matrices and produce code as efficient as this straightforward method.
equivalent
not
Code: Select all
for(int i = 0;i < N;i++)
for(int j = 0;j < M;j++)
C[i][j] = A[i][j] + B[i][j]
Code: Select all
C = A + B;
Code: Select all
C = A;
C += B;
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: Stockfish v2.1 now available
Incidentally I have already committed something very similar to your approach, here is current code:Sven Schüle wrote: What about this?
Code: Select all
template<typename T>
void Book::get_number(T& n) {
n = 0;
for (size_t i = 0; i < sizeof(T); i++)
n = (n << 8) + (T)bookFile.get();
}
-
- Posts: 76
- Joined: Wed Nov 03, 2010 5:56 pm
Re: Stockfish v2.1 now available
is it just me or is anybody else seeing many losses on time with this release??
the geeks shall inherit the earth
-
- Posts: 10121
- Joined: Thu Mar 09, 2006 12:57 am
- Location: van buren,missouri
Re: Stockfish v2.1 now available
Using win. 32 in Arena. 5/3 tc over 500 games. No time lost here.poisonedpawn wrote:is it just me or is anybody else seeing many losses on time with this release??
-
- Posts: 554
- Joined: Thu Apr 24, 2008 9:31 am
- Location: Belgium
Re: Stockfish v2.1 now available
No darren..after 250 games no single time loose (yet) seen.
Stockfish 2.1 do it very well on my system..great work Stockfish Team!
JP.
Stockfish 2.1 do it very well on my system..great work Stockfish Team!
JP.
-
- Posts: 566
- Joined: Thu Mar 09, 2006 12:53 am
Re: Stockfish v2.1 now available
Another data point ...poisonedpawn wrote:is it just me or is anybody else seeing many losses on time with this release??
I've run 200 games with SF-2.1 32-bit in Arena (under Wine on Linux) with no time losses.
-
- Posts: 76
- Joined: Wed Nov 03, 2010 5:56 pm
Re: Stockfish v2.1 now available
maybe it is a fritz GUI issue then. i never use arena. i had no probs with time losses at all with 2.01 only with 2.1. strange...
the geeks shall inherit the earth