Google Groups

Bignums via gmp in sbcl


Waldek Hebisch Oct 30, 2010 12:33 PM
Posted in group: FriCAS - computer algebra system
Yesterday I commited a patch allows using GMP for bignum
computation in 32-bit sbcl on Intel/AMD processors.

To use it configure using '--with-gmp' option -- you must
have gmp installed (including C header files, that is devel
package), otherwise build will fail.

Actually, there a chance that the code will work on other
32-bit processors, but I have no way of testing on such
processors.  Consequently, currently configure will
signal error if you try to use '--with-gmp' on something
other than 32-bit or 64-bit Intel/AMD processors.

Also '--with-gmp' will fail if you try to use different Lisp:
ECL and GCL already use GMP and currently using GMP
with Closure CL and Clisp is unsupported (I have code for
64-bit Closure CL on AMD64, but since number of users of
FriCAS on top of Closure CL seem to be low (0???), I did
not integrate that code in FriCAS build process).

BTW, updated timings for 10^6 digits of e:

           native sbcl            sbcl + GMP 5.0.1

32-bit      69s                      1.35s

64-bit      15s                      0.6


As you can see going to 64-bit gives substantial speedup
for arithmetic, which in practice may be more significant
than speedup due to use of GMP: GMP gives large speedup
for large numbers, but for smaller ones effect is smaller.
64-bit arithmetic gives speedups at almost all sizes:
huge speedup between 30 and 60 bits (due to use of fixnums
instead of bignums), small speedup for slightly more than
60 bits growing to about 4 when having about few hunded bits.

--
                              Waldek Hebisch
heb...@math.uni.wroc.pl