* 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
|
#!/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
|
if [ $# -lt 1 ]; then
|
||||||
echo "Error: Missing Gaussian G09 input file"
|
echo "Error: Missing Gaussian G09 input file"
|
||||||
exit -1
|
usage >&2
|
||||||
fi
|
exit 1
|
||||||
|
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
input_file=$1
|
input_file=$1
|
||||||
output_file=$2
|
output_file=$2
|
||||||
begin_date=$3
|
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
|
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
|
fi
|
||||||
|
|
||||||
if [ -z "$ncpus" ]; then
|
if [ -z "$ncpus" ]; then
|
||||||
ncpus=1
|
ncpus=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Allow delayed start
|
||||||
|
|
||||||
if [ -z "$begin_date" ]; then
|
if [ -z "$begin_date" ]; then
|
||||||
begin_date=now
|
begin_date=now
|
||||||
fi
|
fi
|
||||||
@@ -38,16 +64,33 @@ if [ -f "$output_file" ]; then
|
|||||||
|
|
||||||
if [ "$confirm" = "y" ]; then
|
if [ "$confirm" = "y" ]; then
|
||||||
> "$output_file"
|
> "$output_file"
|
||||||
|
else
|
||||||
|
echo "Cancelling job submission" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
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 \
|
GAUSSIAN_SCRIPT=/cm/shared/apps/gaussian/g09revD.01/script/g09/script/g09.slurm
|
||||||
--job-name=G09-$input_file \
|
|
||||||
|
"$SBATCH" \
|
||||||
|
--job-name="G09-$input_file" \
|
||||||
--ntasks=1 \
|
--ntasks=1 \
|
||||||
--cpus-per-task=$ncpus \
|
--cpus-per-task=$ncpus \
|
||||||
--output=$output_file \
|
--output="$output_file" \
|
||||||
--begin=$begin_date \
|
--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