-
Notifications
You must be signed in to change notification settings - Fork 41
/
job.multiGenerationSimulation.sh.tmpl
91 lines (77 loc) · 3.31 KB
/
job.multiGenerationSimulation.sh.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
#job
#PBS -N runSimulation-<TMPL_VAR NAME=conditionSetTimeStamp>-<TMPL_VAR NAME=n>
#user
#PBS -P <TMPL_VAR NAME=linuxRunUser>:<TMPL_VAR NAME=linuxRunUser>
#notification
#PBS -M <TMPL_VAR NAME=emailAddress>
#PBS -m a
#resources
#PBS -l walltime=72:00:00
#PBS -l nodes=1:ppn=1
#PBS -l mem=1300mb
#PBS -l vmem=3gb
#schedule
<TMPL_IF NAME=hasParentJob>
#PBS -W depend=afterany:<TMPL_VAR NAME=afterany>
</TMPL_IF>
#log
#PBS -o <TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/out.log
#PBS -e <TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/err.log
#PBS -W umask=002
#staging
#PBS -v TMPDIR=<TMPL_VAR NAME=nodeTmpDir>
#PBS -W stagein=<TMPL_VAR NAME=nodeTmpDir>/$PBS_JOBID/@<TMPL_VAR NAME=storageServer>:<TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>/bin/runSimulation/
#PBS -W stagein=<TMPL_VAR NAME=nodeTmpDir>/$PBS_JOBID/conditions.xml@<TMPL_VAR NAME=storageServer>:<TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/conditions.xml
##PBS -W stageout=<TMPL_VAR NAME=nodeTmpDir>/$PBS_JOBID/<TMPL_VAR NAME=conditionSetTimeStamp>@<TMPL_VAR NAME=storageServer>:<TMPL_VAR NAME=outDir>
#set environment
export MATLAB_PREFDIR=/tmp/emptydir
export MCR_CACHE_ROOT=/tmp/mcr_cache_$PBS_JOBID
mkdir -p $MCR_CACHE_ROOT
#setup
cd <TMPL_VAR NAME=nodeTmpDir>/$PBS_JOBID
mkdir <TMPL_VAR NAME=conditionSetTimeStamp>
mkdir <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>
mkdir <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=nChild1>
mkdir <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=nChild2>
mv conditions.xml <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>
<TMPL_IF NAME=hasInitialConditions>
if [ -f <TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/initialConditions.mat ];
then
cp <TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/initialConditions.mat <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/
else
echo "Initial conditions not supplied"
exit 0;
fi
</TMPL_IF>
#job
./run_runSimulation.sh <TMPL_VAR NAME=pathToRunTime> \
'outDir' <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n> \
'logToDisk' true \
'logToDb' false \
'childDir1' <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=nChild1> \
'childDir2' <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=nChild2>
#set permissions, store data
rm -f <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/conditions.xml
<TMPL_IF NAME=hasInitialConditions>
rm -f <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/initialConditions.mat
</TMPL_IF>
chmod -R 775 <TMPL_VAR NAME=conditionSetTimeStamp>/
cp -R <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n> <TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>
cp -R <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=nChild1> <TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>
cp -R <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=nChild2> <TMPL_VAR NAME=outDir>/<TMPL_VAR NAME=conditionSetTimeStamp>
#cleanup
rm -rf <TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/
rm -rf $MCR_CACHE_ROOT/*
#resources
echo ""
echo "=============="
echo "=== status ==="
echo "=============="
qstat -f $PBS_JOBID
#status
if [[ -f "<TMPL_VAR NAME=conditionSetTimeStamp>/<TMPL_VAR NAME=n>/err.mat" ]]
then
exit 1
fi
exit 0