menu

Example  job-script

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=2:mpiprocs=6   ← Specify the required resources(in this example 12 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 12 ./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.

pcc:/work/Samples

Resources specification example

How to calculate the resources needed in chunks

1 Chunk:
1 CPU (10 CPU Cores/ncpus=10) + 32GB memory

Normally you can use 1 node for 2 chunks and 2 nodes for 4 chunks.

MPI Job

2CPU (2 CPU Cores), 1 node running  20 parallel MPI jobs

#!/bin/bash
#PBS -l select=2
#PBS -j oe
#PBS -N MPI-job

cd $PBS_O_WORKDIR

mpirun -r ssh  -machinefile ${PBS_NODEFILE} -np 20 ./hello_mpi

4 CPU (40 CPU Cores), only 2 nodes for 10 MPI processes

#!/bin/bash
#PBS -l select=2
#PBS -j oe
#PBS -N MPI-job

cd $PBS_O_WORKDIR

mpirun -r ssh  -machinefile ${PBS_NODEFILE} -np 10 ./hello_mpi

OpenMP Job

1 CPU (10 CPU Cores) running 10 parallel OpenMP jobs

#!/bin/bash
#PBS -l select=1
#PBS -j oe
#PBS -N OpenMP-job

cd $PBS_O_WORKDIR
setenv OMP_NUM_THREADS 10

./a.out

Hybrid(MPI+OpenMP) Job

3 CPUs (30 CPU Cores), each CPU for 1 (MPI) process x 10 (OpenMP) threads

#!/bin/bash
#PBS -l select=3:mpiprocs=1   <-- 3 CPU, each CPU 1 process
#PBS -j oe
#PBS -N hybrid-job

cd $PBS_O_WORKDIR

export OMP_NUM_THREADS=10    <-- each process 10 threads

mpirun -machinefile ${PBS_NODEFILE} -np 3 ./hello_hyb <-- 3 processes

4 CPUs (40 CPU Cores) each process x5threads 

#!/bin/bash
#PBS -l select=4:mpiprocs=2   <-- 4 CPUs, each 2 processes ( = total 8 processes )
#PBS -j oe
#PBS -N hybrid-job

cd $PBS_O_WORKDIR

export OMP_NUM_THREADS=5    <-- each process 5 threads

mpirun -machinefile ${PBS_NODEFILE} -np 8 ./hello_hyb <-- 8 processes

Materials Studio Job

1 CPU = 8 Cores running 8 parallel Dmol3 jobs

#!/bin/csh
#PBS -l select=1
#PBS -j oe
#PBS -N DMOL3

cd $PBS_O_WORKDIR
setenv PATH ${PATH}:/work/opt/Accelrys/MaterialsStudio6.1/etc/DMol3/bin

RunDMol3.sh -np 8 test  <-- (1 chunk : Specify a number less than 10 parallel Cores)