Crafty 24.0

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: MAX_DRAFT

Post by bob »

Cardoso wrote:Just noticed MAX_DRAFT is no longer used since version 23.8, could it be a new bug?
I mean it is still checked in HashProbe() but during the search you no longer use this value. If I'm not mistaken you used this value to signal an exact EGTB entry, but now you no longer do this.
Could it be because the EGTB probes are so efficient that you don't need to replicate EGTB data in the hash table?

regards,
Alvaro
This was a simplification done during the 24.0 changes. Turns out this way is more efficient, because the egtb result will also get stored at the previous ply as well...

I did forget to remove the MAX_DRAFT check in the probe code however...
Zenmastur
Posts: 919
Joined: Sat May 31, 2014 8:28 am

Re: Crafty 24.0

Post by Zenmastur »

brianr wrote:Crafty can be compiled with MSVC.
I use the 2008 Express edition. 64 bit support works.
You may have to download a stdint.h and tweak some things a bit.
The executables are not as fast as some profiled builds, but still ok.
Command line args:

Code: Select all

/O2 /Ob2 /Oi /Ot /Oy /GT /GL /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "NT_i386" /D "CPUS=4" /Gm /EHsc /MDd /Fo"Debug\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
...
Hmmm... guess I'll have to check if this is still down-loadable. I did down-load VS2013 trial the other day but haven't installed it yet. I was hoping it would work or maybe VS Express 2013.
brianr wrote: ... As to learning there are many different types.
Did you mean position and book learning or more like tuning learning?...
Position learning seems to be the lowest hanging fruit but I'm still analyzing what the prospects are for making a significant difference in Elo. One of the problems I'm have is, during testing, I'm re-creating my books several times a day . I lose data every time I do this. Is there a way to add data to an existing book? This would make things go much faster. The comments in the code seems to indicate that there is or at least was at some time in the past.

Regards,

Forrest
Only 2 defining forces have ever offered to die for you.....Jesus Christ and the American Soldier. One died for your soul, the other for your freedom.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty 24.0

Post by bob »

Zenmastur wrote:
brianr wrote:Crafty can be compiled with MSVC.
I use the 2008 Express edition. 64 bit support works.
You may have to download a stdint.h and tweak some things a bit.
The executables are not as fast as some profiled builds, but still ok.
Command line args:

Code: Select all

/O2 /Ob2 /Oi /Ot /Oy /GT /GL /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "NT_i386" /D "CPUS=4" /Gm /EHsc /MDd /Fo"Debug\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
...
Hmmm... guess I'll have to check if this is still down-loadable. I did down-load VS2013 trial the other day but haven't installed it yet. I was hoping it would work or maybe VS Express 2013.
brianr wrote: ... As to learning there are many different types.
Did you mean position and book learning or more like tuning learning?...
Position learning seems to be the lowest hanging fruit but I'm still analyzing what the prospects are for making a significant difference in Elo. One of the problems I'm have is, during testing, I'm re-creating my books several times a day . I lose data every time I do this. Is there a way to add data to an existing book? This would make things go much faster. The comments in the code seems to indicate that there is or at least was at some time in the past.

Regards,

Forrest
Crafty can't add to the book. The book format was designed for speed, leaving no empty space here and there to add new moves, unfortunately.
Zenmastur
Posts: 919
Joined: Sat May 31, 2014 8:28 am

Re: Crafty 24.0

Post by Zenmastur »

bob wrote:Crafty can't add to the book. The book format was designed for speed, leaving no empty space here and there to add new moves, unfortunately.
I was afraid you were going to say that. This is a major defect at least as far as learning is concerned.

How does the method you use speed up access? How much extra speed does it provide?

