Example  job-script


The job script includes the options (qsub option) to be passed to the job scheduler and the execution command.

qsub Option: Start with #PBS at the beginning of the line then the arguments to be passed to the executed command.Other parts: treated as a command to be executed by the shell.Job script example:Execute MPI program (compiled)

#!/bin/csh                  ← Specify the shell to use for execution
#PBS -q SINGLE              ← Specify the destination queue
#PBS -oe                   ← Direct standard output and error to the same file
#PBS -l select=1:mpiprocs=8   ← Specify the required resources(in this example 8 parallel MPI processors) 
#PBS -N my-job              ← Specify a job name

cd ${PBS_O_WORKDIR}        ← Change the working directory

mpirun -r ssh  -machinefile ${PBS_NODEFILE} -np 8 ./hello_mpi               ← Run the complied executable

Job-script sample

Other samples of various job-scripts are shown here.

In addition to pcc login, please have copy the sample PBS script below and use it.


Resources specification example

How to calculate the resources needed in chunks

In most queue settings, Default chunk size of this system is:

1 Chunk:
0.25 CPU (16 CPU Core/ncpus= 16 )

If PBS is set as below,  "2Chunks, x 16 CPU Core = 32CPU Core" is provided.

#PBS -l select=2:ncpus=16

If the resources are specified as below, the chunk size will change.In this example, 2 chunks, 64 CPU Core is set as one chunk, 32 CPU Core.

#PBS -l select=2:ncpus=32


1CPU (32CPU Core, 128GB Mem), 32 MPI parallelized job with 1/4 node.

#PBS -l select=1:npus=32:mpiprocs=32
#PBS -j oe
#PBS -N MPI-job


mpirun -machinefile ${PBS_NODEFILE} -np 32 ./hello_mpi

2CPU (128CPU Core, 64GB Mem), 64 MPI parallelized proccesses with 1 node. (64 CPU will be free)

#PBS -l select=2:ncpus=64:mpiprocs=32
#PBS -j oe
#PBS -N MPI-job


mpirun -machinefile ${PBS_NODEFILE} -np 64 ./hello_mpi

OpenMP Job

0.5CPU (32CPU Core) 32 Threads parallelized job

#PBS -l select=1
#PBS -j oe
#PBS -N OpenMP-job



Hybrid(MPI+OpenMP) Job

Using 2CPU (32CPU Core) , 2 (MPI) process x 4 (OpenMP) threads per 8 Core

#PBS -l select=4:ncpus=8:mpiprocs=2   <-- Two processes per CPU
#PBS -j oe
#PBS -N hybrid-job


export OMP_NUM_THREADS=4    <-- 4 threads per process

mpirun -machinefile ${PBS_NODEFILE} -np 2 ./hello_hyb <-- 2 Process generation

Using 2CPU (32CPU Core), 1 process x 4 threads 

#PBS -l select=4:mpiprocs=2   <-- 2CPU, Per CPU, 2 processes ( = in total 8 processes )
#PBS -j oe
#PBS -N hybrid-job


export OMP_NUM_THREADS=4    <--  4threads per process

mpirun -machinefile ${PBS_NODEFILE} -np 4 ./hello_hyb <-- 4 process generation