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 Directive | Description |
---|---|
-N {JOB_NAME} | Specifies the job name. |
-q {QUEUE} | Specifies the queue name to use. |
-l select=1:ncpus=1:ngpus=1 | Specifies 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 oe | Merges standard error(stderr) with standard output (stdout). |
-j eo | Merges standard output with standard error. |
Resource allocation variable keywords are as follows:
select
: Number of nodes to usencpus
: Number of CPU cores to usengpus
: Number of GPUs to usewalltime
: 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 Variable | Description |
---|---|
PBS_O_WORKDIR | Path of the directory where the job is submitted (the absolute path where qsub is executed). |
PBS_JOBID | Job ID. |
PBS_JOBNAME | Job 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
Command | Description |
---|---|
qsub {script_file} | Submit a job. |
qstat | Check the list of jobs submitted to the current queue. |
qstat -u {user} | Check the list of jobs for a specific user. |
qstat -u $USER | Check the list of jobs for the current user. |