R is a programming language that often is used for data analytics, statistical programming, and graphical visualization.
On Rivanna, R is available through our module system. To load R, simply type:
module load gcc R
(Notice that we included gcc in the load command. R has many computationally-intensive packages that are built with C, C++, or Fortran. By including gcc, we ensure that the same environment used for building R and its packages is loaded.)
Rstudio,a development environment for R, also is supported through its own module, but you must load a version of R first. For example, to load and run Rstudio, you could type the following:
module load gcc R/3.5.1 module load rstudio rstudio &
After you have developed your R program, you can submit it to the compute nodes by using a SLURM job command script similar to the following:
#!/bin/bash #SBATCH -n 1 #SBATCH -t 01:00:00 #SBATCH -o myRprog.out #SBATCH -p standard #SBATCH -A mygroup module load gcc R/3.5.1 Rscript myRprog.R
This script should saved in a file, called (for example) job.slurm. To run your job, you would submit the script by typing:
R can be run in parallel, either as multicore or with MPI (message passing interface). To run a parallel R job that uses MPI, the SLURM script would be similar to the following:
#!/bin/bash #SBATCH --nodes=2 #SBATCH --ntasks-per-node=10 #SBATCH -t 00:30:00 #SBATCH -o myRprog.out #SBATCH -p parallel #SBATCH -A mygroup module load gcc module load openmpi module load R srun Rscript myRprog.R
Contact firstname.lastname@example.org for consulting in optimizing and parallelizing your scripts.