Using PBS

From Athena Wiki
Revision as of 14:37, 11 September 2017 by Mrice admin (Talk | contribs) (Created page with "== Submit PBS script == To submit a script, you will need a shell program to give to qsub. Here is a sample: <pre> #!/bin/bash #PBS -q default DAY=`date +"%a %B %d, %Y...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Submit PBS script

To submit a script, you will need a shell program to give to qsub. Here is a sample:

#!/bin/bash

    #PBS -q default

DAY=`date +"%a %B %d, %Y"`
TIME=`date +"%r %Z"`

echo "Hello from `hostname` on $DAY at $TIME"

Save this in a file, such as hello.sh.

The script can then be submitted to the grid with qsub.

qsub hello.sh

If your jobs is submitted successfully, qsub will print the the name of the job:

1234.clusterhn.cluster.com

When the jobs runs, two output files will be created: hello.sh.o1234 and hello.sh.e1234 (where 1234 will be the job id number). These correspond to the standard output and standard error pipes from your program. For the script above, hello.sh.e1234 should be empty (no errors), and hello.sh.o1234 will contain a line something like:

Hello from n002.cluster.com on Tue May 13, 2014 at 11:44:05 AM EDT


A somewhat more complicated example, using MPI appears below:

#!/bin/bash

    #PBS -q default
    #PBS -l nodes=2:ppn=12

mpiexec -machinefile /opt/machinelist -n 10 PROGRAM ARGUMENTS

echo "end"

Replace the PROGRAM and ARGUMENTS with your own Unix program and command-line arguments.

Save this in a file, such as /home/dblank/pbs/hellompi.sh.

PBS is a language that allows you to set many aspects of your running program. For more details see ...

In this example, we tell mpiexec to choose from the machines listed in /opt/machinelist (all of the nodes) and to create 2 instances of our running code across those machines.

NOTE: the program will start in your home directory, so by default you will be in /home/dblank/. Use full pathnames to /data1/ for shared data.


NOTE: the results of qsub will appear here. Therefore, you may want to move your shell script to a folder before beginning.

Another example:

#!/bin/bash

    #PBS -l walltime=00:1:00
    #PBS -l nice=19
    #PBS -q default
    #PBS -l nodes=1:ppn=12
    #PBS -t 0-14

hostname

x=$PBS_ARRAYID
echo $x squared is $(($x * $x))
echo The square root of $x is $(echo "sqrt ( $x )" | bc -l)

echo "end"

Check status

When PBS starts your program a number of things will happen:

  1. your program will be scheduled to run
  2. when qsub runs your script, the script be submitted to each of the machines, perhaps a number of times

You can run "qstat -a" to see the status of your program.

Other Q Commands

  • qdel
  • qalter
  • qholde
  • qrls