Updated 2019-02-04

openMP.pbs

#PBS -N openMP_example_script   #job name
#PBS -l nodes=2:ppn=4           # number of nodes and cores per node to run job on
#PBS -l pmem=2gb                # memory per core
#PBS -l walltime=00:30          # duration of job (5min)
#PBS -q force-6                 # queue name
#PBS -j oe                      # combine output and error messages in 1 file
#PBS -o openMP_example.out      # name of output file
#PBS -m abe                     # email on job start, end or fail
#PBS -M shollister7@gatech.edu

                                    # Computation starts here
cd ~/test_directory                 # change into directory where C script to be run is
echo "Started on `/bin/hostname`"   # optional, prints name of node job is run on
module load gcc/4.9.0               # load C compiler
export OMP_NUM_THREADS=8            # has to match number of node x ppn

gcc -fopenmp openMP_example.c -o openMP_example   # compiles with openMP
./openMP_example # runs parallel C program that was just compiled with openMP