[R] speed of makeCluster (package parallel)

Simon Zehnder szehnder at uni-bonn.de
Mon Oct 28 18:41:32 CET 2013


use only the number of cores as a number of thread - i.e. I would not use hyper threading, etc.. Each core has its own caches and it is always fortunate if a process has enough memory; hyper threads use all the same cache on the core they are running on. detectCores() gives me for example 4 - I know I have 2. I would therefore call makeCluster() with nnode = 2. mcaffinity() lets you perform a technique called process-pinning (see process affinity) and is only possible if the OS supports it. It makes sometimes sense to assign certain processes to certain CPUs such that each process has enough memory in caches (e.g. for a 16 Core machine using 8 processes on CPUs 1, 3, 5, 7, 9, 11, 13 and 15; so each process has the cache of two CPUs). 
A lot of functions though are not available for Windows. 

At first it comes always the problem you want to solve and then you look how much memory will be used in a process and how much you have (more often the memory bandwidth is the bottleneck and not the computing power). Look at the architecture of your chips (how much L1 Cache, how much L2 cache). Then you decide how many cores to use and if it makes sense to pin processes to certain cores. 

There are no general recipes for parallel computing - each problem is different. Some problems are even not scalable. 


On 28 Oct 2013, at 17:51, Arnaud Mosnier <a.mosnier at gmail.com> wrote:

> Thanks Simon,
> I already read the parallel vignette but I did not found what I wanted.
> May be you can be more specific on a part of the document that can provide me hints !
> Arnaud
> 2013/10/28 Simon Zehnder <szehnder at uni-bonn.de>
> See library(help = "parallel”)
> On 28 Oct 2013, at 17:19, Arnaud Mosnier <a.mosnier at gmail.com> wrote:
> > Hi all,
> >
> > I am quite new in the world of parallelization and I wonder if there is a
> > way to increase the speed of creation of a parallel socket cluster. The
> > time spend to include threads increase exponentially with the number of
> > thread considered and I use of computer with two 8 cores CPU and thus
> > showing a total of 32 threads in windows 7.
> > Currently, I use the default parameters (type = "PSOCK"), but is there any
> > fine tuning parameters that I can use to take advantage of this system ?
> >
> > Thanks in advance for your help !
> >
> > Arnaud
> >
> > R version 3.0.1 (2013-05-16)
> > Platform: x86_64-w64-mingw32/x64 (64-bit)
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list