PDA

View Full Version : Compiling Crafty chess for FC12 x86_64


tashirosgt
19th January 2010, 05:13 AM
When I compile the chess program crafty-23.1 on my FC12 x86_64 computer using the command:

make linux-amd64

I get errors that result from not finding a file called "numa.h" and perhaps from not linking a "libnuma" library.

The machine has a libnuma:

/usr/lib64/libnuma.so.1


I can find "numa.h" on my machine in several places. For example


/usr/arm-gp2x-linux/include/linux/numa.h
/usr/src/kernels/2.6.31.5-127.fc12.x86_64/arch/x86/include/asm/numa.h
/usr/src/kernels/2.6.31.5-127.fc12.x86_64/include/acpi/acpi_numa.h
/usr/src/kernels/2.6.31.5-127.fc12.x86_64/include/config/numa.h


Is one of these numa.h's the right one?


The source code is from: ftp://ftp.cis.uab.edu/pub/hyatt/source/

Some of the compilation errors:


make target=LINUX \
CC=gcc CXX=g++ \
CFLAGS=' -Wall -pipe \
-fbranch-probabilities -fomit-frame-pointer -O3 -march=k8' \
CXFLAGS= \
LDFLAGS=' -lpthread -lnuma -lstdc++' \
opt=' -DINLINE64 -DCPUS=8 -DNUMA -DLIBNUMA' \
crafty-make
make[1]: Entering directory `/home/sgt/Chess/crafty-23.1'
make[2]: Entering directory `/home/sgt/Chess/crafty-23.1'
gcc -Wall -pipe \
-fbranch-probabilities -fomit-frame-pointer -O3 -march=k8 -DINLINE64 -DCPUS=8 -DNUMA -DLIBNUMA -DLINUX -c search.c
search.c: In function ‘Search’:
search.c:965: note: file /home/sgt/Chess/crafty-23.1/search.gcda not found, execution counts estimated
search.c:18: warning: ‘first_tried’ may be used uninitialized in this function
gcc -Wall -pipe \
-fbranch-probabilities -fomit-frame-pointer -O3 -march=k8 -DINLINE64 -DCPUS=8 -DNUMA -DLIBNUMA -DLINUX -c thread.c
thread.c: In function ‘CopyFromChild’:
thread.c:490: note: file /home/sgt/Chess/crafty-23.1/thread.gcda not found, execution counts estimated
.....<snip>....
main.c:9:20: error: numa.h: No such file or directory
main.c: In function ‘main’:
main.c:3905: warning: implicit declaration of function ‘numa_available’
main.c:3908: warning: implicit declaration of function ‘numa_node_to_cpus’
main.c:3910: warning: implicit declaration of function ‘numa_max_node’
make[2]: *** [main.o] Error 1
make[2]: Leaving directory `/home/sgt/Chess/crafty-23.1'
make[1]: *** [crafty-make] Error 2
make[1]: Leaving directory `/home/sgt/Chess/crafty-23.1'
make: *** [linux-amd64] Error 2

aleph
19th January 2010, 05:37 AM
yum install numactl-devel

tashirosgt
19th January 2010, 06:42 AM

Thank you. That created /usr/include/numa.h.

I don't think I'll be able to compile the source code since there is a disagreement between numa.h and main.c about the function numa_node_to_cpus.

/usr/include/numa.h says:


int numa_node_to_cpus(int, struct bitmask *);


But main.c of Crafty calls it with 3 arguments:


if defined(NUMA) && defined(LINUX)
if (numa_available() >= 0) {
unsigned long cpus[8];

numa_node_to_cpus(0, cpus, 64);
printf("\nMachine is NUMA, %d nodes (%d cpus/node)\n\n",
numa_max_node() + 1, PopCnt(cpus[0]));
}
#endif

RupertPupkin
19th January 2010, 06:31 PM
Hmm, I was able to compile the crafty-23.1 source on my F7 32-bit system. After dinking around the ftp server I figured out how to use the program. It's not bad, thanks!

tashirosgt
20th January 2010, 01:06 AM
One interesting thing about Crafty is that by using it from the command line you can have it automatically annotate games. It can also create its own opening books from game collections.

---------- Post added at 06:06 PM CST ---------- Previous post was at 02:33 PM CST ----------

I revised a small section of main.c and got Crafty to compile and run. I haven't thoroughly checked out whether it runs correctly yet.

My revision:

/*
************************************************** **********
* *
* If NUMA is enabled, report on the current machine *
* configuration. *
* *
************************************************** **********
*/
#if defined(NUMA) && defined(LINUX)
if (numa_available() >= 0) {
unsigned long cpus[8];
struct bitmask bm;
bm.size=64;
bm.maskp = &cpus[0];

numa_node_to_cpus(0, &bm);
printf("\nMachine is NUMA, %d nodes (%d cpus/node)\n\n",
numa_max_node() + 1, PopCnt(cpus[0]));
}
#endif

ecolitan
24th February 2010, 02:28 PM
Thanks tashirosgt! Your piece of code worked great.

Miktal_GM
30th August 2010, 02:38 PM
Hey there! I am new to Fedora and am trying to get Crafty to run. I have downloaded the compressed files from the main website for 23.1. I extracted them to my /home folder. I am a little bit confused as to the next step. Thank you! (I am running Fedora 13 with LXDE.)