[gambit-list] High-performance compiler options

Bradley Lucier lucier at math.purdue.edu
Wed Oct 7 14:15:30 EDT 2009


At this point, gcc 4.5.0 promises to be able to compile most
Gambit-generated C files at high optimization levels in a "reasonable"
amount of CPU time and memory.  So I configured Gambit with

./configure CC='/pkgs/gcc-mainline/bin/gcc -march=core2 -msse4 -O3 -fschedule-insns' --enable-multiple-versions --enable-single-host"

and then I removed by hand the "-O1" compilation options inserted into
the makefiles by the configure script.  The version of gcc I used was

heine:~/programs/gambc-v4_5_2-devel> /pkgs/gcc-mainline/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../../mainline/configure --enable-checking=release --prefix=/pkgs/gcc-mainline --enable-languages=c --disable-multilib
Thread model: posix
gcc version 4.5.0 20091005 (experimental) [trunk revision 152459] (GCC) 

With my quickie benchmark program:

gsi/gsi -e '(define a (time (expt 3 10000000)))(define b (time (* a a)))'

the routine (direct-fft-recursive-4 a table) computed the final direct
(forward) FFT with 2097152 complex elements in 156 ms.  This means that
we were getting

> (/ (* 5 2097152 21) .156)

FLOPS (because it takes $5 N \log_2 N$ floating-point operations for an
FFT of size N).  So that's 1411 MFLOPS with a 2.33 GHz Core 2 Duo; FFTW
reports about 2200 MFLOPS on a 3.0 GHz Xeon Core Duo using the Intel
compiler icc here:


The Xeon has a faster memory bus and is generally faster than the Core 2
Duo clock-per-clock; but just the ratio of CPU speeds would give a rate

> (* 1411 (/ 3.0 2.33))

predicted MFLOPS for Gambit.

I'm not going to get into a slanging match about gcc versus icc, but
overall this looks pretty damn good.


More information about the Gambit-list mailing list