[R-SIG-Mac] float vs double on Macs [was Re: [Rd] NaN and linear algebra]

Simon Urbanek simon.urbanek at r-project.org
Thu Mar 24 17:54:16 CET 2005

On Mar 24, 2005, at 6:59 AM, Bill Northcott wrote:

> PS  This discussion has given me another thought.  On MacOS X, it  
> would be much faster to use floats instead of doubles because they  
> can be directly processed by the Altivec section of the CPU.  I can  
> see no way to have R use floats.  Would that be possible as a  
> future enhancement or is it just too hard?

To have just a rough idea about how "much faster" this would be, here  
are some timings for 2000 runs of 1000x1000 matrix-vector  
multiplications using vecLib's BLAS:
G5 1.8GHz
sgemv: 2.9s
dgemv: 6.7s

G4 1.5GHz
sgemv: 10.1s
dgemv: 17.3s

The performance difference between double and float is actually less  
astonishing (although is proves that altiVec is used - still) than  
the G4 vs G5 comparison. vecLib for G5 seems to be fairly well  
optimized and the G5 architecture seems to have better throughput.

Anyway, I'm not quite sure switching from doubles to floats yields  
big enough speed up to justify the effort. Maybe some Lapack test  
would helpful, too, to have a bigger picture of this.


PS: I'd rather move this part to R-SIG-Mac as this is actually a Mac- 
only question.

More information about the R-SIG-Mac mailing list