Crafty-22.2 is available

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

Moderator: Ras

Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Crafty-22.2 is available

Post by Dann Corbit »

Graham Banks wrote:
Dann Corbit wrote:Be aware that it's going to crash on Windows if you use more than one thread.
There is a patched version here, but it only contains a 64 bit binary:
http://cap.connx.com/chess-engines/new- ... ty22-3.zip

However, anyone can recompile the code.
Hi Dann,

I'm using Crafty 22.3 32-bit and only intend doing single-cpu testing at this stage.

Regards, Graham.
Then there is no problem in using that version.
User avatar
Graham Banks
Posts: 44643
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Crafty-22.2 is available

Post by Graham Banks »

Dann Corbit wrote:
Graham Banks wrote:
Dann Corbit wrote:Be aware that it's going to crash on Windows if you use more than one thread.
There is a patched version here, but it only contains a 64 bit binary:
http://cap.connx.com/chess-engines/new- ... ty22-3.zip

However, anyone can recompile the code.
Hi Dann,

I'm using Crafty 22.3 32-bit and only intend doing single-cpu testing at this stage.

Regards, Graham.
Then there is no problem in using that version.
I should have posted in the Crafty 22.3 thread. My bad for creating confusion. Sorry.

Cheers, Graham.
gbanksnz at gmail.com
User avatar
Peter Skinner
Posts: 1763
Joined: Sun Feb 26, 2006 1:49 pm
Location: Edmonton, Alberta, Canada
Full name: Peter Skinner

Re: Crafty-22.2 is available

Post by Peter Skinner »

Dann Corbit wrote:Be aware that it's going to crash on Windows if you use more than one thread.
There is a patched version here, but it only contains a 64 bit binary:
http://cap.connx.com/chess-engines/new- ... ty22-3.zip

However, anyone can recompile the code.
This is the original code:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) ((~(size_t) 127) & (127 + (size_t) WinMalloc(sizeof(TREE) +
                127, tid)));
Here is your patched code:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) (WinMalloc(sizeof(TREE) + 2047, tid)));
Your patched code has an extra ) in it, and should be as follows:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) (WinMalloc(sizeof(TREE) + 2047, tid));
Other than that one error, it compiles cleanly, and doesn't crash when using two threads. I will update my website with new binaries.

Peter
I was kicked out of Chapters because I moved all the Bibles to the fiction section.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty-22.2 is available

Post by bob »

Graham Banks wrote:
Graham Banks wrote: How's this look Peter? I want to use closest to 128mb hash, single-cpu, ponder off, no learning, generic book.

smpnice=0
egtb
tbpath=c:\Tablebases
hash=96M
hashp=64M
cache=32M
ponder off
learn 0
book off
log=off
exit

Seems to work okay.

Cheers, Graham.
Got confirmation via messenger that it's ok. Thanks Peter.
Doesn't matter whether smpnice=0 or 1.
Actually it does. With default smpnice=1, if you use multiple processors, the program terminates processes when it is waiting and you have ponder=off. With smpnice=0, when waiting the processes will spin in a tight busy-wait loop and burn N-1 CPUs at 100%. Ponder=on would make that not very important, but with ponder=off and mt=anything other than 1, smpnice=1 is more system-friendly (and is the default as I mentioned).
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty-22.2 is available

Post by bob »

Dann Corbit wrote:Be aware that it's going to crash on Windows if you use more than one thread.
There is a patched version here, but it only contains a 64 bit binary:
http://cap.connx.com/chess-engines/new- ... ty22-3.zip

However, anyone can recompile the code.
Why would it crash? windows and linux both now use threads and the old exit(0) problem has been removed. I'm not aware of anything that breaks on windows with 22.2 and beyond. 22.1 had a problem for sure.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty-22.2 is available

Post by bob »

Peter Skinner wrote:
Dann Corbit wrote:Be aware that it's going to crash on Windows if you use more than one thread.
There is a patched version here, but it only contains a 64 bit binary:
http://cap.connx.com/chess-engines/new- ... ty22-3.zip

However, anyone can recompile the code.
This is the original code:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) ((~(size_t) 127) & (127 + (size_t) WinMalloc(sizeof(TREE) +
                127, tid)));
