3.2. Format of an execution script¶
This section describes the format of execution script files to run programs on the supercomputer. To execute the application that requires an execution script file, create the file in advance.
3.2.1. Execute a non MPI program¶
#!/bin/sh
#PBS -l select=1
#PBS -q queue name
#PBS -N job name
cd $PBS_O_WORKDIR
program > output file 2> error file
・Example: To execute a program ‘a.out’.
#!/bin/sh
#PBS -l select=1
#PBS -q CP_001
#PBS -N sample
cd $PBS_O_WORKDIR
./a.out > result.out 2> result.err
3.2.2. Execute a MPI program¶
#!/bin/sh
#PBS -l select=nodes:ncpus=cores:mem=XXgb
#PBS -l walltime=HH:MM:SS
#PBS -q queue
#PBS -N jobname
cd $PBS_O_WORKDIR
mpirun [ -np MPI total tasks | -ppn MPI tasks per node ] -hostfile $PBS_NODEFILE program > output file 2> error file
・Example: To run a program on shared node using Intel MPI, with 8 MPI processes, 32GB memory, and walltime of 1 hour.
#!/bin/sh
#PBS -l select=1:ncpus=8:mem=32gb
#PBS -l walltime=01:00:00
#PBS -q CP_001
#PBS -N mpi
module load oneapi
cd $PBS_O_WORKDIR
mpirun -np 8 -hostfile $PBS_NODEFILE ./a.out > result.out 2> result.err
・Example: To run a program on 2 node using Intel MPI, with 112 MPI processes each nodes.
#!/bin/sh
#PBS -l select=2
#PBS -q P_030
#PBS -N mpi
module load oneapi
cd $PBS_O_WORKDIR
mpirun -np 224 -ppn 112 -hostfile $PBS_NODEFILE ./a.out > result.out 2> result.err
3.2.3. Execute a GPU program¶
#!/bin/sh
#PBS -l select=nodes:ncpus=cores:mem=XXgb
#PBS -l walltime=HH:MM:SS
#PBS -q queue
#PBS -N jobname
cd $PBS_O_WORKDIR
mpirun [ -np MPI total tasks | -ppn MPI tasks per node ] -hostfile $PBS_NODEFILE program > output file 2> error file
・Example: To run a program on shared node using NVIDIA HPC SDK, with 2 MPI processes, 2GPUs, 64GB memory, and walltime of 30 minutes.
#!/bin/sh
#PBS -l select=1:ncpus=4:ngpus=4:mem=64gb
#PBS -l walltime=00:30:00
#PBS -q CA_001
#PBS -N mpi
module load nvhpc
cd $PBS_O_WORKDIR
mpirun -np 4 -hostfile $PBS_NODEFILE -x LD_LIBRARY_PATH -x HCOLL_MAIN_IB=all ./a.out > result.out 2> result.err