Scripts
|
A job submission script can contain any of the commands that you would otherwise issue yourself from the command line. It is, for example possible to both compile and run a program and also to set any necessary environment values. The results from compiling or running your programs can usually be seen after the job has completed. They will in general be created in the directory you are running in, and be named <script_name>.e<job number> (containing any errors) and <script_name>.o<job number> (any output produced to screen), unless you have given them other names in your script. Of course, the your program was going to write results to a file this will still happen. The job number is a number given to every job by PBS. You will see this reported when the job has been submitted. Note that it can take a long time before a job finishes running. The time depends, among other things, on the number of nodes and other resources requested, the size of the program, and how many other people that are using the system at the same time. A job submission script can be very simple, with most of the job attributes speciified on the command line, or it may consist of PBS directives, comments and executable statements. A PBS directive provides a way of specifying job attributes in addition to the command line options. Naming: You can name your script anything, including the suffix. It does not matter. Just name it something that makes sense to you and helps you remember what the script is for. Note that you have to always include #!/bin/bash at the beginning of the script, since bash is the only supported shell. Some things may work under other shells, but not everything. The environment variable PBS_WORKDIR contains the directory you submitted your job script from. Example (akka): #!/bin/bash #PBS -A SNICXXX-YY-ZZ #PBS -N Parallel # name of the output file #PBS -o test.out # name of the error file #PBS -e test.err # when to send email #PBS -m ae # Email address to use, if not using the one # for the submitter. #PBS -M username@domain.name # asking for 2 nodes, 2 processors #PBS -l nodes=2:ppn=2 # the job can use up to 30 minutes to run #PBS -l walltime=00:30:00 # memory requirements, physical memory (pmem) # at least 2200 mb and virtual + physical memory # (pvmem) at least 2900 mb #PBS -l pmem=2200mb #PBS -l pvmem=2900mb # change to the directory the job was submitted # from and load the module for PathScale compilers # with OpenMPI cd $PBS_O_WORKDIR module add openmpi/psc # the program pingpong only works on two nodes # or cpus, -pernode makes sure that we only run # one pingpong per node mpiexec -pernode ./pingpong One (or more) # in front of a text line means it is a comment. #PBS is used to signify a PBS directive. In order to comment out these, you need to put one more # in front of #PBS. #PBS -A <project number> is used to tell PBS that the running time should be taken from that projects allocation. The -N Job-name, if given, replaces script_name of the error and output files. Note: The first line in the script above says that Linux shell bash will be used to interpret the job script.
The qsub command scans the lines of the script file for directives. An initial line in the script that begins with the characters "#!" or the character ":" will be ignored and scanning will start with the next line. Scanning will continue until the first executable line, that is a line that is not blank, not a directive line, nor a line whose first non-white space character is "#".If directives occur on subsequent lines, they will be ignored. The remainder of the directive line consists of the options to qsub in the same syntax as they appear on the command line. The option character is to be preceded with the "-" character. If an option is present in both a directive and on the command line, that option and its argument, if any, will be ignored in the directive. The command line takes precedence. If an option is present in a directive and not on the command line, that option and its argument, if any, will be processed as if it had occurred on the command line. If you would like to see more examples of PBS job submission files, go here. |



