This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
quick:pbspro [2014/05/14 10:37] ischeepers |
quick:pbspro [2025/09/22 17:47] (current) kevin [Example 4 : empty job] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Job submission using PBSPro ====== | ====== Job submission using PBSPro ====== | ||
| - | As of January 2014, CHPC has a new scheduler - PBSPro. | + | The CHPC system uses the PBSPro |
| - | Main user documentation can be found at http://resources.altair.com/ | + | Main user documentation can be found at [[https://www.altair.com/ |
| But here is a summary of how to submit jobs at CHPC. | But here is a summary of how to submit jobs at CHPC. | ||
| Line 12: | Line 12: | ||
| * '' | * '' | ||
| * '' | * '' | ||
| - | * '' | + | * '' |
| + | * '' | ||
| ====How to submit a batch job==== | ====How to submit a batch job==== | ||
| - | Use the qsub command to submit a script file. PBSPro | + | Use the '' |
| - | A script can include just about anything which you could do during a terminal session such as set environment variables, change directories, | + | See the '' |
| - | '' | + | The first line of a script file may specify the interpreter, |
| - | === Example PBS scripts === | + | A script can include just about anything which you could do during a terminal session such as set environment variables, change directories, |
| - | Job submission scripts are shell scripts with PBS directives in comments. | + | |
| - | **PLEASE NOTE!** The first line should always have the hash-bang and shell path, eg. **# | + | > Job script files can be named to anything allowed for a regular file, but it is strongly recommended that you use '' |
| - | On a cluster system, run an executable on 3 nodes using all 8 cores per node with 8 MPI processes for 5 hours: | ||
| - | < | + | ====How to start an interactive job on a compute node==== |
| - | # | + | |
| - | #PBS -j oe | + | |
| - | #PBS -l walltime=5:00:00 | + | |
| - | #PBS -l select=3:ncpus=8:mpiprocs=8 | + | |
| - | #PBS -V | + | |
| - | cd $HOME/ | + | |
| - | </ | + | |
| - | On a non-cluster system, run an executable on 24 cores for 5 hours | + | '' |
| - | < | + | to start an interactive session, retaining all environment variables. |
| - | # | + | |
| - | #PBS -j oe | + | |
| - | #PBS -l walltime=5: | + | |
| - | #PBS -l ncpus=24 | + | |
| - | #PBS -V | + | |
| - | cd $HOME/ | + | |
| - | </ | + | |
| - | ===How long can a job run=== | ||
| - | There is no limit to the amount of time that a PBS job can run. If no time limit is specified, a default of 12 hours is assigned. Remember | + | ====How |
| - | To specify a time, include | + | The job number will be returned if the job has been accepted by the scheduler. Use this |
| + | number to check on the progress of a specific job: | ||
| - | '' | + | '' |
| - | ===Exclusive use of cluster nodes=== | + | To inspect jobs that have already finished: |
| - | On cluster systems, if a job does not request all the cores on a node, it is possible another job will share the same node. To prevent this, request exclusive use. | + | '' |
| - | ''# | + | or |
| - | ===How to export interactive session environment to job=== | + | '' |
| - | To include the shell environment in the batch job, either use the -V option with qsub or as a PBS directive | + | ====How to monitor |
| - | '' | + | To see the array job status on the queue, postfix the |
| - | + | jobnumber with empty square brackets: | |
| - | ''# | + | |
| - | ===Hyper-Threading=== | + | '' |
| - | On the CHPC cluster, Hyperthreading is disabled, except on the MIC nodes. | ||
| - | ===Suppose I want to do a parameter study. How do I submit all these jobs with a different value of parameter? | + | To look at one specific job in the array, add '' |
| - | Use PBS Job Arrays. You can specify how many jobs to run by adding the directive | + | '' |
| - | #PBS -J < | ||
| - | where range is X-Y:Z. So 1-10:2 indicates all the even jobs from 1 to 10, i.e., 2,4,6,8 and 10. | + | eg |
| - | PBS defines two environment variables: | + | '' |
| - | PBS_ARRAY_INDEX | ||
| - | PBS_ARRAY_ID | ||
| - | These variables are also defined as attributes: | ||
| - | array_index | + | =====PBS-Pro Job Exit Codes ===== |
| - | array_id | + | |
| - | Based on the job array index, different input files can be used for each job in the job array. Below is a job script | + | ====Job Exit Codes Between 0 and 128 (or 256)==== |
| + | This is the exit value of the top process in the job, typically the shell. This may be the exit value of the last command executed | ||
| - | NOTE: The PBS directives specify | + | ====Job Exit Codes >= 128 (or 256)==== |
| + | This means the job was killed by the PBS scheduler by sending it a signal. | ||
| - | < | + | The **modulo** or **remainder** operator [[http://en.wikipedia.org/ |
| - | #!/bin/sh | + | |
| - | #PBS -V | + | |
| - | #PBS -l select=1: | + | |
| - | #PBS -N Job_Array_Test | + | |
| - | #PBS -j oe -o ja.^array_index^.pbs | + | |
| - | #PBS -J 1-2 | + | |
| - | cd $PBS_O_WORKDIR | + | |
| - | # | + | |
| - | unset echo | + | |
| - | + | ||
| - | echo $PBS_ARRAY_INDEX | + | |
| - | + | ||
| - | echo $PBS_ARRAY_ID $PBS_ARRAY_INDEX >> ja.$PBS_ARRAY_INDEX.out | + | |
| - | echo ' ' | + | |
| - | bin/pi < pi.inp >> ja.$PBS_ARRAY_INDEX.out | + | |
| - | + | ||
| - | exit | + | |
| - | </ | + | |
| - | ===How do I determine the number of cores I have requested in my job script?=== | ||
| - | To determine the number | + | The signal is given by X modulo 128 (or 256). An exit value of 137 means the job's top process was killed with signal 9 because '' |
| - | '' | + | Depending on the system, a value greater than 128 or 256, see '' |
| - | ===How do I determine | + | Exit code 271 means that the job exceeded the limit requested at submission, eg. walltime or cpu usage, and was killed. |
| - | To determine the number | + | See '' |
| + | ====Terminate a job by signal==== | ||
| + | Send a signal to the job | ||
| - | '' | + | '' |
| - | ===A job submitted to the queue is not running=== | ||
| - | Look at the job status with qstat. The next to last line of the output is a comment describing the job status. Possible outputs include: | + | ===== Examples: PBS-Pro |
| - | '' | + | [[howto:PBS-Pro_job_submission_examples]] |
| - | * Job run at date at time on hostname | + | ===== Examples: Gaussian jobs ===== |
| - | Job is running OK | + | |
| - | * Not Running: No available resources on nodes | ||
| - | Job requires more memory, | ||
| - | | + | [[howto: |
| - | | + | |
| + | | ||
| - | If this persists, contact User support | ||
| - | * Not Running, Draining system to allow starving job to run | ||
| - | Job will not run because the resources are reserved for other jobs. | ||
| - | ===Queued Jobs stuck in an error state (E)=== | ||
| - | Try deleting the job with qdel | ||
| - | '' | + | ===== Examples: Amber jobs ===== |
| - | The following must be **plain text** files, as created by unix programs like '' | ||
| - | ===== Example 1 : Gaussian | + | [[howto:amber|Amber |
| - | <file bash gaussian_single.qsub> | + | |
| - | #! /bin/sh | ||
| - | #PBS -N eric.job | ||
| - | #PBS -l select=1: | ||
| - | #PBS -l walltime=1: | ||
| - | #PBS -q workq | ||
| - | #PBS -m abe | ||
| - | #PBS -o / | ||
| - | #PBS -e / | ||
| - | #PBS -M username@email | ||
| - | cd $PBS_O_WORKDIR | ||
| - | source / | ||
| - | module add gaussian/ | ||
| - | g09 < eric.inp > eric.log | ||
| - | </ | ||
| - | ===== Example | + | ===== Example: |
| - | <file bash gaussian_multiple.qsub> | + | |
| - | #!/bin/bash | ||
| - | #PBS -N eric.job | ||
| - | #PBS -l select=2: | ||
| - | #PBS -l walltime=12: | ||
| - | #PBS -q workq | ||
| - | #PBS -m abe | ||
| - | #PBS -o / | ||
| - | #PBS -e / | ||
| - | #PBS -M username@email | ||
| - | cd $PBS_O_WORKDIR | + | [[howto: |
| - | echo "My job start here" | ||
| - | date | ||
| - | pwd | ||
| - | source / | + | ===== Example 4 : empty job ===== |
| - | module add gaussian/ | + | |
| - | source / | + | |
| - | + | ||
| - | LINDA=`cat $PBS_NODEFILE | uniq | tr ' | + | |
| - | echo linda: $LINDA | + | |
| - | cat viw.inp | sed " | + | |
| - | g09 < temp$$.inp > OUTPUT_FILE.log | + | |
| - | + | ||
| - | + | ||
| - | echo "My job ends here" | + | |
| - | date | + | |
| - | + | ||
| - | where viw.inp is my input file | + | |
| - | + | ||
| - | Your input file should look like this :- | + | |
| - | + | ||
| - | %chk=viw.chk | + | |
| - | %nprocshared=12 | + | |
| - | %mem=32GB | + | |
| - | %lindaworkers=LINDA | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | </ | + | |
| - | ===== Example 2 (a) : Amber job on GPU nodes ===== | + | |
| - | + | ||
| - | < | + | |
| - | #! /bin/sh | + | |
| - | #PBS -N eric.job | + | |
| - | #PBS -l select=1: | + | |
| - | #PBS -l walltime=1: | + | |
| - | #PBS -q kepla_k20 | + | |
| - | #PBS -m be | + | |
| - | #PBS -o / | + | |
| - | #PBS -e / | + | |
| - | #PBS -M email@mail.com | + | |
| - | + | ||
| - | cd $PBS_O_WORKDIR | + | |
| - | + | ||
| - | pwd | + | |
| - | echo "My job starts here" | + | |
| - | date | + | |
| - | source / | + | |
| - | module add intel-XE/ | + | |
| - | module add amber/k20 | + | |
| - | + | ||
| - | exe=pmemd.cuda.MPI | + | |
| - | nproc=`cat $PBS_NODEFILE|wc -l` | + | |
| - | time mpirun -np $nproc -machinefile $PBS_NODEFILE $exe -O -i mdin -o mdout -p prmtop -c inpcrd | + | |
| - | echo "My job ends here" | + | |
| - | date | + | |
| - | </ | + | |
| - | + | ||
| - | ===== Example 2 (b) : Amber job on normal nodes (Please use this for python, | + | |
| - | + | ||
| - | < | + | |
| - | #! /bin/sh | + | |
| - | #PBS -N eric.job | + | |
| - | #PBS -l select=1: | + | |
| - | #PBS -l walltime=1: | + | |
| - | #PBS -q workq | + | |
| - | #PBS -m be | + | |
| - | #PBS -o / | + | |
| - | #PBS -e / | + | |
| - | #PBS -M email@mail.com | + | |
| - | + | ||
| - | cd $PBS_O_WORKDIR | + | |
| - | + | ||
| - | pwd | + | |
| - | + | ||
| - | source / | + | |
| - | module add intel-XE/ | + | |
| - | + | ||
| - | echo "My job starts here" | + | |
| - | date | + | |
| - | + | ||
| - | exe=sander.MPI | + | |
| - | + | ||
| - | nproc=`cat $PBS_NODEFILE|wc -l` | + | |
| - | time mpirun -np $nproc -machinefile $PBS_NODEFILE $exe -O -i mdin -o mdout -p prmtop -c inpcrd | + | |
| - | echo "My job ends here" | + | |
| - | date | + | |
| - | </ | + | |
| - | + | ||
| - | ===== Example 3 : Quantum Espresso job ===== | + | |
| - | + | ||
| - | < | + | |
| - | #!/bin/sh | + | |
| - | ###These lines are for PBSpro | + | |
| - | #PBS -N QEspresso | + | |
| - | #PBS -l select=2: | + | |
| - | #PBS -l walltime=24: | + | |
| - | #PBS -q workq | + | |
| - | #PBS -m be | + | |
| - | #PBS -o / | + | |
| - | #PBS -e / | + | |
| - | #PBS -V | + | |
| - | ##### Environment Settings | + | |
| - | source / | + | |
| - | module add intel-XE/ | + | |
| - | module add QEspresso/ | + | |
| - | ##### Running commands | + | |
| - | NP=`cat $PBS_NODEFILE | wc -l` | + | |
| - | cd $HOME/ | + | |
| - | mpirun -f $PBS_NODEFILE -r ssh -ib -env I_MPI_DEBUG 2 -np $NP pw.x -npool 3 -inp inputfile.inp | + | |
| - | </ | + | |
| - | + | ||
| - | ===== Example 4 : empty job ===== | + | |
| < | < | ||
| Line 317: | Line 135: | ||
| source / | source / | ||
| cd $PBS_O_WORKDIR | cd $PBS_O_WORKDIR | ||
| - | Where | + | |
| - | < | + | #Where |
| - | < | + | #< |
| - | < | + | #< |
| - | < | + | #< |
| - | < | + | #< |
| + | #< | ||
| + | #< | ||
| + | |||
| + | mpirun -np < | ||
| </ | </ | ||
| - | //Note that the M9000 sparc queue is called ' | ||
| - | ===== MPI example ===== | + | |
| + | ===== Example 5 : MPI example ===== | ||
| Syntax | Syntax | ||
| Line 338: | Line 160: | ||
| ... | ... | ||
| </ | </ | ||
| - | + | ===== Further examples ===== | |
| - | For more information on qsub | + | |
| - | $ man qsub | + | |
| - | + | ||
| - | Additional information on the job queues available | + | |
| - | $ qstat -q | + | |
| - | + | ||
| - | A minimal script Dell example would be | + | |
| - | $ more mpirun_basic_example | + | |
| - | #PBS -l select=2:ncpus=12:mpiprocs=12:jobtype=dell | + | |
| - | | + | |
| - | + | ||
| - | + | ||
| - | submiting | + | |
| - | $ qsub mpirun_basic_example | + | |
| - | The submitted jobs output file should produce output similar to | + | |
| - | cnode-6-33 | + | |
| - | ... repeated 11 times ... | + | |
| - | | + | |
| - | ... repeated 11 times ... | + | |