gmsgrid.run
#!/bin/sh -x
# execute grid solver
USEWHARTON=yes
# $1 = solver executable
# $2 = control file name, in sub-scratch directory
# $3 = sub-scratch directory, unique to this solve
# gmscr_ux.out = tool to convert solution to GDX format
if [ $USEWHARTON = yes ] ; then
if [ -f $HOME/.profile ]; then
. $HOME/.profile
fi
script=${3}gridjob.sh
echo "#!/bin/sh -x" > $script
echo 'if [ -f $HOME/.profile ]; then' >> $script
echo ' . $HOME/.profile' >> $script
echo 'fi' >> $script
echo "echo GridEngine START" >> $script
echo "env|grep -i hostname" >> $script
echo "echo GridEngine: END" >> $script
echo LD_LIBRARY_PATH=$HOME/gams:/usr/sfw/lib/amd64:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH >> $script
echo PATH=$PATH:$HOME/gams; export PATH >> $script
echo $HOME/gams/$1 $2 >> $script
echo $HOME/gams/gmscr_ux.out $2 >> $script
echo echo OK \> ${3}finished >> $script
# output is redirected by qsub to gridjob.oJOB#, errs to gridjob.eJOB#
qsub -cwd -V $script &
else
echo "#!/bin/sh " > ${3}runit.sh
echo $1 $2 >> ${3}runit.sh
echo gmscr_ux.out $2 >> ${3}runit.sh
echo echo OK \> ${3}finished >> ${3}runit.sh
chmod 750 ${3}runit.sh
echo "#!/bin/sh" > ${3}gmsrerun.run
echo "${3}runit.sh > /dev/null &" >> ${3}gmsrerun.run
chmod 750 ${3}gmsrerun.run
${3}runit.sh > /dev/null &
fi