Skip to content

Is there plan to make R multithread?

4 messages · mingliz@surfbest.net, A.J. Rossini, Dirk Eddelbuettel +1 more

#
Hello R Pioneers,
 I sometimes use R on a dual CPU PC runing Linux and find that only 1 CPU is used even when no other user/process competes for resources.  Can we make R uses both CPUs to have the job done sooner?  I know this is probably asking too much for something that is free.  Has anyone else thought about it?  Thanks.
Ming Chow
#
mingliz> Hello R Pioneers, I sometimes use R on a dual CPU PC
    mingliz> runing Linux and find that only 1 CPU is used even when
    mingliz> no other user/process competes for resources.  Can we
    mingliz> make R uses both CPUs to have the job done sooner?  I
    mingliz> know this is probably asking too much for something that
    mingliz> is free.  Has anyone else thought about it?  Thanks.
    mingliz> Ming Chow

Search the mailing list for past discussions on this topic.  The short
answer is no you can't do it.  The long answer is yes, you can do it
with a bit of programming (using PVM/MPI and SNOW).
#
On Mon, Dec 02, 2002 at 04:21:56PM -0800, A.J. Rossini wrote:
Also see http://developer.r-project.org and e.g. the bullet point

#  Luke's notes on threading, GUI, and asynchronous IO issues. Some of the
reference links are messed up; the full references are in the BibTeX file.
Duncan also has a set of notes on threading.

with its links.

Dirk
#
Tony and Dirk have answered the question in the subject.  However, making
R multithreaded will not of itself make it run faster on a dual CPU
machine, the rather different question in the body of the message.
That would happen for most uses of R only if the inner computations were
able to make use of multiple threads and processors.  That means either
reprogramming them yourself (Tony's answer) or using different versions of
e.g. the linear algebra routines.   We do hope in due course to allow
multi-threaded BLAS routines, but there are problems at present (see the
R-admin.texi manual).

I use a dual-CPU machine all the time (I am writing this on one).  My
experience is that few programs run faster because of two CPUs (you need
many more to make multi-processing really worthwhile), but doing several
things at once is beneficial.  E.g,, there is a background R job running
now that has been running for a couple of days and unlike single-CPU
machines I notice no difference in response to the keyboard.
On Mon, 2 Dec 2002, Dirk Eddelbuettel wrote:

            
and that is aimed more at running several R tasks `at once' in a single
session.