From 33bba729f421dddf2b8b6bac903fba08e12fc301 Mon Sep 17 00:00:00 2001 From: Artur Glavic Date: Mon, 5 Nov 2018 09:04:30 +0100 Subject: [PATCH] Add script for interactive continue run --- icsubmit | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 icsubmit diff --git a/icsubmit b/icsubmit new file mode 100755 index 0000000..445f96c --- /dev/null +++ b/icsubmit @@ -0,0 +1,47 @@ +#!/bin/bash +# script to submit interactive job to mcc05 or mcc06 with 64 cores +[[ -z "$1" ]] && { echo "You have to supply mcc05 or mcc06" ; exit 1; } +# make sure the tag for the generated files is correct +# by checking that all changes have been commited to GIT +# (this does not include newly created files) +if ( ! git diff-index --quiet --cached HEAD -- ) || ( ! git diff-files --quiet ) + then + echo "Uncommitted changes in the GIT repository:" + git status --untracked-files=no + + read -p "Add changes and commit, amend last commit or exit [c/a/e]: " res + case $res in + [Cc]* ) git commit -a;; + [Aa]* ) git commit -a --amend;; + * ) exit 1;; + esac +fi + +CURRENT_VERSION=`git describe --tags --long` +NCORES=${2:-64} +# version to continue, by default this or the previous version +CONTINUE_VERSION=${3:-$CURRENT_VERSION} +if [ ! -f "runs/e2-estia_$CONTINUE_VERSION.run" ]; then + # get describe from previous version + echo "No run for revision $CONTINUE_VERSION, try to use previous version" + PREV_ID=`git log -n 2 --oneline --pretty=format:"%h" | tail -1` + CONTINUE_VERSION=`git describe --tags --long $PREV_ID` +fi + +echo "Starting at `date`" +echo "Running on hosts: $1" +echo "Running on $NCORES processors." +echo "Current working directory is `pwd`" +echo "Estia GIT revision is $CURRENT_VERSION" +echo "Continue run of revision $CONTINUE_VERSION" + +mpirun -np $NCORES --host $1 mcnp6.mpi c \ + inp=crun.i outp=results/e2-estia_$CURRENT_VERSION.out \ + runtpe=runs/e2-estia_$CONTINUE_VERSION.run \ + mctal=results/e2-estia_$CURRENT_VERSION.mct \ + mdata=results/e2-estia_$CURRENT_VERSION.mdt \ + wwout=weight_windows/e2-estia_$CURRENT_VERSION.wwg \ + wwone=weight_windows/e2-estia_$CURRENT_VERSION.wwo \ + wwinp=weight_windows/current.wwg + +echo "Program finished with exit code $? at: `date`"