![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
| Tags: 100, 196, compiled, crafty, gcc, successfully, windows |
|
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hello everybody,
please excuse this cross-posting, but I want to let the world participate in my success: I am proud of just having succeeded in successfully compiling the chess program Crafty 19.6 under Windows with GCC/GPP!!! Integration with Winboard 4.2.6 works fine, too. Also with FICS (free internet chess server)! Note that google's 1st keyword search hit on this topic, the site "http://www.xs4all.nl/~mlngveld/crafty/", is WRONG! Following those instructions, I get an exe file, but that one does not integrate with winboard! In fact, those instructions are just a dirty and buggy hack to my opinion. In fact, with my compiled version I see no behavioural difference to the MSVC compiled version to be downloaded from Prof. Hyatt's (the Crafty programmer) Web page. Besides 70% larger file size, and probably lower execution time (more info to follow later!) I tried many things, searched the internet, contacted newsgroups, but in the end, I had to get there by myself. Now I did it! Here is how I succeeded: - I used the gcc with dev-c++ version 5 beta (v. 4.9.8.4 to be more precise) (http://www.bloodshed.net/dev/devcpp.html) - I modified various files of the crafty soure code only SLIGHTLY. (no dirty hack - I knew what I did!) More details (a precise cook-book) I intend to provide soon, if you are interested. Michael -- No Spam: For sending e-mail to me, write "wir_sinds" instead of "xyz.abc". |
| Ads |
|
#2
|
|||
|
|||
|
Michael Loggel writes:
Besides 70% larger file size Have you stripped the binary? -- Lift me down, so I can make the Earth tremble. --Bucky Katt |
|
#3
|
|||
|
|||
|
Michael Loggel wrote:
please excuse this cross-posting You forgot to cross-post it! :-) Dave. -- David Richerby Hungry Monk (TM): it's like a man of www.chiark.greenend.org.uk/~davidr/ God but it'll eat you! |
|
#4
|
|||
|
|||
|
Michael Loggel ha scritto in
6 che: Hello everybody, please excuse this cross-posting, but I want to let the world participate in my success: I am proud of just having succeeded in successfully compiling the chess program Crafty 19.6 under Windows with GCC/GPP!!! Integration with Winboard 4.2.6 works fine, too. Also with FICS (free internet chess server)! [CUT] Good work!!! Here is how I succeeded: - I used the gcc with dev-c++ version 5 beta (v. 4.9.8.4 to be more precise) (http://www.bloodshed.net/dev/devcpp.html) - I modified various files of the crafty soure code only SLIGHTLY. (no dirty hack - I knew what I did!) More details (a precise cook-book) I intend to provide soon, if you are interested. Michael I'm interested...I'm waiting for your details. -- CiccioSPICE |
|
#5
|
|||
|
|||
|
Michael Loggel ha scritto in
6 che: Hello everybody, please excuse this cross-posting, but I want to let the world participate in my success: I am proud of just having succeeded in successfully compiling the chess program Crafty 19.6 under Windows with GCC/GPP!!! Integration with Winboard 4.2.6 works fine, too. Also with FICS (free internet chess server)! [CUT] Good work!!! Here is how I succeeded: - I used the gcc with dev-c++ version 5 beta (v. 4.9.8.4 to be more precise) (http://www.bloodshed.net/dev/devcpp.html) - I modified various files of the crafty soure code only SLIGHTLY. (no dirty hack - I knew what I did!) More details (a precise cook-book) I intend to provide soon, if you are interested. Michael I'm interested...I'm waiting for your details. -- CiccioSPICE |
|
#6
|
|||
|
|||
|
Here we go - enjoy!
--------------------------------------------------------------- How to Compile Crafty 19.6 with Dev-Cpp (GCC/GPP) under Windows --------------------------------------------------------------- A "Cook Book" I used version 4.9.8.5 (a stable beta of version 5) incl. gcc/g++ 3.2 ('mingw special 20020817-1') under Win 2000 and an AMD Athlon 900 MHz. Also successfully tried with Crafty 19.2 Date: 7.12.2003 ---------------------------------------------------------------------- CONTENTS ---------------------------------------------------------------------- Ch. 1: The Quickest Way to Compile Crafty 1.1 - Using the IDE of Dev-C++ 1.1.1 Further Speed Optimisations 1.2 - Using an Own Makefile Ch. 2: How to Evaluate Crafty Calculation Speed 2.1 - Some Performance Measurements for different compilation settings Ch. 3: Some Results of Calculation Speed for Different Compiler Settings ANNEX: Makefiles to be used with Dev-C++ A.1 - The "Short" Makefile A.2 - The "Long" Makefile ------------------------------------------------------------------------ ------------------------------------------------------------------------ ----------------------------------------- Ch. 1: The Quickest Way to Compile Crafty ----------------------------------------- 1.1 - Using the IDE of Dev-C++ ============================== (1) Goto http://www.bloodshed.net/dev/devcpp.html - Download devcpp4980.exe - Download latest update (currently (7.12.2003) devcpp4985.zip) [this is a DELTA to above install, so you need both] - Install dev-cpp properly, for example in C:\Dev-Cpp\ (2) Download Crafty 19.6 from ftp://ftp.cis.uab.edu/pub/hyatt/v19/crafty-19.6.zip (3) Extract the contents of the zip-file crafty-19.6.zip to a working directory, for example to C:\c-files\crafty\ (4) Start the Graphical Windows-Like Integrated Development Environment (IDE) of Dev-CPP by starting C:\Dev-Cpp\devcpp.exe. (5) Create a new project: - MENU: File - New - Project... - select Console application - find an appropriate project name, e.g. crafty1906 - select C++ -Project (NOT C-Project, because otherwise, later the linking will fail!) - click Ok - Save the project file for example under c:\c-files\crafty\crafty1906.dev -- A new project comes up with a default file "main.c" -- In the project browser on the left, expand the tree and right-click on main.c and select "remove file" and then click "do not save" -- Now you should have a completely empty project -- very well! (6) Include source files to the project: - On the left, right-click on the project and select "Add To Project" -- Mark all .c and .h and .cpp files in "c:\c-files\crafty\", BESIDES crafty.c and dgtdrv.c (!!) Note: These two files are not needed at all! If included in the project, they will cause compilation errors! -- Now the project tree on the left should contain all those files, 62 files altogether. Ok? - very well! (7) Continue as follows: - Goto MENU - Project - Project Options - Select the second pane "Files" - Now all .c, .h an the one .cpp file should be checked for the oxes "Include in Compilation", "Include in inking" and "Compile file as C++". - Mark all files *besides* egtb.cpp and UNcheck the box "Compile file as C++". Now all files should be unchecked for this, besides egtb.cpp, which is still checked to be compiled as C++. - Select the 4th pane "Parameters" - Add the following command line option to BOTH the C-Compiler (left field) and the C++ compiler (middle field): "-DNT_i386" (without quotation marks) Remark: This causes the variable "NT_i386" to be defined already when the pre-compiler starts. -- click Ok. -- Now your project is well configured. If you want, you can save the project now, to save the changes. (7) Compile the project by clicking the compile button or pressing CTRL-F9. (8) Now an exe-file should be created after some time, for example c:\c-files\crafty\crafty1906.exe Note: You should get 0 warnings during compilation stage and 7 warnings during linking stage. Number of errors = zero. 1.1.1 - Further Speed Optimisations ----------------------------------- Execution speed of the generated exe file can (and should!) be increased by this: - MENU - Project - Project Options: Select the 3rd pane "Compiler - Optimisation - Further Optimisations": -- Select "Best Optimisation"-Yes. - Select the 4th pane "Parameters" - Add the following command line option to BOTH the C-Compiler (left field) and the C++ compiler (middle field) [in addition to -DNT_i386, which is already there]: "-fomit-frame-pointer" (without quotation marks) - click Ok Now, possibly delete the *.o files and the exe file of your directory and compile another time. Even better speed-optimised code (compare test list of ch. 3) is generated when using your own makefile! This is described in ch 1.2. 1.2 - Using an Own Makefile =========================== - If not already done, do the steps (1) to (6) of ch. 1.1. - MENU - Project - Project Options - Select the pane "Makefile" - Check the box "Use custom makefile" - Select the makefile in the field below. ATTENTION: It must have the name "Makefile" literally! Otherwise, if it is called for example "MakefCraftyDevcpp", you will get a linking error! Therefore, rename or delete the original file "Makefile" of the Crafty delivery, and substitute it by your own makefile called "Makefile". The Makefile to be used is given in the ANNEX of this inforamtion and would naturally be located in the same directory as the Crafty sources. You can either use the short Makefile or the long one given in the annex. The short one can only be used for compilation with gcc under windows, while the long one is a generalisation of the original Crafty makefile and can still be used for compilation on other platforms like UNIX, MAC OS, LINUX etc. ----------------------------------------------- Ch. 2: How to Evaluate Crafty Calculation Speed ----------------------------------------------- The following tests are designed to compare different compiled versions of Crafty on the same machine for comparing calculation speed differences. - Copy the crafty.exe file to a location where it is completely standalone, i.e. without any opening book accessible, i.e. no book.bin files in the same directory as the exe file. - Start the exe - a DOS box opens. - Test 1: (repeat 2 or 3 times to see how it varies) - type "perf" enter -- this will show a performance figure. The higher the better. (or seconds: The lower the better) - Test 2: (repeat 2 or 3 times to see how it varies) - type "ponder off" enter [suppress thinking when opponent is thinking] - type "noise 10000000" enter [suppress display while thinking] - type "st 2" enter [fixed thinking time of 2 seconds] - type "e2e4" enter [make a starting move e2-e4] -- read the number for "nodes" and "evals". The higher the better. Some of these test results are presented in ch. 3. ------------------------------------------------------------------------- Ch. 3: Some Results of Caclculation Speed for Different Compiler Settings ------------------------------------------------------------------------- PC: AMD Athlon 900, 256 MByte RAM, Windows 2000 Crafty 19.06: ------------- | "perf" nodes per 2sec | (smaller=better) (larger=better) Compiler Setting: | | gener. made/unmade nodes evals ------------------------------------+--------------------------------------- | Compile from IDE, no optimisations | 3.49s 12.04s 339860 154975 | | Compile from IDE, set | 2.47s 8.47s 484818 212096 "Best Optimisation" (corresponding | to option -O3) | | Compile from IDE, set | 2.40s 7.78s 478781 208939 "Best Optimisation" and | "-fomit-frame-pointer" | | Use own Makefile, as above, but | 2.44s 7.76s 493939 215116 w/o "-DUSE_ATTACK_FUNCTIONS" | | Use own Makefile, as above, but | 2.34s 8.37s 493939 215116 w/o "-fomit-frame-pointer" | | Use own Makefile, as above, but | 2.28s 8.03s 533160 232414 with "-m486" | | Use own Makefile, as above | 2.30s 7.62s 536177 233882 | For comparison: Crafty 19.2 ----------- | Compiled with own makefile above: | 2.32s 7.64s 534457 256886 | Executable downloaded | 2.07s 6.29s 655082 310738 from Crafty's programmer's | website at | ftp://ftp.cis.uab.edu/pub/hyatt/v19/crafty-19.02.exe (probably compiled with MSVC) | | ------------------------------------+----------------------------------- | -- MSVC is faster than GCC by... | 12% 21% 23% 21% (for Crafty 19.2) | | ------------------------------------+----------------------------------- ---------------------------------------- ANNEX: Makefiles to be used with Dev-C++ ---------------------------------------- Here are two possible makefiles! Take care that the makefile is saved literally with the filename "Makefile"! Both makefiles given below produce 100% identical code with Dev-C++. A.1: The "Short" Makefile ========================= This makefile can only be used for compilation with gcc under windows ##### ----- START of MAKEFILE ----- ##### all: NT_i386 NT_i386: $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make NT_i386_alt: # an alternative, but I got slightly better results # with AMD Athlon 900 and Win 2000 with the other option, see above. $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make opts = $(opt) -D$(target) opts = $(opt) -D$(target) objects = searchr.o search.o thread.o searchmp.o repeat.o next.o nexte.o \ nextr.o history.o quiesce.o evaluate.o movgen.o make.o unmake.o hash.o \ attacks.o swap.o boolean.o utility.o valid.o probe.o book.o data.o \ drawn.o edit.o epd.o epdglue.o init.o input.o interupt.o iterate.o \ main.o option.o output.o phase.o ponder.o preeval.o resign.o root.o \ learn.o setboard.o test.o testepd.o time.o validate.o annotate.o \ analyze.o evtest.o bench.o egtb.o dgt.o $(asm) includes = data.h chess.h epdincludes = epd.h epddefs.h epdglue.h eval_users = data.o evaluate.o preeval.o crafty-make: @$(MAKE) \ opt='$(opt)' asm='$(asm)' \ crafty crafty: $(objects) $(CYY) $(LDFLAGS) -o crafty $(objects) -lm $(LIBS) dgt: dgtdrv.o @cc -O -o dgt dgtdrv.c egtb.o: egtb.cpp $(CXX) -c $(CXFLAGS) $(opts) egtb.cpp clean: -rm -f *.o crafty X86-elf.X X86-aout.S $(objects): $(includes) $(eval_users): evaluate.h epd.o epdglue.o option.o init.o : $(epdincludes) ..c.o: $(CC) $(CFLAGS) $(opts) -c $*.c ..s.o: $(AS) $(AFLAGS) --defsym ALIGN=4 -o $*.o $*.s ##### ----- END of MAKEFILE ----- ##### A.2: The "Long" Makefile ======================== This makefile is a generalisation of the original crafty makefile and can still be used for compilation on other platforms. ##### ----- START of MAKEFILE ----- ##### # To build crafty: # # You want to set up for maximum optimization, but typically you will # need to experiment to see which options provide the fastest code. # This is optimized for pgcc, which is a fairly current compiler. # # The currently available targets: # # AIX {IBM machines running AIX} # ALPHA {DEC Alpha running OSF/1-Digital Unix} # ALPHALINUX {DEC Alpha running Linux} # CRAY1 {any Cray-1 compatible architecture including XMP, YMP, # C90, etc.} # HP {HP workstation running HP_UX operating system (Unix)} # LINUX {80X86 architecture running LINUX (Unix)} # NT_i386 {80X86 architecture running Windows 95 or NT} # NT_AXP {DEC Alpha running Windows NT} # DOS {PC running dos/windows, using DJGPP port of gcc to compile} # NEXT {NextStep} # OS/2 {IBM OS/2 warp} # SGI {SGI Workstation running Irix (SYSV/R4) Unix} # SUN {Sun SparcStation running Solaris (SYSV/R4) Unix} # SUN_GCC {Sun SparcStation running Solaris but using gcc # FreeBSD {80X86 architecture running FreeBSD (Unix)} # NetBSD {multi-architecture running NetBSD (Unix)} # Cygwin {80X86 running Cygwin under Win32 (Unix)} # # The next options are optimizations inside Crafty that you will have # test to see if they help. on some machines, these will slow things # by up to 10%, while on other machines these options will result in # improving search speed up to 20%. NOTE: if you are running Linux # or have a SUN Sparc-20 machine, the default configurations below # will use the hand-written assembly modules. Typical performance # improvement is 33%, but this only applies to X86 machines and the # Sun Sparc-20. # # 1. opt = -DCOMPACT_ATTACKS # 2. opt = -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS # # Finally, if you have a Symmetric MultiProcessor machine, you should # add -DSMP to the opt definition for your make configuration, and then # add -DCPUS=N where N is the number of processors (max) you will use. # # if you want 6 man EGTB support, you will need to add -DEGTB6 to the # options above. all: NT_i386 # this target "all" specifies the target(s) that is (are) # used when make is called without argument. # Used for Dev-C++ GNU compiler under Windows. default: $(MAKE) -j4 linux-icc-elf help: @echo "You must specify the system which you want to compile for:" @echo "" @echo "make aix IBM AIX" @echo "make alpha DEC Alpha with OSF/1-Digital UNIX" @echo "make alpha-host Alpha DECstation optimized for host" @echo "make alpha-host-nocix Alpha DECstation optimezed for host, no CIX insn" @echo "make cygwin Cygwin under Win32" @echo "make dos DOS on i386 with DJGPP" @echo "make NT_i386 Windows, e.g. with Dev-C++ v4.9.8.5 (GCC/G++ 3.2)" @echo "make hpux HP/UX 9/10, /7xx" @echo "make linux Linux optimized for i386" @echo "make linux-elf Linux optimized for i386, ELF format" @echo "make linux-i686 Linux optimized for i686" @echo "make linux-i686-elf Linux optimized for i686, ELF format" @echo "make linux-alpha Linux optimized for alpha" @echo "make freebsd FreeBSD" @echo "make freebsd-pgcc FreeBSD using Pentium GNU cc" @echo "make netbsd NetBSD" @echo "make netbsd-i386 NetBSD optimized for i386" @echo "make netbsd-i386-elf NetBSD optimized for i386, ELF format" @echo "make netbsd-sparc NetBSD optimized for sparc" @echo "make next NeXTSTEP" @echo "make os2 IBM OS/2 Warp" @echo "make sgi SGI running IRIX" @echo "make solaris Solaris 2.x" @echo "make solaris-gcc Solaris 2.x using GNU cc" @echo "" @echo "make generic Try this one if your system isn't listed above;" @echo " it assumes you have installed GNU cc" @echo "" aix: $(MAKE) target=AIX \ CC=cc CXX=$$(CC) CYY=cc \ CFLAGS='$(CFLAGS) -O2' \ CXFLAGS=$(CFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS' \ crafty-make alpha: $(MAKE) target=ALPHA \ CC=cc CXX=cxx CYY=cc \ CFLAGS='$(CFLAGS) -std -fast -O4 -pthread -newc' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread -lexc' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX' \ crafty-make alpha-host: $(MAKE) target=ALPHA \ CC=cc CXX=cxx CYY=cc \ CFLAGS='$(CFLAGS) -std -fast -O4 -pthread -newc -arch host' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread -lexc' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX' \ crafty-make alpha-host-nocix: $(MAKE) target=ALPHA \ CC=cc CXX=cxx CYY=cc \ CFLAGS='$(CFLAGS) -std -fast -O4 -pthread -newc \ CXFLAGS=$(CFLAGS) \ -arch ev56 -tune host' \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread -lexc' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX' \ crafty-make cygwin: $(MAKE) target=LINUX \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -pipe -D_REENTRANT -mpentium -O2 -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-aout.o \ crafty-make dos: $(MAKE) target=DOS \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make NT_i386: $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make NT_i386_alt: # an alternative, but I got slightly better results # with AMD Athlon 900 and Win 2000 with the other option, see above. $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make freebsd: $(MAKE) target=FreeBSD \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3 -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-elf.o \ crafty-make freebsd-pgcc: $(MAKE) target=FreeBSD \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -pipe -D_REENTRANT -mpentium -O -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-elf.o \ crafty-make hpux: $(MAKE) target=HP \ CC=cc CXX='$$(CC)' CYY=cc \ CFLAGS='$(CFLAGS) +ESlit -Ae +w1' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) +O3 +Onolimit $(CFLAGS)' \ crafty-make linux: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -O3' \ CXFLAGS='$(CFLAGS) \ -fforce-mem -fomit-frame-pointer' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-aout.o \ crafty-make linux-elf: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -O3 \ -fforce-mem -fomit-frame-pointer' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-elf.o \ crafty-make linux-i686: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -march=i686 -O \ -fforce-mem -fomit-frame-pointer \ -mpreferred-stack-boundary=2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-aout.o \ crafty-make linux-i686-elf: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -march=i686 -O3 \ -fbranch-probabilities -fforce-mem -fomit-frame-pointer \ -fno-gcse -mpreferred-stack-boundary=2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread -lstdc++' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT -DTRACE' \ asm=X86-elf.o \ crafty-make linux-i686-elf-profile: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -march=i686 -O3 \ -fprofile-arcs -fforce-mem \ -fno-gcse -mpreferred-stack-boundary=2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -fprofile-arcs -lstdc++ -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make linux-icc-elf-profile: $(MAKE) target=LINUX \ CC=icc CXX=icc CYY=icc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_gen -prof_dir ./profdir \ -fno-alias -tpp6' \ CXFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_gen -prof_dir ./profdir \ -tpp6' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make linux-icc-elf: $(MAKE) target=LINUX \ CC=icc CXX=icc CYY=icc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_use -prof_dir ./profdir \ -fno-alias -tpp6' \ CXFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_use -prof_dir ./profdir \ -tpp6' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make icc-elf: $(MAKE) target=LINUX \ CC=icc CXX=icc CYY=icc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentium4 \ -mcpu=pentium4 -fno-alias -tpp7' \ CXFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentium4 \ -mcpu=pentium4 -tpp7' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make # You may wish to add additional targets called linux-alpha-your_cpu # to produce optimized code for your CPU. Just copy the linux-alpha target # and add -mcpu=your_cpu to the CFLAGS, where the type of your CPU is # ev4,ev45... or 21064,21064A... Or, just type # # make linux-alpha CFLAGS='-mcpu=your_cpu' # # If you have the Compaq C Compiler for AlphaLinux you can link the # machine/builtins.h from ccc's private include file to /usr/include/alpha, # link the directory alpha to machine and remove -DNOBUILTINS from the # opt-line. # # THIS TARGET IS EXPERIMENTAL !!! linux-alpha: $(MAKE) target=ALPHA \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -O4 -ffast-math -funroll-loops' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX -DNOBUILTINS' \ crafty-make netbsd: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST' \ crafty-make netbsd-i386: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall -m486 \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm=X86-aout.o \ crafty-make netbsd-i386-elf: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall -m486 \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm=X86-elf.o \ crafty-make netbsd-sparc: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST \ -DUSE_ASSEMBLY_A' \ asm=Sparc.o \ crafty-make next: $(MAKE) target=NEXT \ CC=/bin/cc CXX='$$(CC)' CYY=/bin/cc \ CFLAGS='$(CFLAGS) -O2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' opt='$(opt) -DCOMPACT_ATTACKS' \ crafty-make os2: $(MAKE) target=OS2 \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3 -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -Zexe -Zcrtdll -s' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86.o \ crafty-make sgi: $(MAKE) target=SGI \ AS=/bin/as CC=cc CXX='$$(CC)' CYY=cc \ AFLAGS='-P' \ CFLAGS='$(CFLAGS) -32 -mips2 -cckr' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS' \ crafty-make solaris: $(MAKE) target=SUN \ AS=/usr/ccs/bin/as CC=cc CXX='$$(CC)' CYY=cc \ AFLAGS='-P' \ CFLAGS='$(CFLAGS) -fast -xO5 -xunroll=20' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DSMP -DCPUS=4 -DMUTEX -DPOSIX' \ asm=Sparc.o \ crafty-make solaris-gcc: $(MAKE) target=SUN \ AS=/usr/ccs/bin/as CC=gcc CXX=g++ CYY=gcc \ AFLAGS='-P' \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -O2 \ -fforce-mem -fomit-frame-pointer' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A' \ asm=Sparc.o \ crafty-make generic: $(MAKE) CC=gcc CXX=g++ CYY=gcc \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ crafty-make profile: @rm -rf profdir @rm -rf position.bin @mkdir profdir @touch *.c *.cpp *.h $(MAKE) linux-icc-elf-profile @echo "#!/bin/csh" runprof @echo "crafty EOF" runprof @echo "st=10" runprof @echo "ponder=off" runprof @echo "setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq" runprof @echo "move" runprof @echo "book off" runprof @echo "setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq" runprof @echo "move" runprof @echo "setboard 1k1r4/pp1b1R2/3q2pp/4p3/2B5/4Q3/PPP2B2/2K5 b" runprof @echo "move" runprof @echo "setboard 3r1k2/4npp1/1ppr3p/p6P/P2PPPP1/1NR5/5K2/2R5 w" runprof @echo "move" runprof @echo "setboard 2q1rr1k/3bbnnp/p2p1pp1/2pPp3/PpP1P1P1/1P2BNNP/2BQ1PRK/7R b" runprof @echo "move" runprof @echo "setboard rnbqkb1r/p3pppp/1p6/2ppP3/3N4/2P5/PPP1QPPP/R1B1KB1R w KQkq" runprof @echo "move" runprof @echo "setboard r1b2rk1/2q1b1pp/p2ppn2/1p6/3QP3/1BN1B3/PPP3PP/R4RK1 w" runprof @echo "move" runprof @echo "setboard 2r3k1/pppR1pp1/4p3/4P1P1/5P2/1P4K1/P1P5/8 w" runprof @echo "move" runprof @echo "setboard 1nk1r1r1/pp2n1pp/4p3/q2pPp1N/b1pP1P2/B1P2R2/2P1B1PP/R2Q2K1 w" runprof @echo "move" runprof @echo "setboard 4b3/p3kp2/6p1/3pP2p/2pP1P2/4K1P1/P3N2P/8 w" runprof @echo "move" runprof @echo "setboard 2kr1bnr/pbpq4/2n1pp2/3p3p/3P1P1B/2N2N1Q/PPP3PP/2KR1B1R w" runprof @echo "move" runprof @echo "setboard 3rr1k1/pp3pp1/1qn2np1/8/3p4/PP1R1P2/2P1NQPP/R1B3K1 b" runprof @echo "move" runprof @echo "setboard 2r1nrk1/p2q1ppp/bp1p4/n1pPp3/P1P1P3/2PBB1N1/4QPPP/R4RK1 w" runprof @echo "move" runprof @echo "setboard r3r1k1/ppqb1ppp/8/4p1NQ/8/2P5/PP3PPP/R3R1K1 b" runprof @echo "move" runprof @echo "setboard r2q1rk1/4bppp/p2p4/2pP4/3pP3/3Q4/PP1B1PPP/R3R1K1 w" runprof @echo "move" runprof @echo "setboard rnb2r1k/pp2p2p/2pp2p1/q2P1p2/8/1Pb2NP1/PB2PPBP/R2Q1RK1 w" runprof @echo "move" runprof @echo "setboard 2r3k1/1p2q1pp/2b1pr2/p1pp4/6Q1/1P1PP1R1/P1PN2PP/5RK1 w" runprof @echo "move" runprof @echo "setboard r1bqkb1r/4npp1/p1p4p/1p1pP1B1/8/1B6/PPPN1PPP/R2Q1RK1 w kq" runprof @echo "move" runprof @echo "setboard r2q1rk1/1ppnbppp/p2p1nb1/3Pp3/2P1P1P1/2N2N1P/PPB1QP2/R1B2RK1 b" runprof @echo "move" runprof @echo "setboard r1bq1rk1/pp2ppbp/2np2p1/2n5/P3PP2/N1P2N2/1PB3PP/R1B1QRK1 b" runprof @echo "move" runprof @echo "setboard 3rr3/2pq2pk/p2p1pnp/8/2QBPP2/1P6/P5PP/4RRK1 b" runprof @echo "move" runprof @echo "setboard r4k2/pb2bp1r/1p1qp2p/3pNp2/3P1P2/2N3P1/PPP1Q2P/2KRR3 w" runprof @echo "move" runprof @echo "setboard 3rn2k/ppb2rpp/2ppqp2/5N2/2P1P3/1P5Q/PB3PPP/3RR1K1 w" runprof @echo "move" runprof @echo "setboard 2r2rk1/1bqnbpp1/1p1ppn1p/pP6/N1P1P3/P2B1N1P/1B2QPP1/R2R2K1 b" runprof @echo "move" runprof @echo "setboard r1bqk2r/pp2bppp/2p5/3pP3/P2Q1P2/2N1B3/1PP3PP/R4RK1 b kq" runprof @echo "move" runprof @echo "setboard r2qnrnk/p2b2b1/1p1p2pp/2pPpp2/1PP1P3/PRNBB3/3QNPPP/5RK1 w" runprof @echo "move" runprof @echo "setboard /k/3p/p2P1p/P2P1P///K/ w" runprof @echo "move" runprof @echo "setboard /k/rnn////5RBB/K/ w" runprof @echo "move" runprof @echo "mt=0" runprof @echo "quit" runprof @echo "EOF" runprof @chmod +x runprof @./runprof @echo "#!/bin/csh" runprof @echo "crafty EOF" runprof @echo "st=10" runprof @echo "ponder=off" runprof @echo "mt=4" runprof @echo "setboard 2r2rk1/1bqnbpp1/1p1ppn1p/pP6/N1P1P3/P2B1N1P/1B2QPP1/R2R2K1 b" runprof @echo "move" runprof @echo "mt=0" runprof @echo "quit" runprof @echo "EOF" runprof @chmod +x runprof @./runprof @rm runprof @touch *.c *.cpp *.h $(MAKE) linux-icc-elf # Do not change anything below this line! opts = $(opt) -D$(target) objects = searchr.o search.o thread.o searchmp.o repeat.o next.o nexte.o \ nextr.o history.o quiesce.o evaluate.o movgen.o make.o unmake.o hash.o \ attacks.o swap.o boolean.o utility.o valid.o probe.o book.o data.o \ drawn.o edit.o epd.o epdglue.o init.o input.o interupt.o iterate.o \ main.o option.o output.o phase.o ponder.o preeval.o resign.o root.o \ learn.o setboard.o test.o testepd.o time.o validate.o annotate.o \ analyze.o evtest.o bench.o egtb.o dgt.o $(asm) includes = data.h chess.h epdincludes = epd.h epddefs.h epdglue.h eval_users = data.o evaluate.o preeval.o crafty-make: @$(MAKE) \ opt='$(opt)' asm='$(asm)' \ crafty crafty: $(objects) $(CYY) $(LDFLAGS) -o crafty $(objects) -lm $(LIBS) @rm -f X86-elf.S @rm -f X86-aout.S dgt: dgtdrv.o @cc -O -o dgt dgtdrv.c egtb.o: egtb.cpp $(CXX) -c $(CXFLAGS) $(opts) egtb.cpp clean: -rm -f *.o crafty X86-elf.X X86-aout.S $(objects): $(includes) $(eval_users): evaluate.h epd.o epdglue.o option.o init.o : $(epdincludes) ..c.o: $(CC) $(CFLAGS) $(opts) -c $*.c ..s.o: $(AS) $(AFLAGS) --defsym ALIGN=4 -o $*.o $*.s X86-aout.o: sed -e 's/ALIGN/4/' X86.s X86-aout.S $(CC) -c X86-aout.S @rm X86-aout.S X86-elf.o: sed -e '/ _/s// /' -e '/^_/s///' -e 's/ALIGN/16/' X86.s X86-elf.S $(CC) -c X86-elf.S @rm X86-elf.S ##### ----- END of MAKEFILE ----- ##### |
|
#7
|
|||
|
|||
|
[here is an editorially revised version]
--------------------------------------------------------------- How to Compile Crafty 19.6 with Dev-Cpp (GCC/GPP) under Windows --------------------------------------------------------------- A "Cook Book" I used version 4.9.8.5 (a stable beta of version 5) incl. gcc/g++ 3.2 ('mingw special 20020817-1') under Win 2000 and an AMD Athlon 900 MHz. Also successfully tried with Crafty 19.2 No change of source code necessary! Date: 7.12.2003 ---------------------------------------------------------------------- CONTENTS ---------------------------------------------------------------------- Ch. 1: The Quickest Way to Compile Crafty 1.1 - Using the IDE of Dev-C++ 1.1.1 - Further Speed Optimisations 1.2 - Using Your Own Makefile Ch. 2: How to Evaluate Crafty Calculation Speed Ch. 3: Measurement Results of Calculation Speed for Different Compiler Settings ANNEX: Makefiles to be used with Dev-C++ A.1 - The "Short" Makefile A.2 - The "Long" Makefile ------------------------------------------------------------------------ ------------------------------------------------------------------------ ----------------------------------------- Ch. 1: The Quickest Way to Compile Crafty ----------------------------------------- 1.1 - Using the IDE of Dev-C++ ============================== (1) Goto http://www.bloodshed.net/dev/devcpp.html - Download devcpp4980.exe - Download latest update (currently (7.12.2003) devcpp4985.zip) [this is a DELTA to above install, so you need both] - Install dev-cpp properly, for example in C:\Dev-Cpp\ (2) Download Crafty 19.6 from ftp://ftp.cis.uab.edu/pub/hyatt/v19/crafty-19.6.zip (3) Extract the contents of the zip-file crafty-19.6.zip to a working directory, for example to C:\c-files\crafty\ (4) Start the Graphical Windows-Like Integrated Development Environment (IDE) of Dev-CPP by starting C:\Dev-Cpp\devcpp.exe. (5) Create a new project: - MENU: File - New - Project... - select Console application - find an appropriate project name, e.g. crafty1906 - select C++ -Project (NOT C-Project, because otherwise, later the linking will fail!) - click Ok - Save the project file for example under c:\c-files\crafty\crafty1906.dev -- A new project comes up with a default file "main.c" -- In the project browser on the left, expand the tree and right-click on main.c and select "remove file" and then click "do not save" -- Now you should have a completely empty project -- very well! (6) Include source files to the project: - On the left, right-click on the project and select "Add To Project" -- Mark all .c and .h and .cpp files in "c:\c-files\crafty\", BESIDES crafty.c and dgtdrv.c (!!) Note: These two files are not needed at all! If included in the project, they will cause compilation errors! -- Now the project tree on the left should contain all those files, 62 files altogether. Ok? - very well! (7) Continue as follows: - Goto MENU - Project - Project Options - Select the second pane "Files" - Now all .c, .h an the one .cpp file should be checked for the oxes "Include in Compilation", "Include in inking" and "Compile file as C++". - Mark all files *besides* egtb.cpp and UNcheck the box "Compile file as C++". Now all files should be unchecked for this, besides egtb.cpp, which is still checked to be compiled as C++. - Select the 4th pane "Parameters" - Add the following command line option to BOTH the C-Compiler (left field) and the C++ compiler (middle field): "-DNT_i386" (without quotation marks) Remark: This causes the variable "NT_i386" to be defined already when the pre-compiler starts. -- click Ok. -- Now your project is well configured. If you want, you can save the project now, to save the changes. (7) Compile the project by clicking the compile button or pressing CTRL-F9. (8) Now an exe-file should be created after some time, for example c:\c-files\crafty\crafty1906.exe Note: You should get 0 warnings during compilation stage and 7 warnings during linking stage. Number of errors = zero. 1.1.1 - Further Speed Optimisations ----------------------------------- Execution speed of the generated exe file can (and should!) be increased by this: - MENU - Project - Project Options: Select the 3rd pane "Compiler - Optimisation - Further Optimisations": -- Select "Best Optimisation"-Yes. - Select the 4th pane "Parameters" - Add the following command line option to BOTH the C-Compiler (left field) and the C++ compiler (middle field) [in addition to -DNT_i386, which is already there]: "-fomit-frame-pointer" (without quotation marks) - click Ok Now, possibly delete the *.o files and the exe file of your directory and compile another time. Even better speed-optimised code (compare test list of ch. 3) is generated when using your own makefile! This is described in ch 1.2. 1.2 - Using Your Own Makefile ============================= - If not already done, do the steps (1) to (6) of ch. 1.1. - Now MENU - Project - Project Options - Select the pane "Makefile" - Check the box "Use custom makefile" - Select the makefile in the field below. ATTENTION: It must have the name "Makefile" literally! Otherwise, if it is called for example "MakefCraftyDevcpp", you will get an error! Therefore, rename or delete the original file "Makefile" of the Crafty delivery, and substitute it by your own makefile called nothing different but "Makefile". The makefile to be used is given in the ANNEX of this information and would naturally be located in the same directory as the Crafty sources. You can either use the short Makefile or the long one given in the annex. The short one can only be used for compilation with gcc under windows, while the long one is a generalisation of the original Crafty makefile and can still be used for compilation on other platforms like UNIX, MAC OS, LINUX etc. ----------------------------------------------- Ch. 2: How to Evaluate Crafty Calculation Speed ----------------------------------------------- The following tests are designed to compare different compiled versions of Crafty on the same machine for comparing calculation speed differences. - Copy the crafty.exe file to a location where it is completely standalone, i.e. without any opening book accessible, i.e. no book.bin files in the same directory as the exe file. - Start the exe - a DOS box opens. - Test 1: (repeat 2 or 3 times to see how it varies) - type "perf" enter -- this will show a performance figure. The higher the better. (or a number of seconds: The lower the better) - Test 2: (repeat 2 or 3 times to see how it varies) - type "noise 10000000" enter [suppress display while thinking] - type "st 2" enter [set a fixed thinking time of 2 seconds] - type "e2e4" enter [make a starting move e2-e4] -- Now Crafty will think for 2 seconds. -- Read the number for "nodes" and "evals". The higher the better. Some of these test results are presented in ch. 3. ---------------------------------------------------------------------------- --- Ch. 3: Measurement Results of Calculation Speed for Different Compiler Settings ---------------------------------------------------------------------------- --- PC Configuration: AMD Athlon 900, 256 MByte RAM, Windows 2000 Crafty 19.06: ------------- | "perf" nodes per 2sec | (smaller=better) (larger=better) | | gener. made/unmade nodes evals Compiler Setting: | (performance in percent of last row) ------------------------------------+--------------------------------------- | Compile from IDE, no optimisations | 3.49s 12.04s 339860 154975 | (66%) (63%) (63%) (66%) | | Compile from IDE, set | 2.47s 8.47s 484818 212096 "Best Optimisation" (corresponding | (93%) (90%) (90%) (91%) to option -O3) | | Compile from IDE, set | 2.40s 7.78s 478781 208939 "Best Optimisation" and | (96%) (98%) (89%) (89%) "-fomit-frame-pointer" | | Use own Makefile, as above, but | 2.44s 7.76s 493939 215116 w/o "-DUSE_ATTACK_FUNCTIONS" | (94%) (98%) (92%) (92%) | | Use own Makefile, as above, but | 2.34s 8.37s 493939 215116 w/o "-fomit-frame-pointer" | (98%) (91%) (92%) (92%) | | Use own Makefile, as above, but | 2.28s 8.03s 533160 232414 with "-m486" | (101%) (95%) (99%) (99%) | | Use own Makefile, as above | 2.30s 7.62s 536177 233882 | (100%) (100%) (100%) (100%) | For comparison: Crafty 19.2 ----------- | Compiled with own makefile above: | 2.32s 7.64s 534457 256886 | (100%) (100%) (100%) (100%) | Executable downloaded | 2.07s 6.29s 655082 310738 from Crafty's programmer's | (112%) (121%) (123%) (121%) website at | ftp://ftp.cis.uab.edu/pub/hyatt/v19/crafty-19.02.exe (probably compiled with MSVC) | | ------------------------------------+----------------------------------- -- MSVC is faster than gcc 3.2 | by... (for Crafty 19.2) | 12% 21% 23% 21% | ------------------------------------+----------------------------------- ---------------------------------------- ANNEX: Makefiles to be used with Dev-C++ ---------------------------------------- Here are two possible makefiles! Take care that the makefile is saved literally with the filename "Makefile"! Both makefiles given below produce 100% identical code with Dev-C++. A.1: The "Short" Makefile ========================= This makefile can only be used for compilation with gcc under windows ##### ----- START of MAKEFILE ----- ##### all: NT_i386 NT_i386: $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make NT_i386_alt: # an alternative, but I got slightly better results # with AMD Athlon 900 and Win 2000 with the other option, see above. $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make opts = $(opt) -D$(target) opts = $(opt) -D$(target) objects = searchr.o search.o thread.o searchmp.o repeat.o next.o nexte.o \ nextr.o history.o quiesce.o evaluate.o movgen.o make.o unmake.o hash.o \ attacks.o swap.o boolean.o utility.o valid.o probe.o book.o data.o \ drawn.o edit.o epd.o epdglue.o init.o input.o interupt.o iterate.o \ main.o option.o output.o phase.o ponder.o preeval.o resign.o root.o \ learn.o setboard.o test.o testepd.o time.o validate.o annotate.o \ analyze.o evtest.o bench.o egtb.o dgt.o $(asm) includes = data.h chess.h epdincludes = epd.h epddefs.h epdglue.h eval_users = data.o evaluate.o preeval.o crafty-make: @$(MAKE) \ opt='$(opt)' asm='$(asm)' \ crafty crafty: $(objects) $(CYY) $(LDFLAGS) -o crafty $(objects) -lm $(LIBS) dgt: dgtdrv.o @cc -O -o dgt dgtdrv.c egtb.o: egtb.cpp $(CXX) -c $(CXFLAGS) $(opts) egtb.cpp clean: -rm -f *.o crafty X86-elf.X X86-aout.S $(objects): $(includes) $(eval_users): evaluate.h epd.o epdglue.o option.o init.o : $(epdincludes) ..c.o: $(CC) $(CFLAGS) $(opts) -c $*.c ..s.o: $(AS) $(AFLAGS) --defsym ALIGN=4 -o $*.o $*.s ##### ----- END of MAKEFILE ----- ##### A.2: The "Long" Makefile ======================== This makefile is a generalisation of the original crafty makefile and can still be used for compilation on other platforms. ##### ----- START of MAKEFILE ----- ##### # To build crafty: # # You want to set up for maximum optimization, but typically you will # need to experiment to see which options provide the fastest code. # This is optimized for pgcc, which is a fairly current compiler. # # The currently available targets: # # AIX {IBM machines running AIX} # ALPHA {DEC Alpha running OSF/1-Digital Unix} # ALPHALINUX {DEC Alpha running Linux} # CRAY1 {any Cray-1 compatible architecture including XMP, YMP, # C90, etc.} # HP {HP workstation running HP_UX operating system (Unix)} # LINUX {80X86 architecture running LINUX (Unix)} # NT_i386 {80X86 architecture running Windows 95 or NT} # NT_AXP {DEC Alpha running Windows NT} # DOS {PC running dos/windows, using DJGPP port of gcc to compile} # NEXT {NextStep} # OS/2 {IBM OS/2 warp} # SGI {SGI Workstation running Irix (SYSV/R4) Unix} # SUN {Sun SparcStation running Solaris (SYSV/R4) Unix} # SUN_GCC {Sun SparcStation running Solaris but using gcc # FreeBSD {80X86 architecture running FreeBSD (Unix)} # NetBSD {multi-architecture running NetBSD (Unix)} # Cygwin {80X86 running Cygwin under Win32 (Unix)} # # The next options are optimizations inside Crafty that you will have # test to see if they help. on some machines, these will slow things # by up to 10%, while on other machines these options will result in # improving search speed up to 20%. NOTE: if you are running Linux # or have a SUN Sparc-20 machine, the default configurations below # will use the hand-written assembly modules. Typical performance # improvement is 33%, but this only applies to X86 machines and the # Sun Sparc-20. # # 1. opt = -DCOMPACT_ATTACKS # 2. opt = -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS # # Finally, if you have a Symmetric MultiProcessor machine, you should # add -DSMP to the opt definition for your make configuration, and then # add -DCPUS=N where N is the number of processors (max) you will use. # # if you want 6 man EGTB support, you will need to add -DEGTB6 to the # options above. all: NT_i386 # this target "all" specifies the target(s) that is (are) # used when make is called without argument. # Used for Dev-C++ GNU compiler under Windows. default: $(MAKE) -j4 linux-icc-elf help: @echo "You must specify the system which you want to compile for:" @echo "" @echo "make aix IBM AIX" @echo "make alpha DEC Alpha with OSF/1-Digital UNIX" @echo "make alpha-host Alpha DECstation optimized for host" @echo "make alpha-host-nocix Alpha DECstation optimezed for host, no CIX insn" @echo "make cygwin Cygwin under Win32" @echo "make dos DOS on i386 with DJGPP" @echo "make NT_i386 Windows, e.g. with Dev-C++ v4.9.8.5 (GCC/G++ 3.2)" @echo "make hpux HP/UX 9/10, /7xx" @echo "make linux Linux optimized for i386" @echo "make linux-elf Linux optimized for i386, ELF format" @echo "make linux-i686 Linux optimized for i686" @echo "make linux-i686-elf Linux optimized for i686, ELF format" @echo "make linux-alpha Linux optimized for alpha" @echo "make freebsd FreeBSD" @echo "mke freebsd-pgcc FreeBSD using Pentium GNU cc" @echo "make netbsd NetBSD" @echo "make netbsd-i386 NetBSD optimized for i386" @echo "make netbsd-i386-elf NetBSD optimized for i386, ELF format" @echo "make netbsd-sparc NetBSD optimized for sparc" @echo "make next NeXTSTEP" @echo "make os2 IBM OS/2 Warp" @echo "make sgi SGI running IRIX" @echo "make solaris Solaris 2.x" @echo "make solaris-gcc Solaris 2.x using GNU cc" @echo "" @echo "make generic Try this one if your system isn't listed above;" @echo " it assumes you have installed GNU cc" @echo "" aix: $(MAKE) target=AIX \ CC=cc CXX=$$(CC) CYY=cc \ CFLAGS='$(CFLAGS) -O2' \ CXFLAGS=$(CFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS' \ crafty-make alpha: $(MAKE) target=ALPHA \ CC=cc CXX=cxx CYY=cc \ CFLAGS='$(CFLAGS) -std -fast -O4 -pthread -newc' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread -lexc' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX' \ crafty-make alpha-host: $(MAKE) target=ALPHA \ CC=cc CXX=cxx CYY=cc \ CFLAGS='$(CFLAGS) -std -fast -O4 -pthread -newc -arch host' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread -lexc' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX' \ crafty-make alpha-host-nocix: $(MAKE) target=ALPHA \ CC=cc CXX=cxx CYY=cc \ CFLAGS='$(CFLAGS) -std -fast -O4 -pthread -newc \ CXFLAGS=$(CFLAGS) \ -arch ev56 -tune host' \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread -lexc' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX' \ crafty-make cygwin: $(MAKE) target=LINUX \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -pipe -D_REENTRANT -mpentium -O2 -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-aout.o \ crafty-make dos: $(MAKE) target=DOS \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make NT_i386: $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make NT_i386_alt: # an alternative, but I got slightly better results # with AMD Athlon 900 and Win 2000 with the other option, see above. $(MAKE) target=NT_i386 \ CC=gcc CXX=g++ CYY=g++\ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm='X86.o' \ crafty-make freebsd: $(MAKE) target=FreeBSD \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3 -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-elf.o \ crafty-make freebsd-pgcc: $(MAKE) target=FreeBSD \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -pipe -D_REENTRANT -mpentium -O -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-elf.o \ crafty-make hpux: $(MAKE) target=HP \ CC=cc CXX='$$(CC)' CYY=cc \ CFLAGS='$(CFLAGS) +ESlit -Ae +w1' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) +O3 +Onolimit $(CFLAGS)' \ crafty-make linux: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -O3' \ CXFLAGS='$(CFLAGS) \ -fforce-mem -fomit-frame-pointer' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-aout.o \ crafty-make linux-elf: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -O3 \ -fforce-mem -fomit-frame-pointer' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86-elf.o \ crafty-make linux-i686: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -march=i686 -O \ -fforce-mem -fomit-frame-pointer \ -mpreferred-stack-boundary=2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-aout.o \ crafty-make linux-i686-elf: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -march=i686 -O3 \ -fbranch-probabilities -fforce-mem -fomit-frame-pointer \ -fno-gcse -mpreferred-stack-boundary=2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread -lstdc++' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT -DTRACE' \ asm=X86-elf.o \ crafty-make linux-i686-elf-profile: $(MAKE) target=LINUX \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -march=i686 -O3 \ -fprofile-arcs -fforce-mem \ -fno-gcse -mpreferred-stack-boundary=2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -fprofile-arcs -lstdc++ -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make linux-icc-elf-profile: $(MAKE) target=LINUX \ CC=icc CXX=icc CYY=icc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_gen -prof_dir ./profdir \ -fno-alias -tpp6' \ CXFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_gen -prof_dir ./profdir \ -tpp6' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make linux-icc-elf: $(MAKE) target=LINUX \ CC=icc CXX=icc CYY=icc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_use -prof_dir ./profdir \ -fno-alias -tpp6' \ CXFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentiumiii \ -mcpu=pentiumpro -prof_use -prof_dir ./profdir \ -tpp6' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make icc-elf: $(MAKE) target=LINUX \ CC=icc CXX=icc CYY=icc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentium4 \ -mcpu=pentium4 -fno-alias -tpp7' \ CXFLAGS='$(CFLAGS) -D_REENTRANT -O2 -march=pentium4 \ -mcpu=pentium4 -tpp7' \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \ -DSMP -DCPUS=4 -DDGT' \ asm=X86-elf.o \ crafty-make # You may wish to add additional targets called linux-alpha-your_cpu # to produce optimized code for your CPU. Just copy the linux-alpha target # and add -mcpu=your_cpu to the CFLAGS, where the type of your CPU is # ev4,ev45... or 21064,21064A... Or, just type # # make linux-alpha CFLAGS='-mcpu=your_cpu' # # If you have the Compaq C Compiler for AlphaLinux you can link the # machine/builtins.h from ccc's private include file to /usr/include/alpha, # link the directory alpha to machine and remove -DNOBUILTINS from the # opt-line. # # THIS TARGET IS EXPERIMENTAL !!! linux-alpha: $(MAKE) target=ALPHA \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -O4 -ffast-math -funroll-loops' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' \ LIBS='-lpthread' \ opt='$(opt) -DSMP -DCPUS=8 -DFAST -DPOSIX -DNOBUILTINS' \ crafty-make netbsd: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST' \ crafty-make netbsd-i386: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall -m486 \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm=X86-aout.o \ crafty-make netbsd-i386-elf: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall -m486 \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B' \ asm=X86-elf.o \ crafty-make netbsd-sparc: $(MAKE) target=NetBSD \ CC=gcc CXX=g++ CYY=gcc \ CFLAGS='$(CFLAGS) -D_REENTRANT -O3 -Wall \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST \ -DUSE_ASSEMBLY_A' \ asm=Sparc.o \ crafty-make next: $(MAKE) target=NEXT \ CC=/bin/cc CXX='$$(CC)' CYY=/bin/cc \ CFLAGS='$(CFLAGS) -O2' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) $(CFLAGS)' opt='$(opt) -DCOMPACT_ATTACKS' \ crafty-make os2: $(MAKE) target=OS2 \ CC=gcc CXX='$$(CC)' CYY=gcc \ CFLAGS='$(CFLAGS) -fomit-frame-pointer -m486 -O3 -Wall' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -Zexe -Zcrtdll -s' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST' \ asm=X86.o \ crafty-make sgi: $(MAKE) target=SGI \ AS=/bin/as CC=cc CXX='$$(CC)' CYY=cc \ AFLAGS='-P' \ CFLAGS='$(CFLAGS) -32 -mips2 -cckr' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS' \ crafty-make solaris: $(MAKE) target=SUN \ AS=/usr/ccs/bin/as CC=cc CXX='$$(CC)' CYY=cc \ AFLAGS='-P' \ CFLAGS='$(CFLAGS) -fast -xO5 -xunroll=20' \ CXFLAGS=$(CFLAGS) \ LDFLAGS='$(LDFLAGS) -lpthread' \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A -DSMP -DCPUS=4 -DMUTEX -DPOSIX' \ asm=Sparc.o \ crafty-make solaris-gcc: $(MAKE) target=SUN \ AS=/usr/ccs/bin/as CC=gcc CXX=g++ CYY=gcc \ AFLAGS='-P' \ CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT -O2 \ -fforce-mem -fomit-frame-pointer' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ opt='$(opt) -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \ -DUSE_ASSEMBLY_A' \ asm=Sparc.o \ crafty-make generic: $(MAKE) CC=gcc CXX=g++ CYY=gcc \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ crafty-make profile: @rm -rf profdir @rm -rf position.bin @mkdir profdir @touch *.c *.cpp *.h $(MAKE) linux-icc-elf-profile @echo "#!/bin/csh" runprof @echo "crafty EOF" runprof @echo "st=10" runprof @echo "ponder=off" runprof @echo "setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq" runprof @echo "move" runprof @echo "book off" runprof @echo "setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq" runprof @echo "move" runprof @echo "setboard 1k1r4/pp1b1R2/3q2pp/4p3/2B5/4Q3/PPP2B2/2K5 b" runprof @echo "move" runprof @echo "setboard 3r1k2/4npp1/1ppr3p/p6P/P2PPPP1/1NR5/5K2/2R5 w" runprof @echo "move" runprof @echo "setboard 2q1rr1k/3bbnnp/p2p1pp1/2pPp3/PpP1P1P1/1P2BNNP/2BQ1PRK/7R b" runprof @echo "move" runprof @echo "setboard rnbqkb1r/p3pppp/1p6/2ppP3/3N4/2P5/PPP1QPPP/R1B1KB1R w KQkq" runprof @echo "move" runprof @echo "setboard r1b2rk1/2q1b1pp/p2ppn2/1p6/3QP3/1BN1B3/PPP3PP/R4RK1 w" runprof @echo "move" runprof @echo "setboard 2r3k1/pppR1pp1/4p3/4P1P1/5P2/1P4K1/P1P5/8 w" runprof @echo "move" runprof @echo "setboard 1nk1r1r1/pp2n1pp/4p3/q2pPp1N/b1pP1P2/B1P2R2/2P1B1PP/R2Q2K1 w" runprof @echo "move" runprof @echo "setboard 4b3/p3kp2/6p1/3pP2p/2pP1P2/4K1P1/P3N2P/8 w" runprof @echo "move" runprof @echo "setboard 2kr1bnr/pbpq4/2n1pp2/3p3p/3P1P1B/2N2N1Q/PPP3PP/2KR1B1R w" runprof @echo "move" runprof @echo "setboard 3rr1k1/pp3pp1/1qn2np1/8/3p4/PP1R1P2/2P1NQPP/R1B3K1 b" runprof @echo "move" runprof @echo "setboard 2r1nrk1/p2q1ppp/bp1p4/n1pPp3/P1P1P3/2PBB1N1/4QPPP/R4RK1 w" runprof @echo "move" runprof @echo "setboard r3r1k1/ppqb1ppp/8/4p1NQ/8/2P5/PP3PPP/R3R1K1 b" runprof @echo "move" runprof @echo "setboard r2q1rk1/4bppp/p2p4/2pP4/3pP3/3Q4/PP1B1PPP/R3R1K1 w" runprof @echo "move" runprof @echo "setboard rnb2r1k/pp2p2p/2pp2p1/q2P1p2/8/1Pb2NP1/PB2PPBP/R2Q1RK1 w" runprof @echo "move" runprof @echo "setboard 2r3k1/1p2q1pp/2b1pr2/p1pp4/6Q1/1P1PP1R1/P1PN2PP/5RK1 w" runprof @echo "move" runprof @echo "setboard r1bqkb1r/4npp1/p1p4p/1p1pP1B1/8/1B6/PPPN1PPP/R2Q1RK1 w kq" runprof @echo "move" runprof @echo "setboard r2q1rk1/1ppnbppp/p2p1nb1/3Pp3/2P1P1P1/2N2N1P/PPB1QP2/R1B2RK1 b" runprof @echo "move" runprof @echo "setboard r1bq1rk1/pp2ppbp/2np2p1/2n5/P3PP2/N1P2N2/1PB3PP/R1B1QRK1 b" runprof @echo "move" runprof @echo "setboard 3rr3/2pq2pk/p2p1pnp/8/2QBPP2/1P6/P5PP/4RRK1 b" runprof @echo "move" runprof @echo "setboard r4k2/pb2bp1r/1p1qp2p/3pNp2/3P1P2/2N3P1/PPP1Q2P/2KRR3 w" runprof @echo "move" runprof @echo "setboard 3rn2k/ppb2rpp/2ppqp2/5N2/2P1P3/1P5Q/PB3PPP/3RR1K1 w" runprof @echo "move" runprof @echo "setboard 2r2rk1/1bqnbpp1/1p1ppn1p/pP6/N1P1P3/P2B1N1P/1B2QPP1/R2R2K1 b" runprof @echo "move" runprof @echo "setboard r1bqk2r/pp2bppp/2p5/3pP3/P2Q1P2/2N1B3/1PP3PP/R4RK1 b kq" runprof @echo "move" runprof @echo "setboard r2qnrnk/p2b2b1/1p1p2pp/2pPpp2/1PP1P3/PRNBB3/3QNPPP/5RK1 w" runprof @echo "move" runprof @echo "setboard /k/3p/p2P1p/P2P1P///K/ w" runprof @echo "move" runprof @echo "setboard /k/rnn////5RBB/K/ w" runprof @echo "move" runprof @echo "mt=0" runprof @echo "quit" runprof @echo "EOF" runprof @chmod +x runprof @./runprof @echo "#!/bin/csh" runprof @echo "crafty EOF" runprof @echo "st=10" runprof @echo "ponder=off" runprof @echo "mt=4" runprof @echo "setboard 2r2rk1/1bqnbpp1/1p1ppn1p/pP6/N1P1P3/P2B1N1P/1B2QPP1/R2R2K1 b" runprof @echo "move" runprof @echo "mt=0" runprof @echo "quit" runprof @echo "EOF" runprof @chmod +x runprof @./runprof @rm runprof @touch *.c *.cpp *.h $(MAKE) linux-icc-elf # Do not change anything below this line! opts = $(opt) -D$(target) objects = searchr.o search.o thread.o searchmp.o repeat.o next.o nexte.o \ nextr.o history.o quiesce.o evaluate.o movgen.o make.o unmake.o hash.o \ attacks.o swap.o boolean.o utility.o valid.o probe.o book.o data.o \ drawn.o edit.o epd.o epdglue.o init.o input.o interupt.o iterate.o \ main.o option.o output.o phase.o ponder.o preeval.o resign.o root.o \ learn.o setboard.o test.o testepd.o time.o validate.o annotate.o \ analyze.o evtest.o bench.o egtb.o dgt.o $(asm) includes = data.h chess.h epdincludes = epd.h epddefs.h epdglue.h eval_users = data.o evaluate.o preeval.o crafty-make: @$(MAKE) \ opt='$(opt)' asm='$(asm)' \ crafty crafty: $(objects) $(CYY) $(LDFLAGS) -o crafty $(objects) -lm $(LIBS) @rm -f X86-elf.S @rm -f X86-aout.S dgt: dgtdrv.o @cc -O -o dgt dgtdrv.c egtb.o: egtb.cpp $(CXX) -c $(CXFLAGS) $(opts) egtb.cpp clean: -rm -f *.o crafty X86-elf.X X86-aout.S $(objects): $(includes) $(eval_users): evaluate.h epd.o epdglue.o option.o init.o : $(epdincludes) ..c.o: $(CC) $(CFLAGS) $(opts) -c $*.c ..s.o: $(AS) $(AFLAGS) --defsym ALIGN=4 -o $*.o $*.s X86-aout.o: sed -e 's/ALIGN/4/' X86.s X86-aout.S $(CC) -c X86-aout.S @rm X86-aout.S X86-elf.o: sed -e '/ _/s// /' -e '/^_/s///' -e 's/ALIGN/16/' X86.s X86-elf.S $(CC) -c X86-elf.S @rm X86-elf.S ##### ----- END of MAKEFILE ----- ##### |
|
#8
|
|||
|
|||
|
Michael Loggel wrote:
Hello everybody, please excuse this cross-posting, but I want to let the world participate in my success: I am proud of just having succeeded in successfully compiling the chess program Crafty 19.6 under Windows with GCC/GPP!!! Integration with Winboard 4.2.6 works fine, too. Also with FICS (free internet chess server)! It is probably slower than the Visual C++ version of the same. The main reason is that the gcc version is going through the cygwin dll for api emulation. How much slower, I am not sure, but it is probably significant. Tom Veldhouse |
|
#9
|
|||
|
|||
|
please excuse this cross-posting, but I want to let the world
participate in my success: I am proud of just having succeeded in successfully compiling the chess program Crafty 19.6 under Windows with GCC/GPP!!! Integration with Winboard 4.2.6 works fine, too. Also with FICS (free internet chess server)! It is probably slower than the Visual C++ version of the same. The main reason is that the gcc version is going through the cygwin dll for api emulation. How much slower, I am not sure, but it is probably significant. Tom Veldhouse The answer you can read in chapter 3 of my previous posting of the same main thread: 12..23% slower. But: gcc is free! Michael -- No Spam: For sending e-mail to me, write "wir_sinds" instead of "xyz.abc". |
|
#10
|
|||
|
|||
|
"Michael Loggel" wrote in message 6... please excuse this cross-posting, but I want to let the world participate in my success: I am proud of just having succeeded in successfully compiling the chess program Crafty 19.6 under Windows with GCC/GPP!!! Integration with Winboard 4.2.6 works fine, too. Also with FICS (free internet chess server)! It is probably slower than the Visual C++ version of the same. The main reason is that the gcc version is going through the cygwin dll for api emulation. How much slower, I am not sure, but it is probably significant. Tom Veldhouse The answer you can read in chapter 3 of my previous posting of the same main thread: 12..23% slower. But: gcc is free! Michael I don't think that cygwin interface has much to do with the performance as the crafty code is actually a tight loop calling all the times functions inside itself with virtually no system call during the search and evaluations (I'm talking about the part of the code doing the CHESS). The only possible cygwin system calls used during the time intensive operations would be of the memory manager, however I hardly doubt that it would effect anything as local heap managment has nothing to do with the OS---- no system call and also crafty is very well optimized and uses dynamic allocations minimally. Besides that, I can't think of any needed services from the OS for a chess software.... Regards |