This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
howto:pbs-pro_job_submission_examples [2015/09/07 11:15] nthorne [Basic MPI Example] |
howto:pbs-pro_job_submission_examples [2021/12/09 16:42] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== PBS-Pro Job Submission Examples ====== | ||
| - | + | ====== | |
| - | Job submission scripts are similar to shell scripts with PBS directives in comments. | + | |
| - | + | ||
| - | ====PLEASE NOTE:==== | + | |
| - | + | ||
| - | - All job script files must be **plain text** files, as created by unix programs like '' | + | |
| - | - The first line should have the hash-bang and shell path, eg. ''# | + | |
| - | - The output and error file paths (''# | + | |
| - | - Job names (''# | + | |
| - | + | ||
| - | =====Basic MPI Example===== | + | |
| - | + | ||
| - | On a cluster system, run the '' | + | |
| - | + | ||
| - | < | + | |
| - | # | + | |
| - | #PBS -e scratch/ | + | |
| - | #PBS -o scratch/ | + | |
| - | #PBS -j oe | + | |
| - | #PBS -l walltime=5: | + | |
| - | #PBS -l select=3: | + | |
| - | #PBS -V | + | |
| - | + | ||
| - | source / | + | |
| - | module add openmpi/ | + | |
| - | + | ||
| - | cd $HOME/ | + | |
| - | + | ||
| - | mpirun -np 24 / | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | The job submission script above limits wall time to 5h, jobs taking longer | + | |
| - | will be killed by the scheduler. The line ''# | + | |
| - | variables of the shell from where the job is launched. The script also assumes | + | |
| - | that a symbolic link exists in the home directory that points to the user' | + | |
| - | area on ''/ | + | |
| - | the program, to ensure optimal file access speed. | + | |
| - | + | ||
| - | If the link does not exist, create it by changing to the home directory root and running: | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | + | ||
| - | To verify, the listing '' | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | and you should further be able to change to that directory, create files, etc. | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | =====Standard Options and Abilities===== | + | |
| - | + | ||
| - | ====How to specify number of nodes and cores for a job==== | + | |
| - | + | ||
| - | This is done using the ''# | + | |
| - | Cluster partitions differ in how many cpu's per node there are: | + | |
| - | * Harpertown: 8 cores per node | + | |
| - | * Nehalem: 8 cores per node | + | |
| - | * Westmere: 12 cores per node | + | |
| - | * Dell: 12 cores per node | + | |
| - | + | ||
| - | + | ||
| - | === Selecting a cluster partition based on number of cores === | + | |
| - | + | ||
| - | To run a 24-core job on the Dell partition, for instance, only 2 nodes are needed: | + | |
| - | + | ||
| - | + | ||
| - | ''# | + | |
| - | + | ||
| - | + | ||
| - | While 3 nodes are needed to request the same number of cpu cores on the Nehalem partition: | + | |
| - | + | ||
| - | ''# | + | |
| - | + | ||
| - | ====Number of cluster nodes in a job==== | + | |
| - | + | ||
| - | The number of cores can be obtained by: | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | + | ||
| - | ====Number of cores (cpu' | + | |
| - | + | ||
| - | To determine the number of cores, include the following line in the submission script: | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | + | ||
| - | ====Determining the machinefile (list of nodes)==== | + | |
| - | + | ||
| - | The mpirun command can use the PBS variable '' | + | |
| - | file name with the list of nodes: | + | |
| - | + | ||
| - | + | ||
| - | '' | + | |
| - | '' | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | ===Example: Join error and standard output, run multithreaded 24 cores for up to 5 hours, retain environment=== | + | |
| - | + | ||
| - | < | + | |
| - | # | + | |
| - | #PBS -j oe | + | |
| - | #PBS -l walltime=5: | + | |
| - | #PBS -l ncpus=24 | + | |
| - | #PBS -V | + | |
| - | + | ||
| - | myexecutable arg1 arg2 arg3 -num_threads 24 | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | ====Using Modules==== | + | |
| - | + | ||
| - | To use the module system, add the following line to your submission script after | + | |
| - | the ''# | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | Then you will be able to include your required module to set up an environment: | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | To list modules, the MODULEPATH variables normally are set by default and can be viewed | + | |
| - | from the command line using: | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | For Bioinformatics users, add the additional modules in your .profile as follows: | + | |
| - | + | ||
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | ====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 to check point long running jobs. | + | |
| - | + | ||
| - | To specify a time, include the following line in the submission script: | + | |
| - | + | ||
| - | ''# | + | |
| - | + | ||
| - | ====Exclusive use of cluster nodes==== | + | |
| - | + | ||
| - | 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. | + | |
| - | + | ||
| - | ''# | + | |
| - | + | ||
| - | ====How to export your current session' | + | |
| - | + | ||
| - | To pass your login shell environment to the cluster job, either use: | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | Or add it via a ''# | + | |
| - | + | ||
| - | ''# | + | |
| - | + | ||
| - | ====Hyper-Threading==== | + | |
| - | + | ||
| - | On the CHPC cluster, Hyperthreading is disabled, except on the MIC nodes. | + | |
| - | + | ||
| - | =====Job Arrays===== | + | |
| - | + | ||
| - | ===Suppose I want to do a parameter study. How do I submit all these jobs with a different value of parameter? | + | |
| - | + | ||
| - | Use PBS Job Arrays. You can specify how many jobs to run by adding the directive | + | |
| - | + | ||
| - | #PBS -J < | + | |
| - | + | ||
| - | where range is '' | + | |
| - | + | ||
| - | For example, '' | + | |
| - | + | ||
| - | PBS defines two environment variables: | + | |
| - | + | ||
| - | | '' | + | |
| - | | '' | + | |
| - | + | ||
| - | These variables are also defined as attributes: | + | |
| - | + | ||
| - | | '' | + | |
| - | | '' | + | |
| - | + | ||
| - | Based on the job array index, different input files can be used for each job in the job array. | + | |
| - | + | ||
| - | ====Job array example: a job script that submits two jobs, each using one processor.==== | + | |
| - | + | ||
| - | NOTE: The PBS directives specify the resources that will be used by EACH individual job, NOT all the jobs together. | + | |
| - | + | ||
| - | < | + | |
| - | #!/bin/sh | + | |
| - | #PBS -V | + | |
| - | #PBS -l select=1:ncpus=1:mpiprocs=1,walltime=48:00 | + | |
| - | #PBS -N Job_Array_Test | + | |
| - | #PBS -j oe -o ja.^array_index^.pbs | + | |
| - | #PBS -J 1-2 | + | |
| - | + | ||
| - | source / | + | |
| - | module add openmpi/ | + | |
| - | unset echo | + | |
| - | + | ||
| - | cd $PBS_O_WORKDIR | + | |
| - | echo $PBS_ARRAY_INDEX | + | |
| - | echo $PBS_ARRAY_ID $PBS_ARRAY_INDEX >> ja.$PBS_ARRAY_INDEX.out | + | |
| - | echo ' ' | + | |
| - | / | + | |
| - | + | ||
| - | exit | + | |
| - | </ | + | |
| + | See the [[quick: | ||