Sample of run.sh

This section provides a sample run.sh file used for OpenPBS and Slurm.

The sample on this page shows a sample run.sh file assuming the following conditions

  • .sh file: saved in /home/calculation/
  • Resources: 1 node, 32 CPUs, 500 GB memory
  • Job Name: pbs_samplejob or slurm_samplejob
  • Wall Time: 10 minutes
  • Execution: run the executable file sample_job.exe in the same directory as run.sh using the mpirun command

Please set up the execution environment (number of nodes, etc.), execution directory, executable file name, etc. appropriately before use.

For OpenPBS

#!/bin/bash
#PBS -N pbs_samplejob
#PBS -l select=1:ncpus=32:mem=500gb
#PBS -l walltime=00:10:00

#Please write an appropriate directory
cd ${PBS_O_WORKDIR}

#Please write your execution command
mpirun ./sample_job.exe

For Slurm

#!/bin/bash
#SBATCH --job-name=slrum_samplejob
#SBATCH -N 1
#SBATCH -n 32
#SBATCH --mem=500G
#SBATCH --time=00:10:00

#Please write an appropriate directory
cd ${SLURM_SUBMIT_DIR}

#Please write your execution command
mpirun ./sample_job.exe