[R] multi-machine parallel setup?

ivo welch ivo.welch at gmail.com
Sat Apr 21 18:24:24 CEST 2012


thx, guys, almost there.  This is good fodder for the vignette or ?parallel.

Steps:

(1) install package "snow" on all machines which you want to be part
of a cluster.
(2) run under R

library(parallel)
cl <- makeCluster(c("localhost", "calc.localdomain"), "SOCK")
result <- parLapply(cl=cl, X=1:100, function(x) {
paste(x,system("hostname", intern="TRUE")) } )
stopCluster(cl)

in my case, with two linux ubuntu machines and R 2.14...this hangs (!)
because I made a small mistake, using "TRUE" instead of TRUE.  if I
fix it, it works fine.  is there a way to have the slave signal "abort
the parLapply" job when it encounters an error?  [or is it something
with my setup that prevents the abort?  does it abort correctly on
your machines?]

(I run not R 2.15 but R 2.14.1 on ubuntu 12.04LTS beta, because in
/etc/apt/sources.list, deb http://cran.cnr.Berkeley.edu precise
multiverse still installs 2.14.1.)

regards,

/iaw



More information about the R-help mailing list