[R] Dual Core vs Quad Core

Luke Tierney luke at stat.uiowa.edu
Tue Dec 18 22:29:28 CET 2007


On Tue, 18 Dec 2007, Prof Brian Ripley wrote:

> 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.

There are two experimental packages available in
http://www.stat.uiowa.edu/~luke/R/experimental: pnmath, based on
OpenMP, and pnmath0, based on basic pthreads. These packages provide
parallelized versions of many of the R vectorized math functions. The
README files in these packages give more details.  OpenMP is I think
the way we want to go in the longer term; there are a few configu
issues that need sorting out and so in the interim a non OpenMP
version might be useful.

Best,

luke

>
> 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.
>
>

-- 
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