[R-SIG-Mac] How to Speed up R on the G5

Simon Urbanek simon.urbanek at r-project.org
Mon Feb 7 16:57:34 CET 2005

I will address just some issues you mentioned based on some tweaking of 
R, but since I don't have a G5 yet, some of it is just theoretical ;).
On Feb 7, 2005, at 10:10 AM, Jake Bowers wrote:
> My first question is how to play with these different versions without
> breaking my production version?
Just don't install it. You don't need to run "make install" to use R - 
just start it from the build directory.
> My second question is whether there are ways other than using
> --with-blas="-framework vecLib", to take advantage of what I thought
> was the power of the G5 (or dual G5s in my case).
As you mention yourself further down - using compiler flags you can 
increase the level of optimization.
> but, although this compiled ok, it failed the make check on the first 
> test (base-Ex.R with:
>> tx0 <- c(9, 4, 6, 5, 3, 10, 5, 3, 5)
>> x <- rep(0:8, tx0)
>> stopifnot(table(x) == tx0)
> Warning in table(x) == tx0 : longer object length
>     is not a multiple of shorter object length
> Error in stopifnot(table(x) == tx0) : dim<- : dims [product 8] do not 
> match the length of object [9]
> Execution halted)
This is due to the fact that too aggressive optimization results in 
non-IEEE conforming behavior of float computations and NA/NaN handling 
gets screwed up.
Look at the equivalent flags for "-fast" (see man gcc) and try to 
remove "-ffast-math" - that should give you fastest possible binary 
while improving the above behavior (but I didn't test it myself).
BTW: R compiles cleanly with the latest gcc 4.0 from Apple (build 4039) 
and gfortran from hpc site - previous versions didn't quite work. If 
you have ADC seed, try the latest build - it's specifically optimized 
for auto-vectorization.

More information about the R-SIG-Mac mailing list