* g09slurm initial update: correctly parse nprocshared / nproc in link0
command in a case-insensitive manner.
This commit is contained in:
@@ -1,34 +1,60 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# GAUSSIAN09 SUBMISSION SCRIPT
|
||||
#
|
||||
# Author: ODU Research Computing Services
|
||||
#
|
||||
# Usage: g09slurm INPUT_FILE.com [OUTPUT_FILE.out] [START_TIME]
|
||||
|
||||
|
||||
usage () {
|
||||
echo "Usage: g09slurm INPUT_FILE.com [OUTPUT_FILE.out] [START_TIME]"
|
||||
echo "Please refer to https://wiki.hpc.odu.edu/Software/Gaussian for more information"
|
||||
}
|
||||
|
||||
if [ "$1" == --help ]; then
|
||||
echo "g09slurm - Gaussian09 submission script"
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Error: Missing Gaussian G09 input file"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Error: require a filename for Gaussian G09 output"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ ! -r $1 ]; then
|
||||
echo "Error: Unable to open Gaussian G09 input file"
|
||||
exit -1
|
||||
usage >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input_file=$1
|
||||
output_file=$2
|
||||
begin_date=$3
|
||||
|
||||
ncpus=$(grep -w nprocshared ./$1|awk '{print gensub("%nprocshared=","","G")}'|grep -v !)
|
||||
|
||||
if [ ! -r $1 ]; then
|
||||
echo "Error: Unable to open Gaussian G09 input file"
|
||||
usage >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ -z "$output_file" ]; then
|
||||
output_file=${input_file%.[Cc][Oo][Mm]}.out
|
||||
fi
|
||||
|
||||
|
||||
# Detect & support multicore Gaussian calculations
|
||||
|
||||
ncpus=$(grep -E '^ *%' "$1" | grep -i -w nprocshared | awk '{ L = tolower($0); print gensub("%nprocshared=","","G", L)}')
|
||||
|
||||
if [ -z "$ncpus" ]; then
|
||||
ncpus=$(grep -w nproc ./$1|awk '{print gensub("%nproc=","","G")}'|grep -v !)
|
||||
ncpus=$(grep -E '^ *%' "$1" | grep -i -w 'nprocs?' | awk '{ L = tolower($0); print gensub("%nprocs?=","","G", L)}')
|
||||
fi
|
||||
|
||||
if [ -z "$ncpus" ]; then
|
||||
ncpus=1
|
||||
fi
|
||||
|
||||
|
||||
# Allow delayed start
|
||||
|
||||
if [ -z "$begin_date" ]; then
|
||||
begin_date=now
|
||||
fi
|
||||
@@ -38,16 +64,33 @@ if [ -f "$output_file" ]; then
|
||||
|
||||
if [ "$confirm" = "y" ]; then
|
||||
> "$output_file"
|
||||
else
|
||||
echo "Cancelling job submission" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#--partition=phi \
|
||||
CLUSTER=$(cat /etc/cluster)
|
||||
case "$CLUSTER" in
|
||||
wahab)
|
||||
SBATCH=/shared/apps/common/slurm/current/bin/sbatch
|
||||
;;
|
||||
turing)
|
||||
SBATCH=/cm/shared/applications/slurm/current/bin/sbatch
|
||||
;;
|
||||
*)
|
||||
echo "Error: unsupported cluster. Please contact itshelp@odu.edu for assistance." >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
/shared/apps/common/slurm/current/bin/sbatch \
|
||||
--job-name=G09-$input_file \
|
||||
GAUSSIAN_SCRIPT=/cm/shared/apps/gaussian/g09revD.01/script/g09/script/g09.slurm
|
||||
|
||||
"$SBATCH" \
|
||||
--job-name="G09-$input_file" \
|
||||
--ntasks=1 \
|
||||
--cpus-per-task=$ncpus \
|
||||
--output=$output_file \
|
||||
--output="$output_file" \
|
||||
--begin=$begin_date \
|
||||
/cm/shared/apps/gaussian/g09revD.01/script/g09/script/g09.slurm $input_file
|
||||
"$GAUSSIAN_SCRIPT" "$input_file"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user