[Openmcl-devel] Floating point performance

Paul Onions wibble37 at mac.com
Sun Jan 31 01:02:11 PST 2010


On 31 Jan 2010, at 00:28, Gary Byers wrote:
>
> On Sat, 30 Jan 2010, Ron Garret wrote:
>>
>> You could just compile a sqrt function with gcc and call it through  
>> the FFI.
>>
>
> Or exploit the fact that the authors of the OS's math libraries have
> already defined #_sqrt and #_sqrtf and call those functions.  That's
> pretty straightforward; dealing with FP exceptions in math library
> calls is a bit less so.
>

Yes, I had the same thought last night, so I went off and started  
reading the documentation on .cdb files and the FFI (something I've  
been meaning to do for ages). Looks like very impressive stuff.  
Anyway, this morning I tried

(defun test-fun-3 ()
   (loop repeat 1000000
         for x = 1.0 then (+ x 0.01)
         sum (#_sqrt (float x 1.0d0))))

(defun test-fun-4 ()
   (loop repeat 1000000
         for x = 1.0 then (+ x 0.01)
         sum (#_sqrtf x)))

which took 1.5s and 1s, respectively. Much more reasonable!

So, the final step is find out where in CCL's codebase the SQRT trap  
is used, and make sure I can work around those areas. In an earlier  
email you mentioned that it is only used in "a couple of LAP  
functions". May I ask, what's a "LAP function"? As you might have  
guessed I am not familiar with CCL internals.

Thanks for all your help,
Paul





More information about the Openmcl-devel mailing list