Building a Beowulf Cluster/Parallelization of computation/GNU R

From Wikibooks, open books for an open world
Jump to navigation Jump to search

In this section we see an examples of parallelization from within the R computing platform (statistical computing similar to Matlab) using the snow package, which can distribute jobs using either MPI or PVM. In this subsection we will only see usage of R+PVM.

Note, that for installation of packages within R the development packages of R are needed. Anyways, I just installed all R packages that were available in the R repository (something like this: http://cran.es.r-project.org/bin/linux/redhat/fedora9/x86_64, needless to say this may differ for your distribution, machine architecture, and country code).

You need to install R libraries snow and rpvm on master and slave(s). If you don't, R lets you create the PVM cluster object but then freezes when you try to execute a job.

in R:

> library('snow')
> library('rpvm')
> cl<-makePVMcluster(count=2,names=c('node0','node1'))
> clusterCall(cl, function() Sys.info()[c("nodename","machine")])
[[1]]
nodename machine 
"node1" "x86_64" 

[[2]]
nodename machine 
"node0" "x86_64"