On GiNaC's Portability

Richard B. Kreckel kreckel at ThEP.Physik.Uni-Mainz.DE
Sat Aug 12 15:49:05 CEST 2000


Hi folx,

Since we issued warnings all over the place that GiNaC runs with GCC's C++
compiler only, I thought it would be interesting to verify this statement.
(Hi Alex!  How about MS-VC++ again?)  So I took the current Portland Group
compiler (version 3.1-3) for Linux/ia32 and gave it a try.  Since in C++
mangled names differ across compilers (as mandated by the standard) one
first has to compile CLN on that.  Otherwise one can't link anything
together.  Quite contrary to CLN's documentation, it turned out to be
rather portable.  The only issue (apart from some minor errors I'm going
to correct for CLN-1.1) is the scheme of PROVIDE/REQUIRE macros it
implements to deal with the 'static initialization order fiasco'.  But
since this doesn't bite you at all as long as you are building a static
library only, 'configure --disable-shared' was enough!

In GiNaC, the compiler found a couple of stupidities 'g++ -Wall -ansi
-pedantic' never complained about.  (Alex, why was 'const basic &
basic::operator=(const basic &)' declared virtual?  That seems to be wrong
because if you override it 'const derived & derived::operator=(const
derived &)' does not match.)  Anyways, I'll check in the necessary changes
later.  To my surprise the beast really worked, apart from segfaults each
time the program exits and some 'class basic_string' silliness in the
compiler.

The interesting question is whether this would be a great performance
boost, having such an expensive 'professional' compiler.  So I ran 'make
check' to see the results of the suite of benchmarks.  The runtimes are
indeed surprising, although not quite as I had expected.  Optimization was
-O2 for both compilers and according to the documentation this seems to be
comparable.  -O2 is the highest level of the Portland Group compiler.
After that, one can increase automatic inlining and other aggressive
optimizations but that seems to eat enormous amounts of memory (>500MB)
and tends to crash the compiler.  In any case, the compilation process is
10-20 times slower than with GCC.

Can you believe they ship encrypted standard library header files but when
you crash the compiler and it leaves a dump it is not difficult to put the
damnded pieces together?  (Only to see that they miss certain things and
are not too conforming to the standard.)  Obscurity at its best.  Duh.

Okay, here are the runtimes in seconds.  Machine was an Athlon/800
with "enough" memory.  Please read it carefully, then light an incense
and spend a minute praying to the FSF.
                                                   pgCC     GCC      ratio
                                                   3.1-3    2.95.2   pgCC/GCC
commutative expansion and substitution  (25 vars)    0.08     0.01     8.00
                                        (50 vars)    0.32     0.08     4.00
                                       (100 vars)    1.36     0.38     3.58
                                       (200 vars)    5.84     1.74     3.36
Laurent series expansion of Gamma      (order 10)    0.26     0.06     4.33
                                       (order 15)    1.49     0.34     4.38
                                       (order 20)    6.73     1.62     4.15
                                       (order 25)   26.17     6.75     3.88
determinant of univariate Vandermonde   (dim 4x4)    0.006    0.002    3.00
                                        (dim 6x6)    0.05     0.01     5.00   
                                        (dim 8x8)    0.59     0.14     4.21   
                                      (dim 10x10)    5.55     1.30     4.27
determinant of polyvariate Toeplitz     (dim 5x5)    0.07     0.017    4.12
                                        (dim 6x6)    0.36     0.09     4.00
                                        (dim 7x7)    1.72     0.45     3.82
                                        (dim 8x8)    7.46     2.15     3.47
Lewis-Wester test A (divide factorials)              0.26     0.11     2.36
Lewis-Wester test B (sum of rational numbers)        0.04     0.014    2.86
Lewis-Wester test C (gcd of big integers)            1.10     0.13     8.46
Lewis-Wester test D (sum of rational fcns)           0.0022   0.0004   5.50
Lewis-Wester test E (sum of rational fcns)           0.0023   0.0004   5.75
Lewis-Wester test F (gcd of 2-var polys)             0.082    0.043    1.91
Lewis-Wester test G (gcd of 3-var polys)             2.87     1.68     1.71
Lewis-Wester test H (det of 80x80 Hilbert)          19.46     4.99     3.88
Lewis-Wester test I (invert rank 40 Hilbert)         7.61     2.01     3.79
Lewis-Wester test J (check rank 40 Hilbert)          3.93     0.90     4.37
Lewis-Wester test K (invert rank 70 Hilbert)        44.92    12.39     3.63
Lewis-Wester test L (check rank 70 Hilbert)         22.01     5.44     4.05
Lewis-Wester test M1 (26x26 sparse, det)             0.77     0.24     3.21
Lewis-Wester test O1 (three 15x15 dets, average)   111.95    39.23     2.85
Lewis-Wester test P (det of sparse rank 101)         9.14     3.12     2.93
Lewis-Wester test P' (det of less sparse rank 101)  17.88     5.16     3.47
Lewis-Wester test Q (charpoly(P))                  258.23    80.47     3.21
Lewis-Wester test Q' (charpoly(P'))                521.26   161.33     3.23

Peace, love and free software
                          -richy.
-- 
Richard B. Kreckel
<Richard.Kreckel at Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>


-
To UNSUBSCRIBE, email to ginac-list at ginac.de with a subject of "unsubscribe".



More information about the GiNaC-list mailing list