logo

Summary of PBS Job Commands 📂Programing

Summary of PBS Job Commands

Overview

PBS stands for Portable Batch System, which is software used to manage jobs on large computer clusters. PBS supports job scheduling, resource management, and job monitoring, enabling users to perform tasks efficiently on a cluster.

Job Script

A job script is a file defining the job to be submitted to PBS. Note that comments start with #, which is different from #! or #PBS.

  • #!/bin/sh: Specifies the interpreter for the script. Selects which shell to use when executing the script file.
  • #PBS: Directives to specify various meta-information about the job.
  • #: Comment
PBS DirectiveDescription
-N {JOB_NAME}Specifies the job name.
-q {QUEUE}Specifies the queue name to use.
-l select=1:ncpus=1:ngpus=1Specifies the resources to use (number of cores, etc.).
-o {PATH}Specifies the path to the standard output file.
-e {PATH}Specifies the path to the standard error file.
-j oeMerges standard error(stderr) with standard output (stdout).
-j eoMerges standard output with standard error.

Resource allocation variable keywords are as follows:

  • select: Number of nodes to use
  • ncpus: Number of CPU cores to use
  • ngpus: Number of GPUs to use
  • walltime: Maximum execution time of the job

Environmental variables are those that can be used in job scripts, automatically set by PBS. Here are a few examples:

Environment VariableDescription
PBS_O_WORKDIRPath of the directory where the job is submitted (the absolute path where qsub is executed).
PBS_JOBIDJob ID.
PBS_JOBNAMEJob name.

A script file can be written as follows.

#!/bin/sh
#PBS -N train_mymodel             # 작업 이름
#PBS -q gpu                       # 사용할 큐 이름
#PBS -l select=1:ncpus=1:ngpus=1
#PBS -o ./eo/train                # 표준 출력 파일 경로
#PBS -j oe                        # 표준 출력과 표준 에러를 하나의 파일로 합침

module purge
module load cuda/12.1

cd $PBS_O_WORKDIR

{작업 내용}

exit 0

Commands

CommandDescription
qsub {script_file}Submit a job.
qstatCheck the list of jobs submitted to the current queue.
qstat -u {user}Check the list of jobs for a specific user.
qstat -u $USERCheck the list of jobs for the current user.