magic bitboard perft
Moderator: Ras
-
- Posts: 1872
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: magic bitboard perft
Without bulk counting, nor hash, mperft runs perft 7 in 101 secondes with make it in the same speed category as what is discuss on the other thread (http://talkchess.com/forum3/viewtopic.p ... 20#p838238)
-
- Posts: 1784
- Joined: Wed Jul 03, 2019 4:42 pm
- Location: Netherlands
- Full name: Marcel Vanthoor
Re: magic bitboard perft
That doesn't seem to be especially fast. At this point, Rustic runs perft 7 at 88-90 seconds (at a speed of 35.6 million leaves/s on average; 88 seconds for the GNU toolchain compile, 90 seconds for the MSVC toolchain) on a i7-6700K, without bulk counting, without hash, but WITH incremental updates of Zobrist key, piece list, and material count.xr_a_y wrote: ↑Sat Apr 11, 2020 9:25 pm Without bulk counting, nor hash, mperft runs perft 7 in 101 secondes with make it in the same speed category as what is discuss on the other thread (http://talkchess.com/forum3/viewtopic.p ... 20#p838238)
I think I'm going to do as I said; copy Rustic to a new repository and strip everything regarding piece lists and material from it. (Actually, I'll remove everything that's not strictly necessary for perft, and create my own perft tool.) I'll keep the Zobrist hash so I can add the hash table back in. Then I'll be able to compare "RPerft", "MPerft" and "QPerft" on the same system.
-
- Posts: 181
- Joined: Sun Dec 08, 2019 8:16 pm
- Full name: Dmitry Shechtman
Re: magic bitboard perft
If you're measuring pure perft performance, you might also add "pperft" to that list, a parallelised version of my implementation. The result is still about 1M leaves off, but it does 12 seconds (without hashing or bulk counting) on my hyperthreaded laptop.
-
- Posts: 56
- Joined: Wed Oct 29, 2008 1:06 pm
- Full name: Marc Paule
Re: magic bitboard perft
Hi,
a good example without Hash is xiphos code:
if you want the best perft try xiphos or cfish.
xiphos perft 6 = 119060324 for 1176ms nps 101155755 and perft 7 in 30 seconds.
cfish perft 6 = 119060324 for 2128ms nps 55949400
may be sungorus is better to or near xiphos but there is no perft function.
under linux material teclast f6 intel apollo lake processor 2.2ghz
Regards
Naltap
a good example without Hash is xiphos code:
if you want the best perft try xiphos or cfish.
xiphos perft 6 = 119060324 for 1176ms nps 101155755 and perft 7 in 30 seconds.
cfish perft 6 = 119060324 for 2128ms nps 55949400
may be sungorus is better to or near xiphos but there is no perft function.
under linux material teclast f6 intel apollo lake processor 2.2ghz
Regards
Naltap
-
- Posts: 181
- Joined: Sun Dec 08, 2019 8:16 pm
- Full name: Dmitry Shechtman
Re: magic bitboard perft
How can cfish be the best with these timings? Even my broken single-threaded perft does 80000000 nps.
-
- Posts: 476
- Joined: Fri Dec 16, 2016 11:04 am
- Location: France
- Full name: Richard Delorme
Re: magic bitboard perft
Please, use the makefile. You missed a few optimizations (popcount, gcc intrinsics, etc.)
Richard Delorme
-
- Posts: 181
- Joined: Sun Dec 08, 2019 8:16 pm
- Full name: Dmitry Shechtman
Re: magic bitboard perft
@abulmo2 Very impressive implementation, clean and readable code.
Now, I'm trying to add parallelism. As a first step I just copied the div loop from main() and pasted it into a function as follows:
Calling it instead of perft() works fine, but only as long as there is no hashing. As soon as I run it with hashing enabled, the results are all wrong starting at perft(4). Could you please tell me why?
Now, I'm trying to add parallelism. As a first step I just copied the div loop from main() and pasted it into a function as follows:
Code: Select all
uint64_t pperft(Board *board, HashTable *hashtable, int depth, bool bulk, bool capture) {
Move move;
MoveArray ma[1];
unsigned long long count, total = 0;
movearray_generate(ma, board, !capture);
while ((move = movearray_next(ma)) != 0) {
board_update(board, move);
count = depth <= 1 ? 1 : perft(board, hashtable, depth - 1, bulk, !capture);
total += count;
board_restore(board, move);
}
return total;
}
-
- Posts: 56
- Joined: Wed Oct 29, 2008 1:06 pm
- Full name: Marc Paule
Re: magic bitboard perft
With Mperft i have
Magic Perft (c) version 1.0 Richard Delorme - 2020
Bitboard move generation based on magic bitboards
Perft setting: no hashing; no bulk counting;
a b c d e f g h
8 r n b q k b n r 8
7 p p p p p p p p 7
6 . . . . . . . . 6
5 . . . . . . . . 5
4 . . . . . . . . 4
3 . . . . . . . . 3
2 P P P P P P P P 2
1 R N B Q K B N R 1
a b c d e f g h
w, KQkq
perft 1
perft 6 : 119060324 leaves in 8.813 s 13509858 leaves/s
@leanchess: @ second perft 6 is not so bad on my configuration:
techlast f7 with
CPU Clock speed – Quad Core 1.1GHz up to 2.2GHz CPU clock
Chipset – Intel Celeron N3450, 64-bit Processor
Magic Perft (c) version 1.0 Richard Delorme - 2020
Bitboard move generation based on magic bitboards
Perft setting: no hashing; no bulk counting;
a b c d e f g h
8 r n b q k b n r 8
7 p p p p p p p p 7
6 . . . . . . . . 6
5 . . . . . . . . 5
4 . . . . . . . . 4
3 . . . . . . . . 3
2 P P P P P P P P 2
1 R N B Q K B N R 1
a b c d e f g h
w, KQkq
perft 1
perft 6 : 119060324 leaves in 8.813 s 13509858 leaves/s
@leanchess: @ second perft 6 is not so bad on my configuration:
techlast f7 with
CPU Clock speed – Quad Core 1.1GHz up to 2.2GHz CPU clock
Chipset – Intel Celeron N3450, 64-bit Processor
-
- Posts: 476
- Joined: Fri Dec 16, 2016 11:04 am
- Location: France
- Full name: Richard Delorme
Re: magic bitboard perft
I do not claim to have the fastest implementation. gperft by Paul Byrne is faster, for example.
Richard Delorme
-
- Posts: 56
- Joined: Wed Oct 29, 2008 1:06 pm
- Full name: Marc Paule
Re: magic bitboard perft
Yes i have done comparaison just to compare, sorry if this is take for other things.
i don't found gperft for linux on google, if you have a link i will take it
Thanks
i don't found gperft for linux on google, if you have a link i will take it
Thanks