Author: Sune Fischer
Date: 12:07:35 05/17/03
Go up one level in this thread
On May 17, 2003 at 14:13:48, Dieter Buerssner wrote:
>On May 17, 2003 at 13:36:02, Ulrich Tuerke wrote:
>
>>On May 17, 2003 at 11:50:26, Jouni Uski wrote:
>>
>>>It's not nice, when NPS counter goes after only one hour to zero with fast PC:-)
>
>Indeed. When I started, I had a 386SX and an Atari ST. I was happy, when I saw
>1000 nodes/s. I just did not imagine, how fast it would be, to hit 2^32 nodes.
>
>>>I noticed, that Fritz, Shredder and Crafty (Chessbase) have 64b node counter!
>>>But at least Ruffian and Yace don't support? Why? Is there may limit in UCI
>>>specification?
>
>No, to my knowledge there is no (practical) limit in the UCI specification for
>this.
>
>>It depends on the Compiler. Not all C-compiler implementations support 64 bit
>>integer types. Microsoft C for instance does. Furthermore the corresponding
>>types - if supported at all - are not standardized. Some compilers call them
>>"__int64" and others "long long". If an author has code which is used for
>>various platforms with differing compilers, then it's a bit of a mess.
>
>Even more of a problem is printing the nodes for a C-program, IMHO. Typedefing a
>counter type would be not too much mess compared to that. But all the printf
>format strings must be changed. I have lots of those (most are only in debugging
>code, but all would need to be changed). It can of course be done, but it is
>quite a bit of work. Standard C has (unsigned) long long now (since the new
>C-Standard from 1999). The format specifier is %lld/%llu. MSCV to my knowledge
>does not support it yet. You need %I64u, or something like this. So it is not a
>matter, of only changing one character in each format-string. One needs some
>#defines, too. It would need quite some reformating. For example
>instead of
>
> printf("%2d %10lu %s\n", depth, nodes, pv);
You can try
printf("%2d %.0f %s\n", depth, (double)nodes, pv);
Should be just fine for simple node counters?
> printf("%2d %15" COUNTER_TYPE_SPECIFIER " %s\n", depth, nodes, pv);
>
>
>Or another level of indirection, by some format_counter_type routine (with
>possible many parameters, like the counter, a buffer, some alignment flags,
>length) for example.
>
>Here, C++ programs seem to have a clear advantage, when they use the I/O methods
>of the library.
>
>BTW. I started to change for one counter as an experiment (the normal node
>counter), and used unsigned long long and double. The funny result: with both
>methods, the program ran reproducably 0.5% faster ...
>
>Double may sound a bit fuzzy for a node counter. But all slighty current
>computers have IEEE compatible floating point. This guarantees, that it will
>work well until 2^54 (all smaller integers are exactly represantable as a
>floating point number. Also addition and subtraction of integers will allways
>yield the exact result in this range). Until we hit that number, some time will
>be needed.
>
>Regards,
>Dieter
I think this problem is soon to be extinct with the new 64 bit chips comming,
but one solution for now might be to use two counters.
One 32 bit to increment at every node, and one double that keeps the total
count.
You can flush the 32 bit counter once and a while, e.g. when you check for
timeout or something.
totalnodes += (double)nodes;
nodes = 0;
-S.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.