R/SNOW
SNOW is a module for R that allows R to do parallel operations. For more information on SNOW, there is a good introduction titled snow Simplified by Sigal Blay. There are also some other links provided below.
To use SNOW on the CAC clusters you need to load the LAM and R packages, to do this type:
module load snow
It is worth noting that running in parallel doesn't automatically make your R job faster, and it can, in fact, make it slower. At the bottom of the snow Simplified page is a simple timing test that demonstrates this. Often there is a "sweet spot" for how many nodes you need for the optimum performance. You should try this with your own problem to determine what will get you the best speed-up.
A sample interactive R/SNOW session looks like this:
nyx$ R
R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.2.1 (2005-12-20 r36812)
ISBN 3-900051-07-0
> library(snow)
> cl <- makeMPIcluster(2)
Loading required package: Rmpi
LAM/MPI runtime environment is not operating.
Starting LAM/MPI runtime environment.
2 slaves are spawned successfully. 0 failed.
> A <- matrix(rnorm(1000000), 1000)
> system.time(A %*% A)
[1] 4.38 0.01 4.38 0.00 0.00
> system.time(parMM(cl, A, A))
[1] 2.27 1.62 5.82 0.00 0.00
> clusterCall(cl, function() Sys.info()[c("nodename","machine")])
[[1]]
nodename machine
"nyx341.engin.umich.edu" "x86_64"
[[2]]
nodename machine
"nyx341.engin.umich.edu" "x86_64"
> stopCluster(cl)
> q()
nyx$ lamhalt
Once you have an R script (called R.input below) for your problem, you can create a PBS script and submit that to the cluster. For example:
#PBS -N R-snow
#PBS -q route
#PBS -l nodes=1:ppn=2,mem=1gb,walltime=24:00:00
#PBS -M your-email-address
#PBS -m abe
#PBS -V
#
echo "I ran on:"
cat $PBS_NODEFILE
#
#cd to your execution directory first
cd /home/your-user-name
#
#
lamboot
R < R.input
lamhalt
If you save that script with, for example, the name rsnow.pbs (you should chose a name that has some meaning for you) you can then submit it with the command:
qsub rsnow.pbs
Other R/Snow Resources
http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html
http://rweb.stat.umn.edu/R/library/snow/html/00Index.html
http://www.sfu.ca/~sblay/R/snow.html



