Main
Date: 21 Mar 2006 02:34:30
From: lists.jackson.nic@gmail.com
Subject: Crafty Build for Intel Core Duo on Macintosh
Hi,

Im trying to build crafty to utilise both processors on my Macbook Pro.
I have succesfully built using the standard Darwin but whenever i am
analysing i can see from the processor stats it is only using one.

So i though time to try to hack the Makefile, I changed some of the
Darwin build options as below,

darwin:
$(MAKE) target=FreeBSD \
CC=gcc CXX=g++ \
CFLAGS='$(CFLAGS) -Wall -pipe -march=i686 -O3' \
CXFLAGS=$(CFLAGS) \
LDFLAGS=$(LDFLAGS) \
LIBS='-lstdc++' \
opt='$(opt) -DFUTILITY -DSMP -DCPUS=2 -DFAST' \
crafty-make

I have specified the -DSMP and -DCPUS=2 with the hope that the program
would take advantage of both CPU's. Everything compiles fine however
when I try to run crafty I get the follwing error:

ERROR. shmget() failed, unable to allocate a shared memory segment.
Please verify that your /proc/sys/kernel/shmmax value is
large enough to allow allocating the amount of memory you
are requesting. "echo 1000000000 > /proc/sys/kernel/shmmax"
will allow a segment up to one billion bytes.

I have attempted to increase the shmmax setting in the etc/rc file, but
again to no avail.

I appologise if i am missing something silly, I'm not experienced with
C and unix build environments.

Kind Regards,

Nic Jackson





 
Date: 04 Apr 2006 02:43:44
From: lists.jackson.nic@gmail.com
Subject: Re: Crafty Build for Intel Core Duo on Macintosh
Hi,

I have managed to find a little more time to work on my crafty build,
Im not sure if what I have done is safe or recomended by apple but here
are the preliminary results anyway.

Firstly I hacked the Makefile replacing the Darwin section with the
code listed below. Once I get a tuned Makefile I will create a separate
section dawin-intel or something and post the file for you all.

darwin:
$(MAKE) target=FreeBSD \
CC=gcc CXX=g++ \
CFLAGS='$(CFLAGS) -Wall -pipe -O3 -march=i686' \
CXFLAGS=$(CFLAGS) \
LDFLAGS=$(LDFLAGS) \
LIBS='-lstdc++' \
opt='$(opt) -DFUTILITY -DFAST -DTRACE -DSMP -DCPUS=2'
\
crafty-make

As posted earlier I was getting the error below when I ran my custom
build of crafty.

ERROR. shmget() failed, unable to allocate a shared memory segment.
Please verify that your /proc/sys/kernel/shmmax value is
large enough to allow allocating the amount of memory you
are requesting. "echo 1000000000 > /proc/sys/kernel/shmmax"
will allow a segment up to one billion bytes.

I overcame this by tweaking the settings in the /etc/rc file the
original settings for OS X 10.4.5 are:
sysctl -w kern.sysv.shmmax=4194304 kern.sysv.shmmin=1
kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.sysv.shmall=1024

These settings I changed to the following:
sysctl -w kern.sysv.shmmax=1073741824 kern.sysv.shmmin=1
kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.sysv.shmall=262144

Crafty now ran without error.

Below are the results from the crafy bench test, I am still finding my
feet with this so im still a little unsure what is a good value and
what is a bad my limited knowledge is that more nodes per second is
good ?

For information I have posted a comparison of the defualt darwin make
and my custom make. Watching the processor monitor its visible to see
that the default make does not use the maximum resources. The custom
build maxes both cores and this results in a larger node per second. I
have also bench marked the custom build using a single thread again for
comparison. NOTE: all benchmarks have been run with default hastable
settings, at present I am not sure how to tweak the crafty program for
maximum performance.

DEFUALT DARWIN BUILD

Crafty v20.1

White(1): bench
Running benchmark. . .
......
Total nodes: 72473383
Raw nodes per second: 779283
Total elapsed time: 93
SMP time-to-ply measurement: 6.881720

CUSTOM DARWIN BUILD smpmt=1

Crafty v20.1 (1 cpus)

White(1): bench
Running benchmark. . .
......
Total nodes: 72473383
Raw nodes per second: 779283
Total elapsed time: 93
SMP time-to-ply measurement: 6.881720

CUSTOM DARWIN BUILD smpmt=2

Crafty v20.1 (2 cpus)

White(1): bench
Running benchmark. . .
......
Total nodes: 75018845
Raw nodes per second: 1530996
Total elapsed time: 49
SMP time-to-ply measurement: 13.061224

Hardware:
MacBook Pro
2GHz Intel Core Duo
2GB DDR2 SDRAM
OS X 10.4.5

Regards,

Nic Jackson



 
Date: 21 Mar 2006 12:40:28
From: Tord Kallqvist Romstad
Subject: Re: Crafty Build for Intel Core Duo on Macintosh
WARNING: Shameless self promotion follows!

Hi Nic,

This isn't what you were asking about, but I am the author of another
open source parallel chess program which works on the MacBook Pro, and
is able to utilise both processors:

http://www.glaurungchess.com

It compiles right out of the box with the included Makefile. There
is also a pre-compiled binary for Intel Macs.

Glaurung is at least as strong as the latest public version of Crafty,
I think.

Unfortunately, I have no idea how to solve your problems with Crafty.
I have also not managed to compile a SMP-enabled Crafty for Mac OS X
(I haven't tried very hard, though).

--
Tord Romstad