Work in progress

This site is in the process of being reviewed and updated.

Executing jobs with qsub

The qsub command is used to submit a job to the queuing system. qsub accepts a mix of command-line parameters and/or a script. The job submission script contains options telling SGE what resources you are going to use and additional commands to run your job.

A quick example
[DIRxSRVx10:root@host ~]# qsub go.sh
[DIRxSRVx10:root@host ~]# qsub -q long.q ./go.sh
[DIRxSRVx10:root@host ~]# qsub go.sh

You must specify the full path to any executables not on the user's path.

Example shell script
#!/bin/csh
#
# I want to run my job in sh:
#$ -V
#$ -S /bin/sh
#$ -N name
#
# Send an email if the job is aborted (a), begins (b), and ends (e).
#$ -M hnelson@example.com
#$ -m abe
#
# The parallel environment to use is fork and to use 10 processors.
#$ -pe fork 10
#
# The submitted job should be executed from the current working directory.
#$ -cwd
#
# Put the output from this job in go.txt:
#$ -o /home/hnelson/go.txt
#
# Should there be any errors, put them in go.err:
#$ -e /home/hnelson/go.err
#
#
# I only need 20Mb memory, so trim the requirements:
#$ -l s_vmem=21M
#$ -l h_vmem=21M
#
# run my cpu-intensive job (which requires the value 2000 from stdin):
/home/hnelson/go/go << EOJ
2000
EOJ
Specifying architecture

In order to ensure a job runs on the proper architecture, you should specify the desired architecture. For example, for Linux use the following line in your batch script:

#$ -l arch=lx24-x86

or for Solaris use:

#$ -l arch=sol-sparc64
Optionally, use an SGE request definition file

If available, default request files are read and processed during job submission before any submit options embedded in the job script and before any options in the qsub or qsh command-line are considered.

File Location

Scope

<sge_root>/<cell>/common/sge_request

global defaults file

$HOME/.sge_request

user private defaults file

$cwd/.sge_request

cwd directory defaults file

Tuning your script

The more resources you ask for, the less likely it is that your job gets executed right away. In particular, you should tune memory limits and cpu limits. s_vmem and h_vmem are soft and hard limits (s_vmem causes a signal which can be caught by the program). Set them slightly higher than the amount of virtual memory you need. The parameter cpu_speed refers to the MHz rating of the cpu; SGE will use one greater than or equal to the speed you set with -l cpu_speed=2500MHz. You can see the speed and memory limits for each host with:

[DIRxSRVx10:root@host ~]# qconf -se hostname
Ensure qsub with '-S'
[DIRxSRVx10:root@host ~]# qsub -S /bin/sh job.sh
Batch scripts can be set to default to a specific queue

Edit the file <SGE_ROOT>/<SGE_CELL>/common/qtask. Add two lines at the end of the file:

sleeper -q all.q
primer -q all.q

These lines will cause all jobs submitted with the job category, "sleeper" or "primer," to be run in the default queue.

  • No labels