[R-SIG-Mac] float vs double on Macs [was Re: [Rd] NaN and linear
algebra]
Thomas Lumley
tlumley at u.washington.edu
Thu Mar 24 18:35:08 CET 2005
On Thu, 24 Mar 2005, Simon Urbanek wrote:
> 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.
>
> Cheers,
> Simon
>
> PS: I'd rather move this part to R-SIG-Mac as this is actually a Mac-only
> question.
>
Actually, it isn't entirely.
Firstly, the reason ATLAS works so well is that large dense matrix
operations are often dominated by memory bandwidth rather than by the
speed of the floating point multiply and accumulate. Making the numbers
half as big will speed up operations on most architectures.
Secondly, other architectures have optimized single-precision floating
point, such as SSE2, which I think ATLAS can use.
Note that R does have support for single precision in .C, so adding
methods to solve(), eigen(), %*%, that directly call the single precision
BLAS and LAPACK could be worthwhile even in the absence of full support.
On the other hand, if you save only 4 seconds on 2000 multiplies of
1000x1000 matrices, it would take a big problem to justify even this.
-thomas
More information about the R-SIG-Mac
mailing list