Ok here is an update to the post on running R on an Amazon EC2.
https://decisionstats.wordpress.com/2010/09/25/running-r-on-amazon-ec2/
1) Login to Amazon Console using instructions in earlier post
2) Select AMI-Platform Ubuntu-i-5575773f
Basically select the latest 64 bit instance from Ubuntu
3) Proceed as in post before to launch AMI and instance- here I chose large with 4cores
3.1) Before connecting to your session
search Synaptic Package Manager for x11-
I installed the X11 VNC server package –
and now interactive sessions will work (read GUIs)
3.2) Modify the line
ssh -i decisionstats2.pem root@ec2-75-101-182-203.compute-1.amazonaws.com
To
ssh -i decisionstats2.pem -X ubuntu@ec2-75-101-182-203.compute-1.amazonaws.com
This will connect you.
4) INSTALL R – Cran R is a standard Ubuntu Package
using
sudo apt-get install r-base
then type R
and install.packages(“Rcmdr”)
Note – you should be able to see the grey colored Tcl/Tpk script showing cran locations
in a seperate window if X11 is working
5) doSNOW package works on the Ubuntu 64- The results are below for
check <-function(n) {check <-function(n) {
+ for(i in 1:1000)
+ {
+ sme <- matrix(rnorm(100), 10,10)
+ solve(sme)
+ }
+ }
>
> times <- 100
user system elapsed
0.150 0.080 7.303
> system.time(for(j in 1:times ) x <- check(j))
user system elapsed
27.460 2.300 29.757
The time of 7.3 is almost 5.5 times faster than running it locally on a dual core, and still 3 times faster than running foreach locally. Note I used 4 cores this time in snow.
5) The Tcl/Tk interface of R Cmdr takes a long time to load on EC2 than locally. It may be due to the fact I was running Ubuntu using a VM Player (http://www.vmware.com/go/downloadplayer/ ). However there seems to be a general slowing down when viewing graphics.
or simply
sudo apt-get install r-cran-rcmdr
Thanks for sharing your experience with R and EC2 — it’s been a real resource. Do you recall how you got doSNOW to work on EC2? I’m running R on Ubuntu, but when I try to start a cluster, it tells me that the socket connection cannot be opened.