[R] when can we expect Prof Tierney's compiled R?

Luke Tierney luke at stat.uiowa.edu
Fri Apr 22 16:32:34 CEST 2005


On Wed, 20 Apr 2005, Peter Dalgaard wrote:

> Luke Tierney <luke at stat.uiowa.edu> writes:
>
>> Vectorized operations in R are also as fast as compiled C (because
>> that is what they are :-)).  A compiler such as the one I'm working on
>> will be able to make most difference for non-vectorizable or not very
>> vectorizable code.  It may also be able to reduce the need for
>> intermediate allocations in vectorizable code, which may have other
>> benefits beyond just speed improvements.
>
> Actually, it has struck me a couple of times that these operations are
> not as fast as they could be, since they are outside the scope of fast
> BLAS routines, but "embarrassingly parallel" code could easily be
> written for the relevant hardware. Even on uniprocessor systems there
> might be speedups that the C compiler cannot find (e.g. because it
> cannot assume that source and destination of the operation are
> distinct).

My guess is that for anything beyond basic operations we are doing OK
on uniprocessors. but it would be useful to do some testing to be
sure.  For the basic operations I suspect we are paying a heavy price
for the way we handle recycling, both in terms of overhead as such and
in terms of inhibiting compiler optimizations. For performance it
would probably be better to code the scalar-vector,
equal-length-vector, and general cases separately, though keeping the
code maintainable may be a bit of a challenge.  Again testing on a
range of platforms and compilers would be useful.

With multiprocessors likely to become more widely available it would
be good to look into ways of factoring the vectorized math code so we
can slide in one that uses threads when approprate.  This should
dovetail nicely with compilation to identify larger vectorized
expressions that can be parallelized as a unit; I hope to look into
this a bit this summer.

luke



-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu




More information about the R-help mailing list