Carnivor, another unheard of chess engine!

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
hgm
Posts: 28384
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Carnivor, another unheard of chess engine!

Post by hgm »

Michael Sherwin wrote:I am not sure that the 3400+ which, is determined by benchmarks, extends well to chess programming. However, your numbers are also very impressive! I think that I have downloaded your special perft code, so I will take a look at it.
Note that the qperft.c that is posted on my website does NOT make/unmake the final ply (except for King moves, to test legality) and does not even count the moves one by one, but just computes the total from the size of the move stack.

I now also posted the version used above, that counts the moves one by one after having made them, (and tested them for legality where needed), so that it really can determine on a move by move basis which moves are captures, promotions etc.

They use the same move generator. (Which was later incorporated into Joker.)

Actually, I think that the perfting using the 'perft trick' is more relevant for the performance of a chess engine, as chess engines usually do not make and unmake the last move if they don't also generate moves in the position they lead to. If a stand-pat was possible, futility pruning usually takes care of it before the move is made. So perfts that make and unmake the last ply put way to much emphasis on the speed of make/unmake, compared to the move generation itself.

Removing the move-type counting, only counting totals, (but still on a move by move basis), reduces the perft(7) time from 199 sec to 125 sec! (Yes, there are difficult-to-predict if-statements there, to figure out which moves are captures, promotions, etc. That hurts on a P4.)

With the bulk-counting trick, perft(7) takes only 52 sec. (This can only calculate totals.) This was the code you saw before. Now I just used an earlier version.

Code: Select all

$ ./qperft 7
 - - - - - - - - - - - -
 - - - - - - - - - - - -
 - - r n b q k b n r - -
 - - p p p p p p p p - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - P P P P P P P P - -
 - - R N B Q K B N R - -
 - - - - - - - - - - - -
 - - - - - - - - - - - -

Quick Perft by H.G. Muller
Perft mode: No hashing, bulk counting in horizon nodes

perft(1)=                  20 ( 0.000 sec)

perft(2)=                 400 ( 0.000 sec)

perft(3)=                8902 ( 0.000 sec)

perft(4)=              197281 ( 0.000 sec)

perft(5)=             4865609 ( 0.078 sec)

perft(6)=           119060324 ( 2.047 sec)

perft(7)=          3195901860 (52.703 sec)
Last edited by hgm on Tue Jun 26, 2007 6:54 pm, edited 2 times in total.
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Carnivor, another unheard of chess engine!

Post by Michael Sherwin »

hgm wrote:
Michael Sherwin wrote:I am not sure that the 3400+ which, is determined by benchmarks, extends well to chess programming. However, your numbers are also very impressive! I think that I have downloaded your special perft code, so I will take a look at it.
Note that the qperft.c that is posted on my website does NOT make/unmake the final ply (except for King moves, to test legality) and does not even count the moves one by one, but just computes the total from the size of the move stack.

I now also posted the version used above, that counts the moves one by one after having made them, (and tested them for legality where needed), so that it really can determine on a move by move basis which moves are captures, promotions etc.

They use the same move generator. (Which was later incorporated into Joker.)

Actually, I think that the perfting using the 'perft trick' is more relevant for the performance of a chess engine, as chess engines usually do not make and unmake the last move if they don't also generate moves in the position they lead to. If a stand-pat was possible, futility pruning usually takes care of it before the move is made. So perfts that make and unmake the last ply put way to much emphasis on the speed of make/unmake, compared to the move generation itself.

Removing the move-type counting, only counting totals, (but still on a move by move basis), reduces the perft(7) time from 199 sec to 125 sec! (Yes, there are difficult-to-predict if-statements there, to figure out which moves are captures, promotions, etc. That hurts on a P4.)

With the bulk-counting trick, perft(7) takes only 52 sec. (This can only calcualte totals.) This was the code you saw before. Now I just used an earlier version.

Code: Select all

$ ./qperft 7
 - - - - - - - - - - - -
 - - - - - - - - - - - -
 - - r n b q k b n r - -
 - - p p p p p p p p - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - P P P P P P P P - -
 - - R N B Q K B N R - -
 - - - - - - - - - - - -
 - - - - - - - - - - - -

Quick Perft by H.G. Muller
Perft mode: No hashing, bulk counting in horizon nodes

perft(1)=                  20 ( 0.000 sec)

perft(2)=                 400 ( 0.000 sec)

perft(3)=                8902 ( 0.000 sec)

perft(4)=              197281 ( 0.000 sec)

perft(5)=             4865609 ( 0.078 sec)

perft(6)=           119060324 ( 2.047 sec)

