Skip to main content Skip to navigation
Kamiak Programmers Guide - G09

Job Submission Script

Those using Gaussian should endeavor to use the freely available fast scratch storage on Kamiak. Access to the fast scratch is facilitated by our mkworkspace application. This program was designed to integrate into submission scripts for just this purpose. For example, suppose we had an input file named co.09 which contained

%nproc=4
%mem=1GB
# mp2=fc/cc-pVDZ units=bohr

test

0  1
C
O  1  r

r=2.1322

 

Notice that this job requires four cores. Then our submission script should request 4 cores and set the Gauss Scratch Directory using the mkworkspace program in quiet mode (-q):

#!/bin/bash
#!/bin/bash
#SBATCH --job-name=g09test  ###Job Name
#SBATCH --partition=kamiak  ###Partition on which to run
#SBATCH --nodes=1           ###Number of nodes to use
#SBATCH --ntasks-per-node=1 ###Number of tasks per node (aka MPI processes)
#SBATCH --cpus-per-task=4   ###Number of cpus per task (aka OpenMP threads)
#SBATCH --time=00:5:00

module load gaussian
export GAUSS_SCRDIR="$(mkworkspace -q)"
g09  co.out
                                                                                                 
echo "Job Complete"

Multinode simulations

Gaussian09 uses Linda to launch jobs on multiple nodes. In order to leverage Linda, we need to communicate the nodes assigned by SLURM to Gaussian through the input file. Below is a script that will pre-append the LindaWorkers variable to the top of an existing co.g09 input file. Note the distribution of processes to threads. We are requesting one linda worker per node and 20 shared memory threads per worker. This should be reflected in the value of the nprocshared variable in co.g09, e.g. for an input file

%nprocshared=20
%mem=1GB
# mp2=fc/cc-pVDZ units=bohr

test

0  1
C
O  1  r

r=2.1322

We would have a submission script of the form

#!/bin/bash

#SBATCH --job-name=g09test ###Job Name
#SBATCH --partition=kamiak ###Partition on which to run
#SBATCH --nodes=2 ###Number of nodes to use
#SBATCH --ntasks-per-node=1 ###Number of tasks per node (aka MPI processes)
#SBATCH --cpus-per-task=20 ###Number of cpus per task (aka OpenMP threads)
#SBATCH --time=1-00:00:00

module load gaussian

# Name of your input file ie co.g09
JobFile=co

# This creates a list of nodes that you job received to run on
LindaList=./nodes_linda.$SLURM_JOBID
touch $LindaList

# This creates a jobfile
JobName=./${JobFile}${SLURM_JOBID}.g09
touch $JobName

# Create a list of hostnames and save it to the LindaList machine file
srun hostname -s | sort -u > $LindaList

# Tell linda to use ssh
export GAUSS_LFLAGS=' -opt "Tsnet.Node.lindarsharg: ssh"'

# Read the contents of the machine file and put it in the job file
workers="%LindaWorkers="$(cat $LindaList | tr "\n" "," | sed "s/,$//")

# Write that out to the job file
cat <(echo "${workers}") ./$JobFile.g09 > $JobName

export GAUSS_SCRDIR="$(mkworkspace -q)"
g09 < ${JobFile}${SLURM_JOBID}.g09  > ${JobFile}${SLURM_JOBID}.out

echo "Job Complete"

Suppose we submitted the above job and were given the jobID 1234. Then we would expect the following files to be created: an input file named co1234.g09, a list of nodes named nodes_linda.1234, an Gaussian output file named co1234.out, and a SLURM output file named slurm-1234.out.