[R] Dual Core vs Quad Core
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Dec 18 12:29:17 CET 2007
On Tue, 18 Dec 2007, S Ellison wrote:
> Hiding in the windows faq is the observation that "R's computation is
> single-threaded, and so it cannot use more than one CPU". So multi-core
> should make no difference other than allowing R to run with less
> interruption from other tasks. That is often a significant advantage,
> though.
Yes, but that is Windows-specific.
On most other platforms you can benefit from using a multi-threaded BLAS,
such as ATLAS, ACML or Dr Goto's. The speedup for linear algebra can be
substantial (although sometimes it will slow things down). Luke Tierney
has an experimental package to make use of parallel threads for some basic
R computations which may appear in R 2.7.0.
It should be possible to use a multi-threaded BLAS under Windows, but I
know no one who has done it. There is a viable pthreads implementation
for Windows, and I've tested Luke's experimental package using it.
Some compilers' runtimes will be able to use parallel threads for other
tasks. Since all the examples I am aware of are expensive commercial
compilers, I suspect R will make limited use of them. (In particular,
base R does not use the Fortran 9x vector operations at which many of
these features are targeted: we probably would if we routinely used such
compilers.)
I've had dual-CPU desktops for more than ten years. Given how little
speedup you are likely to get via parallel processing (only under ideal
conditions do the optimized BLASes run >1.5x faster using two CPUs), the
most effective way to make use of multiple CPUs has been to run multiple
jobs: I typically run 3-4 at once to keep the CPUs fully used.
One way to run multiple R processes to cooperate on a single task is to
use a package such as snow to distribute the load.
>>>> Andrew Perrin <clists at perrin.socsci.unc.edu> 18/12/2007 01:13 >>>
> On Mon, 17 Dec 2007, Kitty Lee wrote:
>
>> Dear R-users,
>>
>> I use R to run spatial stuff and it takes up a lot of ram. Runs can
> take hours or days. I am thinking of getting a new desktop. Can R take
> advantage of the dual-core system?
>>
>> I have a dual-core computer at work. But it seems that right now R is
> using only one processor.
>>
>> The new computers feature quad core with 3GB of RAM. Can R take
> advantage of the 4 chips? Or am I better off getting a dual core with
> faster processing speed per chip?
>>
>> Thanks! Any advice would be really appreciated!
>>
>> K.
>
> If I have my information right, R will use dual- or quad-cores if it's
> doing two (or four) things at once. The second core will help a little
> bit
> insofar as whatever else your machine is doing won't interfere with the
> one core on which it's running, but generally things that take a single
> thread will remain on a single core.
>
> As for RAM, if you're doing memory-bound work you should certainly be
> using a 64-bit machine and OS so you can utilize the larger memory
> space.
They only have 3GB of RAM, which 32-bit OSes can address. The benefits
really come with more than that.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list