Code: Select all
#include <malloc.h>
Simply comment out that line and all should be well.
Moderators: hgm, Rebel, chrisw
Code: Select all
#include <malloc.h>
Under Linux, Windows and MacOS using malloc.h should usually be redundant with current compilers, it is sufficient to include stdlib.h. So removing that line from Crafty should not create any platform dependencies.zullil wrote:on line 26 of chess.h prevents crafty-23.1 from compiling on Mac OS X systems (which neither have nor need malloc.h).Code: Select all
#include <malloc.h>
Simply comment out that line and all should be well.
Speaking of which, the "darwin" target seems to be quite out of date. It appears to assume a G4 processor (since there are no intel-specific optimization flags, and there is another "darwinG5" target). Apple hasn't shipped either processor for years.zullil wrote:on line 26 of chess.h prevents crafty-23.1 from compiling on Mac OS X systems (which neither have nor need malloc.h).Code: Select all
#include <malloc.h>
Simply comment out that line and all should be well.
This seems sensible to me. Why don't you post your proposed new version for the darwin target, and those who might care can comment. I'm sure Bob Hyatt would be happy to update the Makefile to reflect the current Mac hardware.IanO wrote:Speaking of which, the "darwin" target seems to be quite out of date. It appears to assume a G4 processor (since there are no intel-specific optimization flags, and there is another "darwinG5" target). Apple hasn't shipped either processor for years.zullil wrote:on line 26 of chess.h prevents crafty-23.1 from compiling on Mac OS X systems (which neither have nor need malloc.h).Code: Select all
#include <malloc.h>
Simply comment out that line and all should be well.
How about changing the "darwin" target to assume an Intel Core 2 Duo as the default architecture, 64-bit executables, and gcc 4.2.1 as the default toolchain. In my prior testing of version 23.0, the flags "-m64 -fast -DINLINE64" had the greatest impact. I also tried "-fomit_frame_pointer" and "-msse3 -mmmx" but they had no effect (admittedly, that test was under gcc 4.0.1). Tests were done with "bench", using "smpmt=1" for repeatability.
Perhaps retain a "darwinG4" target if you wish.
Fine by me. If someone can edit the Makefile, verify that it works, and send me the copy, I will make it the default. I obviously did not write the various Makefile options since I don't have all of those machines here.zullil wrote:This seems sensible to me. Why don't you post your proposed new version for the darwin target, and those who might care can comment. I'm sure Bob Hyatt would be happy to update the Makefile to reflect the current Mac hardware.IanO wrote:Speaking of which, the "darwin" target seems to be quite out of date. It appears to assume a G4 processor (since there are no intel-specific optimization flags, and there is another "darwinG5" target). Apple hasn't shipped either processor for years.zullil wrote:on line 26 of chess.h prevents crafty-23.1 from compiling on Mac OS X systems (which neither have nor need malloc.h).Code: Select all
#include <malloc.h>
Simply comment out that line and all should be well.
How about changing the "darwin" target to assume an Intel Core 2 Duo as the default architecture, 64-bit executables, and gcc 4.2.1 as the default toolchain. In my prior testing of version 23.0, the flags "-m64 -fast -DINLINE64" had the greatest impact. I also tried "-fomit_frame_pointer" and "-msse3 -mmmx" but they had no effect (admittedly, that test was under gcc 4.0.1). Tests were done with "bench", using "smpmt=1" for repeatability.
Perhaps retain a "darwinG4" target if you wish.
Code: Select all
darwin-x86_64:
$(MAKE) target=FreeBSD \
CC=gcc CXX=g++ \
CFLAGS='$(CFLAGS) -Wall -pipe -O3 -m64' \
CXFLAGS=$(CFLAGS) \
LDFLAGS=$(LDFLAGS) \
LIBS='-lpthread -lstdc++' \
opt='$(opt) -DCPUS=2' \
crafty-make
Code: Select all
White(1): mt=2
max threads set to 2.
White(1): bench
Running benchmark. . .
......
Total nodes: 127082421
Raw nodes per second: 4288978
Total elapsed time: 29.63
Code: Select all
darwin-x86_64:
$(MAKE) target=FreeBSD \
CC=gcc CXX=g++ \
CFLAGS='$(CFLAGS) -Wall -pipe -O3 -m64 -fast -DINLINE64' \
CXFLAGS=$(CFLAGS) \
LDFLAGS=$(LDFLAGS) \
LIBS='-lpthread -lstdc++' \
opt='$(opt) -DCPUS=2' \
crafty-make
Code: Select all
White(1): mt=2
max threads set to 2.
White(1): bench
Running benchmark. . .
......
Total nodes: 157182499
Raw nodes per second: 5544356
Total elapsed time: 28.35
Code: Select all
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#if !defined(FreeBSD)
# include <malloc.h>
#endif
#include <string.h>
#if !defined(TYPES_INCLUDED)
....
If you don't mind, please send me a Makefile that works on your box, modified from the distributed Makefile. I hate making editing changes that I can't verify easily and I want to avoid releasing a 23.2 that won't compile cleanly.schlucke wrote:Hi,
I do it this way (in Makefile)
Gives this bench results on my MacBook Pro (2.4 GHz Intel Core 2 Duo):Code: Select all
darwin-x86_64: $(MAKE) target=FreeBSD \ CC=gcc CXX=g++ \ CFLAGS='$(CFLAGS) -Wall -pipe -O3 -m64' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ LIBS='-lpthread -lstdc++' \ opt='$(opt) -DCPUS=2' \ crafty-make
With the suggested options:Code: Select all
White(1): mt=2 max threads set to 2. White(1): bench Running benchmark. . . ...... Total nodes: 127082421 Raw nodes per second: 4288978 Total elapsed time: 29.63
A little fasterCode: Select all
darwin-x86_64: $(MAKE) target=FreeBSD \ CC=gcc CXX=g++ \ CFLAGS='$(CFLAGS) -Wall -pipe -O3 -m64 -fast -DINLINE64' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ LIBS='-lpthread -lstdc++' \ opt='$(opt) -DCPUS=2' \ crafty-make
And in crafty.hCode: Select all
White(1): mt=2 max threads set to 2. White(1): bench Running benchmark. . . ...... Total nodes: 157182499 Raw nodes per second: 5544356 Total elapsed time: 28.35
Code: Select all
#include <stdio.h> #include <assert.h> #include <stdlib.h> #if !defined(FreeBSD) # include <malloc.h> #endif #include <string.h> #if !defined(TYPES_INCLUDED) ....
On the way to your uab (dot) edu adress ....bob wrote: If you don't mind, please send me a Makefile that works on your box, modified from the distributed Makefile. I hate making editing changes that I can't verify easily and I want to avoid releasing a 23.2 that won't compile cleanly.
With the latest Intel compiler for OS X (free download for 30 day evaluation), using -fast -DINLINE64 and -prof-gen/-prof-use for profile-generated optimization:schlucke wrote:
Gives this bench results on my MacBook Pro (2.4 GHz Intel Core 2 Duo):
With the suggested options:
Code: Select all
darwin-x86_64: $(MAKE) target=FreeBSD \ CC=gcc CXX=g++ \ CFLAGS='$(CFLAGS) -Wall -pipe -O3 -m64 -fast -DINLINE64' \ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ LIBS='-lpthread -lstdc++' \ opt='$(opt) -DCPUS=2' \ crafty-make
Code: Select all
White(1): mt=2 max threads set to 2. White(1): bench Running benchmark. . . ...... Total nodes: 157182499 Raw nodes per second: 5544356 Total elapsed time: 28.35
Code: Select all
Crafty v23.1 (2 cpus)
White(1): bench
Running benchmark. . .
......
Total nodes: 120019300
Raw nodes per second: 5002888
Total elapsed time: 23.99
Code: Select all
Model Name: MacBook
Model Identifier: MacBook3,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 4 MB
Memory: 4 GB
Bus Speed: 800 MHz