Child pages
  • Submitting a job - Basic options
Skip to end of metadata
Go to start of metadata

Jobs are submitted with the qsub command:

$ qsub options job-script

The options tell Torque information about the job, such as what resources will be needed. These can be specified in the job-script as PBS directives, or on the command line as options, or both (in which case the command line options take precedence should the two contradict each other). For each option there is a corresponding PBS directive with the syntax:

#PBS option

For example, you can specify that a job needs 2 nodes and 8 cores on each node by adding to the script the directive:

or as a command-line option to qsub when you submit the job: 

$ qsub -l nodes=2:ppn=8 my_script.q

Basic PBS directive and qsub options

Options to manage job output:

  • -N jobname
    Give the job a name. The default is the filename of the job script. Within the job, $PBS_JOBNAME expands to the job name 
  • -j oe
    Merge stderr into the stdout file 
  • -o path/for/stdout
    Send stdout to path/for/stdout. Can be a filename or an existing directory. The default filename is $PBS_JOBNAME.o${PBS_JOBID/.*}, eg myjob.o12345, in the directory from which the job was submitted 
  • -e path/for/stderr
    Send stderr to path/for/stderr. Same usage as for stdout.
  • -M my_email_address@nyu.edu
    Send email to my_email_address@nyu.edu when certain events occur. By default an email is sent only if the job is killed by the batch system.
  • -m b -m e -m a -m abe
    Send email when the job begins (b), ends (e) and/or is aborted (a).  

Options to set the job environment:

  • -S /path/to/shell
    Use the shell at /path/to/shell to interpret the script. Default is your login shell, which at NYU HPC is normally /bin/bash
  • -v VAR1,VAR2="some value",VAR3
    Pass variables to the job, either with a specific value (the VAR= form) or from the submitting environment (without "=")  
  • -V
    Pass the full environment the job was submitted from

 

The name of the job affects how it appears in qstat and pbstop, and the default names of the files into which stdout and stderr will be sent. By default, a job gets its name from the filename of the job script, for example:

You can set a customized job name with the -N option or directive:

At the completion of each job, its stdout and stderr are written to files. By default these are placed in the directory from which the job was submitted, in separate files with names like jobname.o12345 for stdout and jobname.e12345 for stderr. (The trailing number is the PBS Job ID)

To merge stdout and stderr together in the stdout file, use -j oe. To merge them into the stderr file instead, use -j eo. For example:

You can change the name and/or location of the stdout and stderr files with the -o and -e options respectively. These options take a pathname which can be a directory or file. For example to put the stdout file into an existing directory called "my_outputs", keeping the file name as per the default:

Or to give it a specific filename:

If the pathname is relative, it is expanded relative to the directory in which you ran qsub, so you can change the name of the stdout file but leave it in the default directory with: 

If you expect your job to take several days, it may be helpful to receive an email when the job completes. Similarly if you run a large number of jobs it may be helpful to receive an email should a job fail. 

To receive email about a job, use the -M option or directive:

By default Torque will send email only if the job is aborted by the batch system. To receive email for other events use the -m option or directive. The following examples will send mail when the job begins, ends, is aborted and at all three events, respectively. 

By default Torque expects uses your login shell to interpret the job script. You can override this by specifying a shell with -S /path/to/shell. If the job script begins with "#!/some/other/shell" then the first action of the shell launched by Torque will be to launch /some/other/shell to interpret the script. 

You can pass specific variables to a job with -v and a comma-separated list of variable names, optionally with explicit values. In the following example, VAR1 gets an explicit value and VAR2 is passed from the current environment. If VAR2 is not set in the current environment it will also be not set in the job.

To pass your full environment to a job, use -V. This might be useful when starting an interactive batch job:

 

 

  • No labels