Skip to content

Examples of job script

Single node job

Single node: serial

#!/bin/sh 
#------ pjsub option --------#
#PJM -L rscgrp=ea
#PJM -L node=1
#PJM -L elapse=1:00:00
#PJM -g group1
#PJM -j
#------- Program execution -------#
./a.out 

Single node: thread parallel

#!/bin/sh 
#------ pjsub option --------#
#PJM -L rscgrp=ea
#PJM -L node=1
#PJM -L elapse=1:00:00
#PJM -g group1
#PJM -j
#------- Program execution -------#
export OMP_NUM_THREADS=40
./a.out

Note

  • export OMP_NUM_THREADS=40: the number of threads

Single node: flat MPI parallel

#!/bin/sh 
#------ pjsub option --------#
#PJM -L rscgrp=ea
#PJM -L node=1
#PJM --mpi proc=8
#PJM -L elapse=1:00:00 
#PJM -g group1
#PJM -j
#------- Program execution -------#
mpiexec.hydra -n ${PJM_MPI_PROC} ./a.out

Note

  • --mpi proc=8: the number of MPI processes
  • mpiexec.hydra: the command for executing a MPI parallel program
  • -n ${PJM_MPI_PROC}: specify the number of MPI processes, which equals to the value specifed by --mpi proc

Required

  • --mpi proc
  • -n in mpiexec.hydra

Single node: hybrid MPI parallel

#!/bin/sh
#------ pjsub option --------#
#PJM -L rscgrp=ea
#PJM -L node=1
#PJM --mpi proc=2
#PJM -L elapse=01:00:00 
#PJM -g group1
#PJM -j
#------- Program execution -------#
export OMP_NUM_THREADS=20
mpiexec.hydra -n ${PJM_MPI_PROC} ./a.out 

Note

  • export OMP_NUM_THREADS=20: the number of threads per process

Required

  • --mpi proc
  • -n in mpiexec.hydra

Multi nodes job

Multi nodes: flat MPI parallel

#!/bin/sh
#------ pjsub option --------#
#PJM -L rscgrp=ea
#PJM -L node=2
#PJM --mpi proc=80
#PJM -L elapse=1:00:00
#PJM -g group1
#PJM -j
#------- Program execution -------#
mpiexec.hydra -n ${PJM_MPI_PROC} ./a.out

Note

  • -L node=2: the number of nodes
  • --mpi proc=80: the number of MPI processes (total among all nodes)
  • The number of processes/node = (the value specified by --mpi proc) / (the value specified by -L node). In the above example, 40 (=80/2).

Required

  • --mpi proc
  • -n in mpiexec.hydra

Multi nodes: hybrid MPI parallel

#!/bin/sh
#------ pjsub option --------#
#PJM -L rscgrp=ea
#PJM -L node=2
#PJM --mpi proc=4
#PJM -L elapse=1:00:00
#PJM -g group1
#PJM -j
#------- Program execution -------#
export OMP_NUM_THREADS=20
mpiexec.hydra -n ${PJM_MPI_PROC} ./a.out

Note

In this example, 20 threads/process and 2 MPI processes/node.

Required

  • --mpi proc
  • -n in mpiexec.hydra