Commit d870b9ea authored by Pierre Cazenave's avatar Pierre Cazenave

Modify the run script to be able to launch multiple jobs simultaneously using...

Modify the run script to be able to launch multiple jobs simultaneously using the same model inputs.
parent c2fe8e71
......@@ -2,15 +2,60 @@
# Script to generate a .pbs file and launch the job.
if [ $# -ne 2 ]; then
echo "Usage: $(basename $0) NPROCS TEMPLATE"
exit 1
fi
MODELS=(models/*.nml) # model namelists
TPN=8
PROCS=$1
NODES=$(($PROCS/$TPN))
TEMPLATE=$2
TEMPLATE=../../$2
for ((m=0; m<${#MODELS[@]}; m++)); do
# Create a run directory for this model.
SUFFIX=$(echo ${MODELS[m]} | cut -f2- -d_ | sed 's/_run.nml//g')
PBS=estuary.p$PROCS.n$NODES.$SUFFIX.pbs
# The launch directory should have only symlinks in it.
if [ ! -d ./launch/$SUFFIX ]; then
mkdir -p ./launch/$SUFFIX
else
mv ./launch/$SUFFIX/FVCOM.* logs
fi
find ./launch/$SUFFIX/ -type l -delete
# Make the relevant output directory
if [ ! -d ./output/$SUFFIX ]; then
mkdir -p ./output/$SUFFIX
fi
cd ./launch/$SUFFIX
# Prep the launch directory.
ln -s ../../${MODELS[m]} tst_run.nml
ln -s ../../../tstinp
ln -s ../../output/$SUFFIX output
ln -s ../../logs
ln -s ../../fvcom
# Fix the PBS file.
sed "s,__NODES__,$NODES,g;s,__TPN__,$TPN,g;s,__POPMOD__,HP,g;s,__TASKS__,$PROCS,g" $TEMPLATE > $PBS
sed -i 's,^RUNDIR=/home_nfs/pica/models/FVCOM/fvcom-examples/Estuary/run,RUNDIR=/home_nfs/pica/models/FVCOM/fvcom-examples/Estuary/run/launch/'${SUFFIX}',g' $PBS
#sed -i 's/^CASENAME=tst/CASENAME=tst_'${SUFFIX}'/g' $PBS
# GO! GO! GO!
qsub -qworkq $PBS
rm $PBS
PBS=estuary.p$PROCS.n$NODES.pbs
sed "s,__NODES__,$NODES,g;s,__TPN__,$TPN,g;s,__POPMOD__,HP,g;s,__TASKS__,$PROCS,g" $TEMPLATE > $PBS
cd ~-
mv FVCOM.* logs
qsub -qworkq $PBS
done
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