Once the script has been saved to a file (e.g.
sample_script.sh ), it can be submitted to the queue with the
qsub command:

1

2

3

$qsub sample_script.sh

Submitting a serial application job to the queue (using ‘R’ as an example)

To run R (for example) in batch-mode you must first generate a list of commands for R to process in a file, e.g. r.in.

A script must then be created that will request resources from the queuing system and launch the R executable, for example
runR.sh :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

# Example script: runR.sh

#!/bin/bash

# Run in current working directory and use current environment

#$ -cwd -V

# Set a 6 hour run-time limit

#$ -l h_rt=6:00:00

#Request more memory, the default is 1Gb

#$ -l h_vmem=1536M

# Load R module

module addR

# run R using command file

# CMD BATCH flag should be given to suppress graphics (ie. run R in batch rather than interactive mode)

RCMD BATCHr.inr.out

This can then be submitted to the queuing system using:

1

2

3

$qsub runR.sh

In this example, any results will then be made available in the file
r.out .

Requesting an interactive session from the queue (using ‘R’ as an example)

A number of applications (R included) can run as interactive sessions as well as batch processes.
The queue system allows users to run a program on the back-end compute nodes but only if the required resources are available at the time the request is made.

The following will launch R interactively via the batch queue.

1

2

3

$qrsh-cwd-V-lh_rt=<hh:mm:ss>R<option>

h_rt is the length of run-time the shell will exist for, so to run R for 6 hours: