The HECToR Service is now closed and has been superceded by ARCHER.

R and SPRINT

Licensing and access

R and SPRINT are freely available under the GNU General Public Licence. All HECToR users have access to the R binaries and source.

Getting started on HECToR

Get an account on HECToR

Login to HECToR

Running R

Note: There have been some issues with the pmaxT() function running on HECToR. If you want to use the pmaxT() function, please contact the SPRINT team at sprint@ed.ac.uk

To run R you need to swap to the GNU programming environment and add the R module to your environment.

module swap PrgEnv-cray PrgEnv-gnu
module add R

You should make sure that you have set the environment variable $TMP to point to a directory in your /work filesystem before running R. e.g.

export TMP=/work/x01/x01/user/temp

As R runs in serial you will either have to run your jobs on the serial queues, use SPRINT or your own MPI task farm which you can then use with aprun. (You must also ensure that the R script keeps track of the results in a sensible way - e.g. by writing to task specific files.) The following examples use SPRINT.

Running SPRINT

First write an R script that uses SPRINT. Here's an example, saved as 'install_test.R'.

library("sprint")
ptest()
pterminate()
quit()
You cannot run SPRINT on the front end of HECToR (where you first log in to). If you try this, then you'll see an MPI initialisation error as MPI is not installed on the front end. You must run your SPRINT script on the backend, either run interactively, or by submitting a job. Both ways are described below.

Interactive example

Running interactive jobs

From a subdirectory of /work on HECToR, enter the following:

qsub -IVl mppwidth=32,walltime=0:10:0 -A x01

This will reserve 32 cores for 10 minutes using budget 'x01'. The '-I' flag is for interactive mode, the '-V' flag exports the current environment variables to the compute nodes, and '-l' indicates the start of the list of requested resources.

Wait until the job starts, then:

Load the R module and switch to the GNU programming environment:

module swap PrgEnv-cray PrgEnv-gnu
module add R

Set the $TMP variable

export TMP=`pwd`

Run the 'install_test.R' script using 4 MPI tasks. See aprun for more options.

aprun -n 4 R -f install_test.R

Example job submission script

Submitting batch jobs

The job submission script. Save as 'submission_script.pbs'.

#!/bin/bash --login
# Name your job
#PBS -N R_job
# The total number of MPI tasks for your job.
#PBS -l mppwidth=32
# the maximum wall clock time required for your job.
#PBS -l walltime=01:00:00
# The budget your job is going to be charged to.
#PBS -A x01                 

# Load the R module and switch programming environment
module swap PrgEnv-cray PrgEnv-gnu
module add R

# Replace with your own temporary directory.
export TMP=/work/x01/x01/user/tmp  

# Change to the directory that the job was submitted from
cd $PBS_O_WORKDIR

# Run R in parallel using 4 tasks
aprun -n 4 -N 4 R -f install_test.R

Submit the job with the command:

qsub submission_script.pbs

Check the queue:

qstat -u $USER

The output of the results should be in R_job.o{job_no.} and R_job.e{job_no.}

Getting the Results

The example above writes to standard output (displayed on screen in interactive mode, saved to R_job.o{job_no.} in batch mode.) You should ensure that your R script keeps track of the results in a sensible way - e.g. by writing to a file.

HECToR has a shared file system, and so the same directories are available from the login and compute nodes. You should write to files somewhere in your 'work' directory, e.g. /work/x01/x01/user/results but note that these files are not backed up.

Useful links

Compilation