I haven't looked at C code in 20 years so I'm having a little trouble deciphering what the code is doing. I assume that the records are sorted on the hash key, which I gather is generated when the move is made on the board (I didn't look to verify that this was the case, I just assumed that that was what was happening), and then packed in to the file sequentially is that correct? What is the definition of "cluster" as used in the create book output monologue?

I recall writing a simple database in the early 80's that was expandable to the limits of the hard drive, (it actually spanned multiple 160 meg drives, which at the time were the largest 5.25" drives I could find). As I recall 98% percent of all accesses required just 2 reads. One for the index which was stored by hash key and one for the main record. Writes required one read, the hash index, and two writes, writing the new hash into the index file and appending the record to the end of the data file. In that particular case the hash key was a small percentage of the total record size. Would something like this be usable for the opening book?

Regards,

Forrest
Only 2 defining forces have ever offered to die for you.....Jesus Christ and the American Soldier. One died for your soul, the other for your freedom.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty 24.0

Post by bob »

Zenmastur wrote:
bob wrote:Crafty can't add to the book. The book format was designed for speed, leaving no empty space here and there to add new moves, unfortunately.
I was afraid you were going to say that. This is a major defect at least as far as learning is concerned.

How does the method you use speed up access? How much extra speed does it provide?

I haven't looked at C code in 20 years so I'm having a little trouble deciphering what the code is doing. I assume that the records are sorted on the hash key, which I gather is generated when the move is made on the board (I didn't look to verify that this was the case, I just assumed that that was what was happening), and then packed in to the file sequentially is that correct? What is the definition of "cluster" as used in the create book output monologue?

I recall writing a simple database in the early 80's that was expandable to the limits of the hard drive, (it actually spanned multiple 160 meg drives, which at the time were the largest 5.25" drives I could find). As I recall 98% percent of all accesses required just 2 reads. One for the index which was stored by hash key and one for the main record. Writes required one read, the hash index, and two writes, writing the new hash into the index file and appending the record to the end of the data file. In that particular case the hash key was a small percentage of the total record size. Would something like this be usable for the opening book?

Regards,

Forrest
I basically do one I/O operation to get all book moves for a position. I carefully group them by a hash signature trick. Used to be pretty significant. With today's SSD devices probably not so much.

The problem with your scheme is where do you add the moves? To add them close to the other moves, you have to reserve space scattered throughout the file which hurts efficiency somewhat, and once you exhaust that, you are stuck once again...
Zenmastur
Posts: 919
Joined: Sat May 31, 2014 8:28 am

Re: Crafty 24.0

Post by Zenmastur »

bob wrote:
I basically do one I/O operation to get all book moves for a position. I carefully group them by a hash signature trick. Used to be pretty significant. With today's SSD devices probably not so much....

Well, first I would note that your right about SSD's. They're much faster than traditional hard drives because they have negligible seek times and no rotational latency. This completely changes what's required to make a data retrieval system fast enough to meet requirements.

In 1995 an average hard drive for a PC had a transfer rate of about one to two megabytes a second, a rotational latency of 6-8ms, and a seek time of 15-20ms. Modern drives have transfer rate of 50-100 MB/sec, rotational latency of 2-4ms, and seek times of 4-12ms. This is misleading since all modern drives come with relatively large caches which hides some to much of this time depending on what you are doing.

SSD's of course have no rotational latency, seek times are 0.1ms to 0.05ms and transfer rates are 500MBs / sec. They support on the order of 50,000 to 100,000 4K random reads or writes per second. I cant imagine a book structure that would run so slow as to be unusable on an SSD.

A second alternative is a ram drive. I use one and it works great. I also have an SSD. I use it for files that are too large or too numerous to fit on the ram drive. I don't know anyone that's serious about chess that doesn't have one.

In short, the technology has changed while the file system hasn't. The current system was designed for hardware that doesn't exist anymore.
bob wrote: ...The problem with your scheme is where do you add the moves? To add them close to the other moves, you have to reserve space scattered throughout the file which hurts efficiency somewhat, and once you exhaust that, you are stuck once again...
If you're using a ram drive or an SSD locality doesn't make much of a difference. No rotational latency and fractions of a millisecond seek time to any location on the disk means low access time to all data. It would of course be better if all moves are grouped to gather so I wouldn't take the sort code out just yet.

The way I would do it is use two files. An index file and a data file.

The index file would consist of 4k records. Each record would contain multiple sub-records. Each sub record points to the position sought in the data file. The sub-records consist of all (or part) of the hash key and a pointer into the data file. The index records are referenced by some fraction of the hash key, which depends on the maximum number of record we intend to store in the system.

You could actually do all of this in one file if you wanted to. But to keep it simple we'll use two files. The data file could be almost identical to what you use now, except that you would only need to store the upper portion of hash key with the position data (if you wanted to use less space). This file could be sorted and built just like it is now. To add a record, you simply append it to the end of the data file, read the appropriate index record and add a new sub-record containing a pointer to the location of the added record.

I have used type of structure on very large files with good success and excellent speed. There are a couple of additional complications. The first one is you need to know approximately the maximum number of records you intend the system to hold. Most of the systems I designed like this spanned multiple drives. This was long before RAID systems were available. The index is built so that it will contain 120% of the maximum number of records envisioned. This is the loose space you referred to. It's not that much extra space and it give you a lot of flexibility.

The data file is packed file just like it is now. If you actually need to store more records than you originally intended then you run the risk of running out of index space. I always left one sub-record at the end of each index record so that I could point to an overflow index record. The overflow index records get appended to the end of the index file, if needed. A pointer is then put in the last sub-record of the main index record. This saves a lot of grief. It stops the system from breaking if you still have disk space available.

It sounds more complicated than it is. When I was doing this for a living I could write the code and debug it in a few days.

Anyway, just an idea I've been thinking about.

Regards,

Forrest
Only 2 defining forces have ever offered to die for you.....Jesus Christ and the American Soldier. One died for your soul, the other for your freedom.
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Crafty 24.0

Post by JVMerlino »

Modern Times wrote:
Peter Skinner wrote:
ibid wrote:For what it's worth, I get the same error message as you with both exes on a Phenom II X6 1090T and Windows 7...
Can you both try this version for me?

http://www.kikrtech.com/crafty-23.9-winxpx64.exe.zip

Peter
Same error message here with that one too.
Has this issue been resolved? I just downloaded the exes and get the following error messages:

Using crafty-24.0-x64-sse42.exe....
Please verify that both the operating system and the processor support Intel(R)
X87, CMOV, MMX, FXSAVE, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2 and POPCNT instructions.

Using crafty-24.0-x64-nosse.exe....
Please verify that both the operating system and the processor support Intel(R)
X87, CMOV, MMX, FXSAVE, SSE, SSE2 and SSE3 instructions.

My processor is a Phenom 9650 Quad @2.3 GHZ, and I'm running Win7.

jm
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Crafty 24.0

Post by zullil »

JVMerlino wrote:
Modern Times wrote:
Peter Skinner wrote:
ibid wrote:For what it's worth, I get the same error message as you with both exes on a Phenom II X6 1090T and Windows 7...
Can you both try this version for me?

http://www.kikrtech.com/crafty-23.9-winxpx64.exe.zip

Peter
Same error message here with that one too.
Has this issue been resolved? I just downloaded the exes and get the following error messages:

Using crafty-24.0-x64-sse42.exe....
Please verify that both the operating system and the processor support Intel(R)
X87, CMOV, MMX, FXSAVE, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2 and POPCNT instructions.

Using crafty-24.0-x64-nosse.exe....
Please verify that both the operating system and the processor support Intel(R)
X87, CMOV, MMX, FXSAVE, SSE, SSE2 and SSE3 instructions.

My processor is a Phenom 9650 Quad @2.3 GHZ, and I'm running Win7.

jm
Try this: http://talkchess.com/forum/viewtopic.ph ... 02&t=52455
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Crafty 24.0

Post by JVMerlino »

zullil wrote:
JVMerlino wrote:
Modern Times wrote:
Peter Skinner wrote:
ibid wrote:For what it's worth, I get the same error message as you with both exes on a Phenom II X6 1090T and Windows 7...
Can you both try this version for me?

http://www.kikrtech.com/crafty-23.9-winxpx64.exe.zip

Peter
Same error message here with that one too.
Has this issue been resolved? I just downloaded the exes and get the following error messages:

Using crafty-24.0-x64-sse42.exe....
Please verify that both the operating system and the processor support Intel(R)
X87, CMOV, MMX, FXSAVE, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2 and POPCNT instructions.

Using crafty-24.0-x64-nosse.exe....
Please verify that both the operating system and the processor support Intel(R)
X87, CMOV, MMX, FXSAVE, SSE, SSE2 and SSE3 instructions.

My processor is a Phenom 9650 Quad @2.3 GHZ, and I'm running Win7.

jm
Try this: http://talkchess.com/forum/viewtopic.ph ... 02&t=52455
That worked! Thanks, Louis!

jm
Engin
Posts: 918
Joined: Mon Jan 05, 2009 7:40 pm
Location: Germany
Full name: Engin Üstün

Re: Crafty 24.0

Post by Engin »

Yes, i have AMD Phenom X6 1090T too and both Crafty versions did not run :-(