perft(7)=          3195901860 (52.703 sec)
Hi HG,

Thanks! :D

Please ignore my previous post. :oops:

No hard feelings! :D :D :D

Mike
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
User avatar
hgm
Posts: 28384
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Carnivor, another unheard of chess engine!

Post by hgm »

No hard feelings! In fact our posts crossed.

Perhaps you could try my perft on your machine for fairer comparison. :roll:
kwlakey

Re: Carnivor, another unheard of chess engine!

Post by kwlakey »

I would like a copy. kwlakey@verizon.net

Regards,

Kerry
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Carnivor, another unheard of chess engine!

Post by Michael Sherwin »

hgm wrote:No hard feelings! In fact our posts crossed.

Perhaps you could try my perft on your machine for fairer comparison. :roll:
Will do! :D
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
kwlakey

Re: Carnivor, another unheard of chess engine!

Post by kwlakey »

How do you get the data below?

Halfwit

White1> perft 6
Nodes = 125039194, msec. = 17439, nps = 7170089.34

Carnivor

White1> bench 6
nodes=125049325 time=10458
nodes/sec = 11957288

Conundrum

White 1 > perft 6
Nodes = 125049325, msec. = 10505, nps = 11903790.92

What does 'perft' mean?

What does 'bench' mean?

Regards,

Kerry
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Carnivor, another unheard of chess engine!

Post by Michael Sherwin »

kwlakey wrote:How do you get the data below?

Halfwit

White1> perft 6
Nodes = 125039194, msec. = 17439, nps = 7170089.34

Carnivor

White1> bench 6
nodes=125049325 time=10458
nodes/sec = 11957288

Conundrum

White 1 > perft 6
Nodes = 125049325, msec. = 10505, nps = 11903790.92

What does 'perft' mean?

What does 'bench' mean?

Regards,

Kerry
Hi Kerry,

I first saw bench in TSCP a chess program by Tom Kerrigan. It measured the node rate (moves per second) of the program.

So Carnivor and Godzilla use the bench command.

In my code, bench 5 means: generate and make/unmake all moves to a depth of 5.

Later I saw perft (performance test in Crafty by Prof. Robert Hyatt, and it reported the number of nodes (moves) and then gave the time that it took.

In my code, perft 5 means: generate and make/unmake all moves to a depth of 5.

...

Divide msec (milli-seconds) by 1000 to get the time in seconds.
nps = Nodes (moves) per second.

Best,
Mike
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
User avatar
hgm
Posts: 28384
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Carnivor, another unheard of chess engine!

Post by hgm »

Core 2 Duo, 2.4 GHz results: 84 sec.

Pentium 4, 2.8 GHz was 199 sec.

Code: Select all

$ ./sperft 7
 - - - - - - - - - - - -
 - - - - - - - - - - - -
 - - R N B Q K B N R - -
 - - P P P P P P P P - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - p p p p p p p p - -
 - - r n b q k b n r - -
 - - - - - - - - - - - -
 - - - - - - - - - - - -

Slow Perft by H.G. Muller
Perft mode: No hashing, make/unmake last ply

perft(1)=        20, x=         0, ep=     0, Q=     0, OO=     0 ( 0.000 sec)

perft(2)=       400, x=         0, ep=     0, Q=     0, OO=     0 ( 0.000 sec)

perft(3)=      8902, x=        34, ep=     0, Q=     0, OO=     0 ( 0.000 sec)

perft(4)=    197281, x=      1576, ep=     0, Q=     0, OO=     0 ( 0.000 sec)

perft(5)=   4865609, x=     82719, ep=   258, Q=     0, OO=     0 ( 0.125 sec)

perft(6)= 119060324, x=   2812008, ep=  5248, Q=     0, OO=     0 ( 3.167 sec)

perft(7)=3195901860, x= 108329926, ep=319617, Q=     0, OO=883453 (84.505 sec)
This is not a fair comparison, though, as most of the gain seems to come from the counting of captures, promotions etc.

If I delete the counting code, making/unmaking the moves, but no count specification, (the case most comparable to what Michael does), there is now is only little speedup, as the Core-2-Duo time goes down to 77 sec. On the P4 this was 125 sec. The speedup clock for clock is thus 1.9.
kwlakey

Re: Carnivor, another unheard of chess engine!

Post by kwlakey »

Hello there.

When you say code are you refrering to C? Also does this happen to have something to do with programing? I am not a programer. That is why I ask.

Regards,

Kerry
User avatar
hgm
Posts: 28384
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Carnivor, another unheard of chess engine!

Post by hgm »

code = computer program

Can be C, any other high-level language, or assembler.