User Tools

Site Tools


howto:r

This is an old revision of the document!


Using R

R is installed in /opt/gridware/applications/R/R-2.15.2/ and is compiled using Open-MPI with the GNU compilers so you will need to add

module add openmpi/openmpi-1.6.1-gnu

to your .bashrc file in your home directory.

Changes to .profile file

On the CHPC clusters the .bashrc file is not automatically run for interactive logins, only the .profile file is. To rectify this add the following lines to the end of your .profile file:

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

Then make any changes to the PATH variable in your .bashrc file. It is vital that all paths are updated in the .bashrc file is because that file is run for non-interactive jobs, which all the jobs submitted to the Moab queues are.

Changes to .bashrc

Now you must add the R path to PATH in your .bashrc file by including the following line:

export PATH=/opt/gridware/applications/R/R-2.15.2/bin:$PATH

Parallel R

The rMPI and doMPI packages are already installed to allow R to use MPI to distribute its work across multiple nodes of the cluster.

Once you've created your R script file, called 'job-1.r', you will need to create a job script file to submit to the Moab scheduler.

Example job script file:

#!/bin/bash
#MSUB -l nodes=2:ppn=8
#MSUB -l walltime=1:00:00
#MSUB -V
#MSUB -o /export/home/username/simulations/job-1.out
#MSUB -e /export/home/username/simulations/job-1.err
#MSUB -d /export/home/username/simulations
#MSUB -M be your_emall@address
#MSUB -q 
 
mpirun -np 16 /opt/gridware/applications/R/R-2.15.2/bin/R --slave -f /export/home/username/simulations/job-1.r

Notes:

  • Replace username with your user name.
  • Replace your_emall@address with your email address.
  • And replace simulations with your program's working directory (which should really be on scratch for speed).
  • And change job-1 to be your script file name.
/app/dokuwiki/data/attic/howto/r.1362388153.txt.gz · Last modified: 2021/12/09 16:42 (external edit)