===== Batch Jobs ===== A batch job is simply a set of commands grouped in a single file which are to be executed on a node or set of nodes assigned to the job by the scheduler. Below is an example batch job which contains a single command ''**hostname**''. This command prints out the name of the host running the command. tres-l1:pwolinsk:$ cat hostname.pbs hostname tres-l1:pwolinsk:$ You can use the ''**qsub**'' command to submit this job to the queue. Without any additional parameters to the qsub command the scheduler will select the default parameters (i.e. default queue, walltime, number of nodes and number of cores). tres-l1:pwolinsk:$ qsub hostname.pbs 283319.torque When the job finishes, the output and error messages from the job will be written to new files ending in .o for output and .e for error messages. tres-l1:pwolinsk:$ ls -ltr |tail -3 -rw-rw-r-- 1 pwolinsk pwolinsk 9 Sep 19 10:16 hostname.pbs -rw------- 1 pwolinsk pwolinsk 266 Sep 19 10:18 hostname.pbs.o283319 -rw------- 1 pwolinsk pwolinsk 0 Sep 19 10:18 hostname.pbs.e283319 tres-l1:pwolinsk:$ cat hostname.pbs.o283319 tres1005 PBS Job Statistics: PBS Input: hostname PBS Job ID: 283319.torque Resource List: walltime=00:30:00 Resources Used: cput=00:00:00,mem=0kb,vmem=0kb,walltime=00:00:00 Queue Name: q30m32c Program Return Code: 0 Head Node: tres1005 nnodes= 1 ncores= 1 njobs=1 tres-l1:pwolinsk:$ The output in hostname.pbs.o283319 shows the output of the hostname command followed by the batch job scipt and accounting information from the scheduler. It shows that the job was submitted with a **30 minute walltime** into queue ''**q30m32c**'', and **1 core** on **1 node** was requested. To specify different values for these parameters we you can pass flags to the **''qsub''** command: tres-l1:pwolinsk:$ qsub -q q06h32c -l walltime=1:00 -l nodes=1:ppn=32 hostname.pbs 283320.torque The command above submitted the same job to the ''**q06h32c**'' queue with a walltime of **1 minute** requesting all **32 cores** on **1 node**. Alternatively instead of passing these flags to the ''**qusb**'' command any line in the pbs script which starts with ''#PBS'' will be passed in as a parameter to qsub. Submitting the modified hostname.pbs script below with ''**qsub**'' without any flags on the command line will have the identical result tres-l1:pwolinsk:$ cat hostname.pbs #PBS -q q06h32c #PBS -l walltime=1:00 #PBS -l nodes=1:ppn=32 hostname tres-l1:pwolinsk:$ qsub hostname.pbs 283323.torque tres-l1:pwolinsk:$