Updated 2019-02-04

mpi.pbs

# This is an example MPI PBS script
#PBS -N mpi_example_script         # job name
#PBS -l nodes=2:ppn=4              # number of nodes and cores per node
#PBS -l pmem=2gb                   # memory per core
#PBS -l walltime=15:00             # duration of the job (ex: 15 min)
#PBS -q force-6                    # queue name
#PBS -j oe                         # combine output and error messages in 1 file
#PBS -o mpi_script.out             # output file name
#PBS -m abe                        # event notification, set to email on job start, end, or fail
#PBS -M shollister7@gatech.edu     # your gatech email

                                                # Computation start here
cd ~/test_directory                             # change into directory from where job to be executed (where data is / script is located)
echo "Started on `/bin/hostname`"               # prints the name of the node job started on
module load gcc/4.9.0 mvapich2/2.1              #load necessary modules, gcc is a compiler, mvapich2 is an implementation of mpi
mpicc mpi_hello_world.c -o mpi_hello_world      #compiles the c program to be run
mpirun -np 8 ./mpi_hello_world                  #runs the parallel c program with mpi. Must have 8 processors specified (2 nodes x 4 cores)