Here is your patched code:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) (WinMalloc(sizeof(TREE) + 2047, tid)));
Your patched code has an extra ) in it, and should be as follows:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) (WinMalloc(sizeof(TREE) + 2047, tid));
Other than that one error, it compiles cleanly, and doesn't crash when using two threads. I will update my website with new binaries.

Peter
What is this supposed to fix? The above "fix" actually breaks cache usage. The original code forces the split blocks to begin on a 128-byte cache boundary, while the "fixed code" accepts whatever winmalloc returns which is guaranteed only to be on an 8-byte boundary.

What exactly is the problem???
User avatar
Graham Banks
Posts: 44643
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Crafty-22.2 is available

Post by Graham Banks »

bob wrote:
Graham Banks wrote:
Graham Banks wrote: How's this look Peter? I want to use closest to 128mb hash, single-cpu, ponder off, no learning, generic book.

smpnice=0
egtb
tbpath=c:\Tablebases
hash=96M
hashp=64M
cache=32M
ponder off
learn 0
book off
log=off
exit

Seems to work okay.

Cheers, Graham.
Got confirmation via messenger that it's ok. Thanks Peter.
Doesn't matter whether smpnice=0 or 1.
Actually it does. With default smpnice=1, if you use multiple processors, the program terminates processes when it is waiting and you have ponder=off. With smpnice=0, when waiting the processes will spin in a tight busy-wait loop and burn N-1 CPUs at 100%. Ponder=on would make that not very important, but with ponder=off and mt=anything other than 1, smpnice=1 is more system-friendly (and is the default as I mentioned).
Thanks Bob. :D
gbanksnz at gmail.com
User avatar
Peter Skinner
Posts: 1763
Joined: Sun Feb 26, 2006 1:49 pm
Location: Edmonton, Alberta, Canada
Full name: Peter Skinner

Re: Crafty-22.2 is available

Post by Peter Skinner »

bob wrote:
Peter Skinner wrote:
Dann Corbit wrote:Be aware that it's going to crash on Windows if you use more than one thread.
There is a patched version here, but it only contains a 64 bit binary:
http://cap.connx.com/chess-engines/new- ... ty22-3.zip

However, anyone can recompile the code.
This is the original code:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) ((~(size_t) 127) & (127 + (size_t) WinMalloc(sizeof(TREE) +
                127, tid)));
Here is your patched code:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) (WinMalloc(sizeof(TREE) + 2047, tid)));
Your patched code has an extra ) in it, and should be as follows:

Code: Select all

for (i = MAX_BLOCKS_PER_CPU * ((int) tid) + 1; n; i++, n--) {
    block[i] =
        (TREE *) (WinMalloc(sizeof(TREE) + 2047, tid));
Other than that one error, it compiles cleanly, and doesn't crash when using two threads. I will update my website with new binaries.

Peter
What is this supposed to fix? The above "fix" actually breaks cache usage. The original code forces the split blocks to begin on a 128-byte cache boundary, while the "fixed code" accepts whatever winmalloc returns which is guaranteed only to be on an 8-byte boundary.

What exactly is the problem???
I did email about this patch by Dan, and hadn't updated the website with new compiles until I heard back from you.

Since it doesn't fix things and actually breaks things, then I won't update it with his "patch".

The problem seems to be that Windows users, using more than one thread are seeing crashing problems. While I can't seem to reproduce this with my compiles on any of my machines, I don't know what the real issue is.

If I start Crafty with mt=2, and select "machine white" in Winboard, it works perfectly. No issues. Crafty also played 30+ games via ICS last night with no issues.

So again, I don't know where the issue is...
I was kicked out of Chapters because I moved all the Bibles to the fiction section.
gerold
Posts: 10121
Joined: Thu Mar 09, 2006 12:57 am
Location: van buren,missouri

Re: Crafty-22.2 is available

Post by gerold »

Crafty 22.3 32 is now working in Arena. The download from
your page.

Thanks Peter,

Gerold.
Dann Corbit
Posts: 12792
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Crafty-22.2 is available

Post by Dann Corbit »

Access to null pointers and/or unintialized memory.
I sent you a patch via email last night.