I have managed to compile Glaurung 2.2 (only the UCI engine; no GUI so far) to the iPhone OS, and am somewhat disappointed by the speed on my first-generation iPod Touch (which uses an ARM CPU running at 450 MHz, if I recall correctly). From the opening position, Glaurung searches about 14 Kn/s, which is almost a factor of 100 slower than when running on a single core of my 2.8 GHz Core 2 Duo. Based on benchmarks elsewhere, I expected a slowdown by a factor of only about 40.
Is a factor of 100 normal, or is it likely that something is wrong? I use these compiler switches:
Just a small note: -fomit-frame-pointer and -fstrict-aliasing are probably redundant in these settings since they are already switched on by -O2 (and therefore also by -O3).
As to "-arch armv6": isn't it "-march=armv6"? Or do I mix up something here?
Just a small note: -fomit-frame-pointer and -fstrict-aliasing are probably redundant in these settings since they are already switched on by -O2 (and therefore also by -O3).
They are redundant, but harmless, and save some typing when I want to experiment with only -O (as I sometimes do).
As to "-arch armv6": isn't it "-march=armv6"? Or do I mix up something here?
No, "-arch armv6" is correct. You are probably just confused because the -arch switch is Apple-specific.
Michel wrote:I assume you did profile? -fprofile-use seems to missing from you command line.
I never use profile-generated optimization with GCC, simply because it doesn't work for me. Whenever I try, I just get an executable that crashes instantly at startup. This happens with all GCC versions I have tried, in Linux as well as in Mac OS X.
I just tried the same experiment with Fruit, and found a slowdown by a factor of just 50. Perhaps Glaurung pays a huge penalty for its bitboard infrastructure?
-arch arch
Compile for the specified target architecture arch. The allowable values are i386, ppc and
ppc64. Multiple options work, and direct the compiler to produce ``universal'' binaries
including object code for each architecture specified with -arch. This option only works if
assembler and libraries are available for each architecture specified. (APPLE ONLY)
[...]
-march=name
This specifies the name of the target ARM architecture. GCC uses this name to determine what
kind of instructions it can emit when generating assembly code. This option can be used in
conjunction with or instead of the -mcpu= option. Permissible names are: armv2, armv2a, armv3,
armv3m, armv4, armv4t, armv5, armv5t, armv5te, armv6, armv6j, iwmmxt, ep9312.
-arch arch
Compile for the specified target architecture arch. The allowable values are i386, ppc and
ppc64. Multiple options work, and direct the compiler to produce ``universal'' binaries
including object code for each architecture specified with -arch. This option only works if
assembler and libraries are available for each architecture specified. (APPLE ONLY)
[...]
-march=name
This specifies the name of the target ARM architecture. GCC uses this name to determine what
kind of instructions it can emit when generating assembly code. This option can be used in
conjunction with or instead of the -mcpu= option. Permissible names are: armv2, armv2a, armv3,
armv3m, armv4, armv4t, armv5, armv5t, armv5te, armv6, armv6j, iwmmxt, ep9312.
So maybe something has changed since then?
That documentation is for a different compiler: The "standard" gcc used to compile Mac OS X applications, which cannot compile iPhone programs. There is a different gcc executable included in the iPhone SDK, that's the one I use. "-arch armv6" is certainly correct, otherwise my program wouldn't even run on the iPhone.
Tord Romstad wrote:That documentation is for a different compiler: The "standard" gcc used to compile Mac OS X applications, which cannot compile iPhone programs. There is a different gcc executable included in the iPhone SDK, that's the one I use. "-arch armv6" is certainly correct, otherwise my program wouldn't even run on the iPhone.
Tord
I downloaded the iPhone gcc package (v4.0.1) and looked into its gcc manual page. Please have a look into it again by yourself ("man gcc").
That your program runs on the iPhone is IMO accomplished already by using the iPhone gcc executable. So my theory is that "-arch armv6" could be no-op (unknown but not causing a compile error), and that "-march=armv6" could result in some code improvements. I may be wrong, but in cases like that I tend to believe in the written manual first.
Tord Romstad wrote:and am somewhat disappointed by the speed on my first-generation iPod Touch (which uses an ARM CPU running at 450 MHz, if I recall correctly).
According to Wikipedia it runs at 400 MHz.
Just nitpicking a little bit
Sven