Commit 2a91908e authored by Doak, Peter W's avatar Doak, Peter W
Browse files

this script catches the term signal and writes the

espresso exit file.  Then it waits.  Also changes restart to restart in
in file
parent ae800389
#!/bin/bash
#PBS -S /bin/bash
#PBS -m be
#PBS -M your@email.com
#PBS -N name_job
#PBS -q batch
#PBS -l nodes=4:ppn=32:hw32
#PBS -l walltime=12:00:00
#PBS -A cnms-burst
#PBS -W group_list=cades-user
#PBS -l qos=burst
#PBS -l naccesspolicy=singlejob
export OMP_NUM_THREADS=1
TAG="burst"
#PID_MPI=0
OUT_FILE="out"
function logit
{
echo $1 >> $PBS_O_WORKDIR/${TAG}test.log
}
echo "start--- UID: ${UID} GROUPS: ${GROUPS}" > $PBS_O_WORKDIR/${TAG}test.log
cd $PBS_O_WORKDIR
module load env/cades-cnms
module load espresso/6.1
temp=$(cat 'in' | awk '/prefix/ {print $3}')
prefix=${temp//[\\',]/}
logit ${prefix}
stop_handler()
{
logit "stop_handler called. Write stop file"
echo "STOP" > ${prefix}.EXIT
I=0
dont_kill_espresso=1
while( $dont_kill_espresso );
do
logit "Waiting on espresso"
((I++))
logit $I
echo $I
sleep 1
if [[ -z $(grep 'JOB DONE' $OUT_FILE) ]]
then
sed -e 's/from_scratch/restart/' < in >temp_in
mv temp_in in
$dont_kill_espresso=0
fi
done
echo "done"
exit -1
}
trap 'stop_handler' INT TERM USR2 2 15 HUP
trap 'dead_child' CHLD
printenv
cat $PBS_NODEFILE > pbs_nodefile
logit "$installed_traps"
mpirun -x OMP_NUM_THREADS=1 $PWSCF_MPI_FLAGS $PWSCF -npool 1 -in in 2>&1 >out&
PID_MDI=$!
wait $PID_MPI
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