You may use the following Torque batch script as a template. Lines that begin
with #PBS are parsed to define Torque options, they're not just
comments. More information about job submission can be found on the
Torque Wiki.
#!/bin/sh ### Set the job name #PBS -N myprogram ### Declare myprogram non-rerunable #PBS -r n ### Uncomment to send email when the job is completed: ### #PBS -m ae ### #PBS -M your@email.address ### Optionally specifiy destinations for your myprogram's output ### Specify localhost and an NFS filesystem to prevent file copy errors. ### #PBS -e localhost:/work/username/test.err ### #PBS -o localhost:/work/username/test.log ### Optional similar syntax words might work for staging files. ### #PBS -W stagein=/scratch/file.in@localhost:/full/file.in ### #PBS -W stageout=/scratch/file.out@localhost:/full/file.out ### Set the queue to "batch", the only available queue. #PBS -q batch ### Specify the number of cpus for your job. This example will run on 16 cpus ### using 8 nodes with 2 processes per node. ### You MUST specify some number of nodes or Torque will fail to load balance. #PBS -l nodes=8:ppn=2 ### You should tell PBS how much memory you expect your job will use. mem=1g or mem=1024m #PBS -l mem=256m
### Some portions of some clusters, such as older nodes in the PSI BATCH cluster, ### support Myrinet GM. ### If you want to run GM programs, you must at minimum add the "gm" flag so ensure you are ### assigned nodes with Myrinet cards. ### ### gm ### gm_pci64b ### gm_pcixd ### ### For example, to run on 2 processes on each of 2 nodes with Myrinet cards you write ### #PBS -l nodes=2:ppn=2:gm
### Other options may be available too. For example, to run on only 3GHz PSI ### nodes, add "cpu3000" to your nodes line. ### ### Valid options are: ### PSI: cpu2333 cpu3000 ### CITRIS: cpu900 cpu1300 cpu1500 #PBS -l nodes=8:ppn=2:cpu3000
### You can override the default 1 hour real-world time limit.
### Switch to the working directory; by default Torque launches processes from your home directory.
### Jobs should only be run from /home, /project, or /work; Torque returns results via NFS.
echo Working directory is $PBS_O_WORKDIR
cd $PBS_O_WORKDIR
### Run some informational commands. echo Running on host `hostname` echo Time is `date` echo Directory is `pwd` echo This jobs runs on the following processors: echo `cat $PBS_NODEFILE` ### Define number of processors NPROCS=`wc -l < $PBS_NODEFILE` echo This job has allocated $NPROCS cpus ### Use gexec to run a program on the assigned processors. $GEXEC_SVRS is automatically defined for you. gexec -n 0 myprogram ### Alternatively, run a parallel MPI executable. mpirun -v -machinefile $PBS_NODEFILE -np $NPROCS mympiprogram
### Or, if you're running on only one node, run your executable directly: /some/path/to/a/binary