Commit 96b5ca40 authored by Christian Meesters's avatar Christian Meesters

altered working version to check some ideas

parent 72142522
......@@ -33,6 +33,8 @@ module load chem/ORCA
# guess a users account
_arg_assoc=$(sacct -nu "$USER" -o Account%20 | tail -n1 | tr -d '[:space:]')
# which cluster are we on
cluster=$(sacctmgr show cluster -p --noheader| cut -f1 -d '|')
_arg_queue="parallel"
_arg_constraint="broadwell"
......@@ -235,39 +237,50 @@ if [ -z "$SLURM_JOB_ID" ]; then
for sample in "${_arg_inputdir}"/*.gjf; do
### infer job tag
if [ -z "$_arg_tag" ]; then
_arg_tag="ORCA_$(basename "$_arg_inputdir")_on_$(basename "$sample")_%j"
# remove the suffix from the sample name
samplename=${sample/\.gjf/}
_arg_tag="ORCA_$(basename "$_arg_inputdir")_on_$(basename "$samplename")_%j"
fi
### check if output directory already exists
if [[ ! -d "${_arg_outdir// }" ]]; then
_arg_outdir="$(pwd)/${_arg_tag}"
mkdir -p "${_arg_outdir/%j/}"
_arg_outdir="$(pwd)/${_arg_tag/_\%j/}"
mkdir -p "${_arg_outdir}"
else
error "${_arg_outdir// } exists already! Possibly over overwrite of results. Cowardly giving up."
fi
sbatch -A "${_arg_assoc}" -p parallel -J "${_arg_tag}" -o "${_arg_outdir}" -n 40 -t 120:00:00 --signal=B:SIGUSR2@600 -N 1 --wrap "$(cat << EOF
set -x
# TODO check scalability and time constraints
if [ "$cluster" = "mogon2" ]; then
queue="parallel"
tasks=40
else
queue="nodeshort"
tasks=64
fi
#TODO: check sensible time constraint
# saving standard settings
submit_statement="sbatch -A ${_arg_assoc} -p $queue -J ${_arg_tag} -o ${_arg_outdir}/${_arg_outdir}.log -n $tasks -t 300 --signal=B:SIGUSR2@600 -N 1"
$submit_statement --wrap "$(cat << EOF
cleanup(){
cp /localscratch/${SLURM_JOB_ID}/* "\${_arg_outdir}"
cp /localscratch/\${SLURM_JOB_ID}/* "${_arg_outdir}"
#TODO: check for restart capability at this point
exit
}
trap 'cleanup' SIGUSR2
scratch=/localscratch/\${SLURM_JOB_ID}
cp $sample "\$scratch"
for fname in ${samplename}*; do
sbcast \$fname "\$scratch"/\$(basename \$fname)
done
#cp $sample "\$scratch"
# Go to jobdir and start the program
cd /localscratch/\${SLURM_JOB_ID}
set OMPI_MCA_btl=self,sm
set OMPI_MCA_btl=self,sm,openib
eval $(which orca) "\$scratch"/$(basename $sample)
cleanup
EOF
)"
done
fi
#./orca.sh ${sample}
# done
# fi
#https://stackoverflow.com/questions/53071681/use-of-a-heredoc-with-slurm-sbatch-wrap
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment