Physnodes - 4) Job script files
- 1 Job submission parameters and example script files
- 1.1 Job Script Directives
- 1.2 Environment Variables
- 1.3 General queue settings
- 1.4 Serial jobs
- 1.4.1 Simple serial job
- 1.4.1.1 Simple serial job
- 1.4.2 Requesting more memory
- 1.4.3 How resource allocation works
- 1.4.1 Simple serial job
- 1.5 Task array
- 1.5.1.1 Submititng a task array job
- 1.5.2 Task Array Indexing
- 1.5.2.1 Array task indexing
- 1.5.3 Selecting irregular file names in array jobs
- 1.5.3.1 Processing irregular file names
- 1.5.3.2 Job script
- 1.5.4 Dependent Arrays
- 1.5.4.1 Dependant arrays
- 1.5.5 Task Concurrency
- 1.6 Parallel jobs
- 1.6.1 Job to Core binding
- 1.6.1.1 Core binding
- 1.6.2 Shared memory
- 1.6.2.1 Shared Memory
- 1.6.3 Large shared memory
- 1.6.3.1 Large shared memory
- 1.6.4 Using the large-memory nodes
- 1.6.4.1 Requesting a large memory node
- 1.6.5 MPI
- 1.6.5.1.1 Example MPI program
- 1.6.5.1.2 MPI job script
- 1.6.5.1.3 Execution of MPI job
- 1.6.5.1.4 MPI example output
- 1.6.5.2 MPI and Node Affinity
- 1.6.5.2.1 Example of 32 core MPI job allocated to two nodes
- 1.6.5.2.2 Example run
- 1.6.6 OpenMPI
- 1.6.1 Job to Core binding
Job submission parameters and example script files
To submit a script use the qsub <scriptname> command
-bash-4.1$ qsub serial_job Your job 10217 ("serial_job") has been submitted-bash-4.1$ qstatjob-ID prior name user state submit/start at queue slots ja-task-ID ----------------------------------------------------------------------------------------------------------------- 10217 0.00000 serial_job abs4 qw 06/02/2014 12:29:57 1
Job Script Directives
The default executing shell is the borne shell (/bin/sh). If you require a different shell (e.g. /bin/csh) then this can be specified in a #!/bin/csh directive at the top of the script.
Directives to the batch scheduler allow the jobs to request various resources. Directives are preceded by #$, so for instance to specify the current working directory add #$ -cwd to the script.
Option | Description | default |
-l h_rt=hh:mm:ss | The wall clock time (amount of real time needed by the job). This parameter must be specified, failure to include this parameter will result in an error message | Required |
-l h_vmem=memory | Sets the limit of virtual memory required (for parallel jobs per processor). If this is not given it is assumed to be 2GB/process. If you require more memory than 1GB/process you must specify this flag. e.g. #$ -l h_vmem=12G will request 12GB memory. | 2G |
-l h_stack=memory | Sets the stacksize to memory. | unlimited |
-help | Prints a list of options |
|
-l nodes=x[,ppn=y][,tpp=z] | Specifies a job for parallel programs using MPI. Assigns whole compute nodes. x is the number of nodes, y is the number of processes per node, z is the number of threads per process. |
|
-l np=x[,ppn=y][,tpp=z] | Specifies a job for parallel programs using MPI. Assigns whole compute nodes. x is the number of processes, y is the number of processes per node, z is the number of threads per process. |
|
-pe ib np | Specifies a job for parallel programs using MPI, np is the number of cores to be used by the parallel job. |
|
-pe smp np | Specifies a job for parallel programs using !OpenMP or threads. np is the number of cores to be used by the parallel job. |
|
-hold_jid prevjob | Hold the job until the previous job (prevjob) has completed - useful for chaining runs together, resuming runs from a restart file. |
|
-l placement=type | Choose optimal for launching a process topology which provides fully non-blocking communication, minimising latency and maximising bandwidth. Choose good for launching a process topology which provides 2:1 blocking communications. Choose scatter for running processes anywhere on the system without topology considerations. | good |
-t start-stop | Produce an array of sub-tasks (loop) from start to stop, giving the $SGE_TASK_ID variable to identify the individual subtasks. |
|
-cwd / -l nocwd | Execute the job from the current working directory; output files are sent to the directory form which the job was submitted. If -l nocwd is used, they are sent to the user's home directory. | -cwd |
-m be | Send mail at the beginning and at the end of the job to the owner. |
|
-M email_address@<domain> | Specify mail address for -m option. The default <username>@york.ac.uk will automatically redirect to your email address at you parent institution, which was used for your registration on the facility. | <username>@york.ac.uk |
-V | Export all current environment variables to all spawned processes. Necessary for current module environment to be transferred to SGE shell. | Recommended |
-P project | Account usage to particular project. If user belongs to multiple projects, specifying the project name is compulsory. Can be omitted for users with single project membership | Default project for members of single project. Not specified for users with multiple projects |
-o directory | place output from job (stdout) in directory. Directory must exist | current working directory |
-e directory | Place error output from job (stderr) in directory Directory must exist | current working directory |
Environment Variables
In addition to those environment variables specified to be exported to the job via the -v or the -V option (see above) qsub, qsh, and qlogin add the following variables with the indicated values to the variable list (for a complete list see: man qsub)
Variable |
|
|---|---|
SGE_O_HOME | the home directory of the submitting client. |
SGE_O_PATH | the executable search path of the submitting client. |
SGE_O_WORKDIR | the absolute path of the current working directory of the submitting client. |
SGE_STDERR_PATH SGE_STDOUT_PATH | the pathname of the file to which the standard error/standard output stream of the job is diverted |
SGE_TASK_ID | the index number of the current array job task (see -t option above). This is an unique number in each array job and can be used to reference different input data records, for example. |
|
|
SGE_TASK_FIRST SGE_TASK_LAST SGE_TASK_STEPSIZE | the index number of the first/last/increment array job task |
ENVIRONMENT | the variable is set to BATCH to identify that the job is being executed under SGE control |
JOB_ID | a unique identifier assigned by SGE |
JOB_NAME | The jobname set by -N. |
NSLOTS | the number of slots (normally the same as the number of cores) for a parallel job. |
RESTARTED | this variable is set to 1 if a job was restarted either after a system crash or an interruption. |