-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrun.sh
executable file
·56 lines (46 loc) · 1.29 KB
/
run.sh
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
#!/bin/bash
# Define directory names
ROOT=`pwd`
BIN=$ROOT/bin
RUNDIR=$ROOT/rundir
CLIM=$ROOT/data/bc/t30/clim
ANOM=$ROOT/data/bc/t30/anom
# Check model executable exists
if [ ! -f $BIN/speedy ]; then
echo "No executable found in bin ($BIN)"
echo "Have you run ./build.sh yet?"
fi
# Make and move to run directory
rm -rf $RUNDIR
mkdir -p $RUNDIR
cd $RUNDIR
# Copy executable
cp $BIN/speedy .
# Link input files
ln -s $CLIM/surface.nc .
ln -s $CLIM/sea_surface_temperature.nc .
ln -s $CLIM/sea_ice.nc .
ln -s $CLIM/land.nc .
ln -s $CLIM/snow.nc .
ln -s $CLIM/soil.nc .
ln -s $ANOM/sea_surface_temperature_anomaly.nc .
# Copy namelist file to run directory
cp ../namelist.nml $RUNDIR
# Run SPEEDY
if [ "$1" = "--profile" ]; then
if ! [ -x "$(command -v dot)" ]; then
echo "dot command not found"
echo "You must install graphviz to use the --profile option"
exit 1
fi
# Run SPEEDY and generate profile data
./speedy
gprof speedy gmon.out > profile.txt
# Remove __*_MOD_ function prefixes from profiler output
sed -e "s/ __.*_MOD_//g" -i profile.txt
# Generate call graph using gprof2dot and graphviz (dot)
python $ROOT/scripts/gprof2dot.py --skew 0.1 -n 0.8 profile.txt\
| dot -Tpdf -o profile.pdf
else
time ./speedy | tee output.txt
fi