DescriptionR is a language and environment for statistical computing and graphics. It provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible. The linear algebra routines in R can make use of enhanced BLAS (Basic Linear Algebra Subprograms). It is therefore linked against the openblas library.
Available versions (Euler, old software stack)
|Legacy versions||Supported versions||New versions|
|3.0.2, 3.1.2, 3.2.2||3.3.0, 3.4.0, 3.5.1, 3.6.0|
Environment modules (Euler, old software stack)
|Version||Module load command||Additional modules loaded automatically|
|3.0.2||module load gcc/4.8.2 r/3.0.2||openblas/0.2.8_seq legacy centos_cruft/6|
|3.1.2||module load gcc/4.8.2 r/3.1.2||openblas/0.2.8_seq legacy centos_cruft/6|
|3.2.2||module load gcc/4.8.2 r/3.2.2||openblas/0.2.8_seq legacy centos_cruft/6|
|3.3.0||module load new gcc/4.8.2 r/3.3.0||openblas/0.2.13_seq bzip2/1.0.6 zlib/1.2.8 xz/5.2.2 pcre/8.38 curl/7.49.1 legacy centos_cruft/6|
|3.4.0||module load new gcc/4.8.2 r/3.4.0||openblas/0.2.13_seq bzip2/1.0.6 zlib/1.2.8 xz/5.2.2 pcre/8.38 curl/7.49.1 legacy centos_cruft/6|
|3.5.1||module load new gcc/4.8.2 r/3.5.1||openblas/0.2.13_seq bzip2/1.0.6 zlib/1.2.8 xz/5.2.2 pcre/8.38 curl/7.49.1|
|3.6.0||module load new gcc/4.8.2 r/3.6.0||openblas/0.2.13_seq bzip2/1.0.6 zlib/1.2.8 xz/5.2.2 pcre/8.38 curl/7.49.1|
Interactive sessionYou can start an interactive R session on the login node by typing the command R.
[leonhard@euler04 ~]$ module load new gcc/4.8.2 r/3.3.0 Using OpenBLAS build of R-3.3.0 [leonhard@euler04 ~]$ R R version 3.3.0 (2016-05-03) -- "Supposedly Educational" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-slackware-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. >
Interactive R sessions can for instance be used to install additional R packages locally, or to check which R packages are centrally installed. The list of already installed packages can be displayed with the following R command in an interactive session:
installed.packages()If the package that you would like to use is not yet installed, then you can either install it locally or contact cluster support.
How to submit a jobFor small tests, pre- and post-processing with R, you can start an interactive sessions on the login nodes. All other R jobs have to be submitted through the batch system. You can submit an R job (inputfile.R) in batch mode with the following command:
bsub [LSF options] "R --vanilla --slave < inputfile.R > outputfile"Here you need to replace [LSF options] with LSF parameters for the resource requirements of the job. Please find a documentation about the parameters of bsub on the wiki page about the batch system. In this case, stdout is redirected into "outputfile".
Parallel jobsYou can run parallel jobs in R, by using the parallel, the Rmpi or other packages for parallel computing. Please find more information on parallel computing with R at http://cran.r-project.org/web/views/HighPerformanceComputing.html or in the R reference manual. If you run parallel R jobs on Euler, please make sure that you do not forget to request enough cores from the batch system. Otherwise, the batch system will only reserve a single core and all threads will be executed on this single core, which is very inefficient and should be avoided.
ExampleAs an example for running R we use the R-25-Benchmark, which can be downloaded from http://r.research.att.com/benchmarks/. It consists of the R script R-benchmark-25.R.
[leonhard@euler01 test]$ module load new gcc/4.8.2 r/3.3.0 Using OpenBLAS build of R-3.3.0 [leonhard@euler01 test]$ wget http://r.research.att.com/benchmarks/R-benchmark-25.R >& /dev/null [leonhard@euler01 test]$ ls R-benchmark-25.R [leonhard@euler01 test]$ bsub -n 1 -W 0:10 -R "rusage[mem=1024]" "R --vanilla --slave < R-benchmark-25.R > result.out" Generic job. Job <22467786> is submitted to queue <normal.4h>. [leonhard@euler01 test]$ bjobs JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME 22467786 leonhard PEND normal.4h euler01 *esult.out Jul 6 14:49 [leonhard@euler01 test]$ bjobs JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME 22467786 leonhard RUN normal.4h euler01 e1173 *esult.out Jul 6 14:49 [leonhard@euler01 test]$ bjobs No unfinished job found [leonhard@euler01 test]$ ls lsf.o22467786 R-benchmark-25.R result.outR code examples can be found at CRAN
ExtensionsSince R is highly extensible, users can work with several additional packages supplemented by R developers. You can display the list of already installed packages with the following R command in an interactive session:
This should give you an overview on a common set of R packages. If you require an R package, which is not yet installed, you can either install it locally in your home directory, or you can contact us, such that we can install the package centrally if it is used by many cluster users.
For installing an R package locally, you first have to load the R module corresponding to the version for which it should be installed. After this you can launch R.
module load new gcc/4.8.2 r/3.3.0 R
Packages can be installed by the packages.install() command (we use here the package "actuar" as an example)
This command will cause a warning, since users do not have write access to the library directory of the corresponding R installation:
Warning in install.packages("actuar") : 'lib = "/cluster/apps/r/3.3.0_openblas/lib64/R/library"' is not writable Would you like to use a personal library instead? (y/n)
When asked if you would like to use a personal library, confirm this by typing y. This will create a local library directory $HOME/R/x86_64-unknown-linux-gnu-library/3.3 where the package will be installed at a later stage. Next you will be asked if you like to install the package in your local library directory
Would you like to create a personal library ~/R/x86_64-unknown-linux-gnu-library/3.3 to install packages into? (y/n)Afterwards the package will be downloaded and installed. The locally installed R package is now ready to be used.