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.
If your jobs is submitted successfully, qsub will print the the name of the job:
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.
#!/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"
When PBS starts your program a number of things will happen:
- your program will be scheduled to run
- 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