float vs double on Macs [was Re: [Rd] NaN and linear algebra]

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Thu 24 Mar 2005 - 16:54:16 GMT

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.

R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Mar 25 03:56:50 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:26:32 GMT