Syzygy bases from memory
Moderators: hgm, Rebel, chrisw
-
- Posts: 7005
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Syzygy bases from memory
I want to fix some holes in my static KPvK evaluation from the 80's. It catches most (80-90%) of the winning positions but not all. Installing the Syzygy bases is of course the most simple solution but it is slow because it runs from HD. The question is if it can run from memory and if loading "KPvK.rtbw" and "KPvK.rtbz" at program start is sufficient.
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 1784
- Joined: Wed Jul 03, 2019 4:42 pm
- Location: Netherlands
- Full name: Marcel Vanthoor
Re: Syzygy bases from memory
You could create a RAM-drive. When the computer starts, you create the RAM-drive. Hook up a batch file in the Windows Scheduler (with a delayed start) to unzip a ZIP-file containing the TB's onto the RAM-drive. Even on my 5 year old computer, unzipping the TB's on an SSD (also 5 years old) takes less than 10 seconds. So it'll slow down your computer's boot sequence with about 10 seconds and it'll take 1 GB of RAM.Rebel wrote: ↑Wed Jun 16, 2021 11:22 am I want to fix some holes in my static KPvK evaluation from the 80's. It catches most (80-90%) of the winning positions but not all. Installing the Syzygy bases is of course the most simple solution but it is slow because it runs from HD. The question is if it can run from memory and if loading "KPvK.rtbw" and "KPvK.rtbz" at program start is sufficient.
(If I really wanted my TB's in memory, both wouldn't be an issue for me, because this system has 32GB RAM and boots in under a minute as it is now. The most time-consuming part of the process is actually booting the UEFI and having it run its checks.)
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: Syzygy bases from memory
Why not build just the exact KPK table on the fly ?
http://talkchess.com/forum3/viewtopic.p ... 57#p511740
Done in Minic here for instance : https://github.com/tryingsomestuff/Mini ... ce/kpk.hpp and https://github.com/tryingsomestuff/Mini ... ce/kpk.cpp
http://talkchess.com/forum3/viewtopic.p ... 57#p511740
Done in Minic here for instance : https://github.com/tryingsomestuff/Mini ... ce/kpk.hpp and https://github.com/tryingsomestuff/Mini ... ce/kpk.cpp
-
- Posts: 7005
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: Syzygy bases from memory
That's an elegant solution.mvanthoor wrote: ↑Wed Jun 16, 2021 11:35 amYou could create a RAM-drive. When the computer starts, you create the RAM-drive. Hook up a batch file in the Windows Scheduler (with a delayed start) to unzip a ZIP-file containing the TB's onto the RAM-drive. Even on my 5 year old computer, unzipping the TB's on an SSD (also 5 years old) takes less than 10 seconds. So it'll slow down your computer's boot sequence with about 10 seconds and it'll take 1 GB of RAM.Rebel wrote: ↑Wed Jun 16, 2021 11:22 am I want to fix some holes in my static KPvK evaluation from the 80's. It catches most (80-90%) of the winning positions but not all. Installing the Syzygy bases is of course the most simple solution but it is slow because it runs from HD. The question is if it can run from memory and if loading "KPvK.rtbw" and "KPvK.rtbz" at program start is sufficient.
(If I really wanted my TB's in memory, both wouldn't be an issue for me, because this system has 32GB RAM and boots in under a minute as it is now. The most time-consuming part of the process is actually booting the UEFI and having it run its checks.)
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 7005
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: Syzygy bases from memory
I wonder how accurate your KPK table is, 100%?xr_a_y wrote: ↑Wed Jun 16, 2021 11:55 am Why not build just the exact KPK table on the fly ?
http://talkchess.com/forum3/viewtopic.p ... 57#p511740
Done in Minic here for instance : https://github.com/tryingsomestuff/Mini ... ce/kpk.hpp and https://github.com/tryingsomestuff/Mini ... ce/kpk.cpp
Same for HGM's code.
I am asking (in general) because in the past I have tried KPK C-code from others and there were too many errors.
Also there are the bitbases, for instance in use by slowchess, how accurate are they?
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: Syzygy bases from memory
The thing in Minic should be 100%.Rebel wrote: ↑Wed Jun 16, 2021 1:37 pmI wonder how accurate your KPK table is, 100%?xr_a_y wrote: ↑Wed Jun 16, 2021 11:55 am Why not build just the exact KPK table on the fly ?
http://talkchess.com/forum3/viewtopic.p ... 57#p511740
Done in Minic here for instance : https://github.com/tryingsomestuff/Mini ... ce/kpk.hpp and https://github.com/tryingsomestuff/Mini ... ce/kpk.cpp
Same for HGM's code.
I am asking (in general) because in the past I have tried KPK C-code from others and there were too many errors.
Also there are the bitbases, for instance in use by slowchess, how accurate are they?
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: Syzygy bases from memory
You could also take a look at Marcel van Kervinck's KPK EGT generator, as far as I know it should be pretty accurate.
https://github.com/kervinck/pfkpk
https://github.com/kervinck/pfkpk
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Syzygy bases from memory
feel free to use mine, Ed. you can grab the table (kpkTable.h) and the probing code in kpk.cpp
my generator code is probably a bit complicated, but I can tell you that the accuracy is 100%
something a bit odd is that I mirror around the pawn, not around the king which is more common
the table is around 25kb in memory, precomputed table cost exactly nothing at program startup (generating kpk is very fast though)
https://www.github.com/kmar/cheng4
my generator code is probably a bit complicated, but I can tell you that the accuracy is 100%
something a bit odd is that I mirror around the pawn, not around the king which is more common
the table is around 25kb in memory, precomputed table cost exactly nothing at program startup (generating kpk is very fast though)
https://www.github.com/kmar/cheng4
-
- Posts: 1784
- Joined: Wed Jul 03, 2019 4:42 pm
- Location: Netherlands
- Full name: Marcel Vanthoor
Re: Syzygy bases from memory
Also, you don't need _all_ the tablebases; if you just want the KP-K tablebases, you could attach those files to the executable and then probe them using a library such as Fathom or Phyrric. (I couldn't tell you how this works in C or C++; never did it. I know Rust can do it, though.)
-
- Posts: 7005
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: Syzygy bases from memory
Another syzygy question, is there a tool that can create all epd positions from a syzygy file?
For instance, It would be nice to have all winning positions from KRKN or KRKB endings, or the draws of KRKP endings, they are not too many.
Generating KRKP myself (for white & black) resulted in 36 million epd's but only 4.8 million are draws, would be nice to have in my (your) eval, not from slow disc but from fast memory.
For instance, It would be nice to have all winning positions from KRKN or KRKB endings, or the draws of KRKP endings, they are not too many.
Generating KRKP myself (for white & black) resulted in 36 million epd's but only 4.8 million are draws, would be nice to have in my (your) eval, not from slow disc but from fast memory.
90% of coding is debugging, the other 10% is writing bugs.