[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Number crunching in CLISP.
- To: email@example.com
- Subject: Re: Number crunching in CLISP.
- From: RLS@waikato.ac.nz
- Date: Thu, 18 Aug 94 10:38 +1200
>> If my memory serves me correctly, Bruno once told
>> me that CLISP does all floating point operations by itself (i.e. -
>> doesn't use the FPU). Is this correct?
>Yes, on most machines.
>> If it does do floating point in software, how hard is it to
>> change this?
>Not very hard: add "#define FAST_DOUBLE" and "#define FAST_FLOAT" to
>lispbibl.d, -fallow-single-precision to the CFLAGS in the makefile
>(need gcc-2.6.0 for this), and recompile.
>> Are floating point numbers stored in system format (as a C float)?
>Yes, if the floating point operations are done in hardware, the
>system format (i.e. IEEE) is used.
>> Is the numerical code well isolated?
>Yes, it is a single file called lisparit0.d.
>But that won't help you much because while the floating point operations
>are done in hardware, the boxing (allocating storage for the float)
>and the function call and type dispatching overheads remain.
>For these kinds of computations, try GCL. You will probably have to add
>many disgusting (DECLARE (DOUBLE-FLOAT ...)) declarations to your program.
>(Linux binaries are in ma2s2.mathematik.uni-karlsruhe.de:/pub/lisp/gcl/.)
>Btw, your comparison isn't fair since the variable i is a local variable
>in the C and a global (i.e. more expensive) variable in the Lisp version
>of your benchmark.
We have just recompiled clisp with these defines included for my 486dx2-66
linux, and the sparc 2's here at varsity and the alpha 2000's and for the
lisp loop given in a previous message (a local version):
((i 1.0d0 (* 1.00001d0 i)) (j 0 (1+ j)))
((= j 100000))
(declare (fixnum j))
(declare (double-float i))
and the times were:
486-dx2 : Real time: 12.982278 sec.
Run time: 12.64 sec.
Space: 1200532 Bytes
GC: 2, GC time: 0.52 sec.
sparc2 : Real time: 31.588968 sec.
Run time: 31.47 sec.
Space: 1600552 Bytes
GC: 3, GC time: 0.7 sec.
alpha : Real time: 11.301584 sec.
Run time: 11.261088 sec.
Space: 1601032 Bytes
GC: 3, GC time: 0.489952 sec.
These results would seem to say that somehow my PC is as fast as the alphas?
Also it makes the suns look pretty slow?
Is the linux version really using the FPU now? (It is no faster than it was
before I rebuilt the clisp!).
The only thing that we didn't do was use gcc-2.6 (which we don't have :-()
Is this a big bad mistake? (BTW we used gcc-2.5.8)
I've heard that Marcus is investigating GNU IUL for unboxing double-float
arrays for the FFI (foreign function interface), does this mean that we might
get unboxed double-float arrays in CLISP, i.e. faster math?
Well hopefully that's some food for thought.
Richard Shepherd, Martin Glanvill