From FarmShare

Jump to: navigation, search

Revolution R is a pre-compiled distribution of R. Here's how you can install it into your homedir without sysadmin intervention.

It's a little bit round-about because they actually only provide .deb packages, but we want just the files. So we extract the files from the deb instead of just installing the deb into the system.

We currently use the Ubuntu 14.04 distribution, so we download the appropriate packages from here: https://mran.revolutionanalytics.com/download/#download

 mkdir ~/RRO
 cd RRO
 wget https://mran.revolutionanalytics.com/install/RRO-3.2.2-Ubuntu-14.4.x86_64.deb
 wget https://mran.revolutionanalytics.com/install/RevoMath-3.2.2.tar.gz
 dpkg -X RRO-3.2.2-Ubuntu-14.4.x86_64.deb . #extract the deb
 tar zxvf RevoMath-3.2.2.tar.gz
 export PATH=~/RRO/usr/lib64/RRO-3.2.2/R-3.2.2/lib/R/bin/:$PATH

Now you can check which R you're going to use, it should point to your RRO R:

 which R

You can check the version:

 R --version

You can check the library:


In my case it says:

 Packages in library ‘/home/chekh/RRO/usr/lib64/RRO-3.2.2/R-3.2.2/lib/R/library’:

Check your linear algebra performance with this test.R: http://www.bios.unc.edu/research/genomic_software/Matrix_eQTL/BLAS_Testing.html and https://web.stanford.edu/group/proclus/cgi-bin/mediawiki/index.php/Software-R#Measuring_linear_algebra_performance

For some reason with the pre-compiled RRO R v 3.2.0 the test.R takes over 10mins to run on my machine and eventually prints:

chekh@srn-chek:~$ ./RRO/usr/lib64/RRO-3.2.2/R-3.2.2/lib/R/bin/Rscript test.R
%*%	 42.104 	crossprod	 53.855

After modifyint the RevoMath script like so, run it and it will install the RRO-distributed MKL to your local RRO install:

chekh@srn-chek:~/RRO$ diff RevoMath/RevoMath.sh RevoMath.sh.alex
< R_PATH="noop"
> R_PATH=~/RRO/usr/lib64/RRO-3.2.2/R-3.2.2/lib/R/bin/R
> LIB_PATH=~/RRO/usr/lib64/RRO-3.2.2/R-3.2.2/lib/R/lib
< checkForValidRROInstallation
> #checkForValidRROInstallation

After installing the RevoMath script:

chekh@srn-chek:~$ ./RRO/usr/lib64/RRO-3.2.2/R-3.2.2/lib/R/bin/Rscript test.R
Multithreaded BLAS/LAPACK libraries detected. Using 4 cores for math algorithms.
%*%	 1.12 	crossprod	 0.869

So you can see about 40x faster in this case. (I have a 4-core Intel i5-4690 in this machine).

If you want this to work every time you log in, you'd need to add the PATH modification to your startup scripts. Pretty standard.


Before MKL:

[chekh@yen4.stanford.edu] ~ [0]
$ Rscript test.R

%*%	 75.639 	crossprod	 94.51

After MKL:

$ Rscript test.R
Multithreaded BLAS/LAPACK libraries detected. Using 32 cores for math algorithms.

%*%	 2.092 	crossprod	 1.463
Personal tools