[R] How to get best performance from R on Linux?

Rainer M Krug r.m.krug at gmail.com
Wed Jul 1 08:57:31 CEST 2009


On Wed, Jul 1, 2009 at 2:47 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> Rainer,
>
> On 30 June 2009 at 14:30, Rainer M Krug wrote:
> | following a discussion on difference in speed of R between R and Linux, I am
> | wondering: is there a howto to get the most (concerning speed) out of R? I
> | am not talking about vectorisation and techniques in doing the analysis, but
> | what should I look at when I want to get "the fastest R" on my computer -
> | compiling myself? specific switches? compile libraries?, ...
>
> Did you look at R Admin manual and its Appendix B on Unix configuration?

Yes - thanks - but I seem to have skipped Appendix B.There it says:
###
On most platforms using gcc, having ‘-O3’ in CFLAGS produces
worthwhile performance gains. On systems using the GNU linker
(especially those using R as a shared library), it is likely that
including ‘-Wl,-O1’ in LDFLAGS is worthwhile, and on recent systems21
‘'-Bdirect,--hash-style=both,-Wl,-O1'’ is recommended at
http://lwn.net/Articles/192624/. Tuning compilation to a specific CPU
family (e.g. ‘-mtune=core2’ for gcc) can give worthwhile performance
gains, especially on older architectures such as ‘ix86’.
###

 I'll try it out when I compile R 2.9.1 and will see if it improves
compared to the default values.

Some more looking around, I found the following pages which might be helpful:

GNU optimisation page:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

Linux Review page on optimized gcc compiling:
http://linuxreviews.org/howtos/compiling/

Gentoo Wiki CFLAG guide
http://en.gentoo-wiki.com/wiki/CFLAGS

There seems to be a lot to learn.

>
> And the end of the day, it will most likely depend on exactly what it is you
> are trying to do, so you get back to square one and the need to profile,
> benchmark, ...

Yup - so much to benchmark and so little time...

Cheers and thanks,

Rainer

>
> Hth, Dirk
>
> --
> Three out of two people have difficulties with fractions.



--
Rainer M. Krug, Centre of Excellence for Invasion Biology,
Stellenbosch University, South Africa




More information about the R-help mailing list