Building PBS Job Command Files

From
Revision as of 20:09, 2 June 2014 by Admin (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Building PBS Job Command Files

To submit a job to run on the Yucca or Eureka clusters, a PBS job command file must be created. The job command file is a shell script that contains PBS directives; these directives are preceded by #PBS. The following is an example of a PBS command file to run a serial job, which would require only 1 processor on 1 node.

   #!/bin/sh
   #PBS -l nodes=1:ppn=1
   #PBS -l walltime=12:00:00
   #PBS -o output_filename
   #PBS -j oe
   #PBS -m bea
   #PBS -M userid@example.com
    
   cd $PBS_O_WORKDIR
   your_executable commands

The first line identifies this file as a shell script. The next several lines are PBS directives that must precede any commands to be executed by the shell (e.g. the last two lines). The PBS directives are defined in the table below:

  PBS Directive                         Function
   
  #PBS -l nodes=1:ppn=1          Specifies a PBS resource requirement of
                                 1 compute node and 1 processor per node.
   
  #PBS -l walltime=12:00:00      Specifies a PBS resource requirement of
                                 12 hours of wall clock time to run the job.
  
  #PBS -o output_filename        Specifies the name of the file where job
                                 output is to be saved. May be omitted to
                                 generate filename appended with jobid number.
   
  #PBS -j oe                     Specifies that job output and error messages
                                 are to be joined in one file.
   
  #PBS -m bea                    Specifies that PBS send email notification
                                 when the job begins (b), ends (e), or
                                 aborts (a).
   
  #PBS -M userid@example.com     Specifies an alternate email address where PBS
                                 notification is to be sent.
  
  #PBS -V                        Specifies that all environment variables
                                 are to be exported to the batch job.

Here is a sample job to list names of the files contained in the users directory:

  [ron@yucca ~]$ more test.pbs
  #!/bin/sh
  #PBS -l nodes=1:ppn=1
  #PBS -l walltime=12:00:00
  #PBS -m bea
  #PBS -M ron@nscee.edu
  
  cd $PBS_O_WORKDIR
  ls -l

To submit this job, use something like:

  [ron@yucca ~]$ qsub -q compute test.pbs 
  1241.yucca.nscee.edu

This will schedule the job to run on the compute queue. The system has assigned 1241 as the job number. The job's standard output and standard error will be placed in the files: test.pbs.o1241 and test.pbs.e1241 respectively.

The following is an example of a PBS email notification to the user at the end of the job:


  Date:    Fri, 09 May 2014 21:05:48 -0000
  To:      ron@nscee.edu
  From:    adm@yucca.nscee.edu (root)
  Subject: PBS JOB 1241.yucca.nscee.edu
  
  Return-Path: <adm@yucca.nscee.edu>
  X-Original-To: ron@localhost
  Delivered-To: ron@localhost
  X-UIDL:  O)j"!U#>"!=='!!gVR"!
  
  PBS Job Id: 1241.yucca.nscee.edu
  Job Name:   test.pbs
  Execution terminated
  Exit_status=0
  resources_used.cpupercent=0
  resources_used.cput=00:00:00
  resources_used.mem=0kb
  resources_used.ncpus=1
  resources_used.vmem=0kb
  resources_used.walltime=00:00:01

Note that the walltime-used information in the email should be used to accurately estimate the walltime resource requirement in the PBS job command file for future job submissions so that PBS can more effectively schedule the job. When submitting a particular PBS job for the first time, the walltime requirement should be overestimated to prevent premature job termination.

After the PBS directives in the command file, the shell executes a change directory command to $PBS_O_WORKDIR, a PBS variable indicating the directory where the PBS job was submitted. Normally this will also be where the progam executable is located. Other shell commands can be executed as well. In the last line, the executable itself itself is invoked.

Personal tools
MediaWiki Appliance - Powered by TurnKey Linux