source: anuga_validation/performance_tests/test.sh @ 7256

Last change on this file since 7256 was 7256, checked in by rwilson, 15 years ago

Easy way to run profiling.

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#!/bin/bash
2
3######
4# A program to create 5 (or whatever) runs of run_profile.py.
5# Must be executed from 'anuga_validation/performance_tests'.
6######
7
8LOGFILE=$(pwd)/run_profile.log
9TMPFILE=$(pwd)/tmp_xyzzy
10#NUMRUNS=5
11NUMRUNS=1
12ANUGA_NUMERIC_BASE=/nas/gemd/georisk_models/inundation/sandpits/rwilson/anuga_core/source/anuga
13ANUGA_NUMPY_BASE=/nas/gemd/georisk_models/inundation/sandpits/rwilson/branches/numpy/anuga
14DELIM1="--------------------------------------------------------------------------------------"
15DELIM2="######################################################################################"
16PYTHON25=/usr/local/bin/python2.5
17PYTHON24=/usr/bin/python2.4
18
19# clear the logfile
20rm -f $LOGFILE
21echo "$DELIM2" >> $LOGFILE
22
23rm -f $TMPFILE
24
25# set environment to python2.4, Numeric trunk
26echo "set environment to python2.4, Numeric trunk"
27export PYTHONPATH=$(dirname $ANUGA_NUMERIC_BASE)
28if [ -d ~/bin ]; then
29    mv ~/bin ~/xbin
30    hash >/dev/null 2>&1
31fi
32
33echo "$DELIM2" >> $LOGFILE
34echo "Python 2.4, Numeric trunk" >> $LOGFILE
35echo "$DELIM2" >> $LOGFILE
36echo "" >> $LOGFILE
37
38# dump the environment to the log file
39echo "PYTHONPATH=$PYTHONPATH" >> $LOGFILE
40VERSION=$($PYTHON24 -V 2>&1)
41echo "python version is $VERSION" >> $LOGFILE
42echo "$DELIM1" >> $LOGFILE
43
44# compile the code.
45echo "compile the code"
46HERE=$(pwd)
47cd $ANUGA_NUMERIC_BASE
48$PYTHON24 compile_all.py >> $LOGFILE 2>&1
49echo "run test_all.py"
50$PYTHON24 test_all.py >> $LOGFILE 2>&1
51cd $HERE
52echo "$DELIM1" >> $LOGFILE
53
54# run the profile code $NUMRUNS times
55echo "run the profile code $NUMRUNS times"
56COUNT=0
57while [ $COUNT -lt $NUMRUNS ]; do
58    COUNT=$(( $COUNT + 1 ))
59    echo "run_profile.py - $COUNT of $NUMRUNS"
60    $PYTHON24 run_profile.py >> $LOGFILE 2>&1
61    echo "$DELIM1" >> $LOGFILE
62done
63
64# run the okushiri profile code
65echo "run the okushiri profile code $NUMRUNS times"
66HERE=$(pwd)
67cd okushiri
68COUNT=0
69while [ $COUNT -lt $NUMRUNS ]; do
70    COUNT=$(( $COUNT + 1 ))
71    echo "run_okushiri_profile.py - $COUNT of $NUMRUNS"
72    $PYTHON24 run_okushiri_profile.py > $TMPFILE 2>&1
73    tail -40 $TMPFILE >> $LOGFILE
74    echo "$DELIM1" >> $LOGFILE
75done
76cd $HERE
77
78echo "" >> $LOGFILE
79echo "$DELIM2" >> $LOGFILE
80echo "Python 2.5, numpy branch" >> $LOGFILE
81echo "$DELIM2" >> $LOGFILE
82echo "" >> $LOGFILE
83
84# set environment to python2.5, numpy trunk
85echo "set environment to python2.5, numpy trunk"
86export PYTHONPATH=$(dirname $ANUGA_NUMPY_BASE)
87if [ -d ~/xbin ]; then
88    mv ~/xbin ~/bin
89    hash >/dev/null 2>&1
90fi
91
92# dump the environment to the log file
93echo "PYTHONPATH=$PYTHONPATH" >> $LOGFILE
94VERSION=$($PYTHON25 -V 2>&1)
95echo "python version is $VERSION" >> $LOGFILE
96echo "$DELIM1" >> $LOGFILE
97
98# compile the code.
99echo "compile the code"
100HERE=$(pwd)
101cd $ANUGA_NUMPY_BASE
102$PYTHON25 compile_all.py >> $LOGFILE 2>&1
103echo "run test_all.py"
104$PYTHON25 test_all.py >> $LOGFILE 2>&1
105cd $HERE
106echo "$DELIM1" >> $LOGFILE
107
108# run the profile code $NUMRUNS times
109echo "run the profile code $NUMRUNS times"
110COUNT=0
111while [ $COUNT -lt $NUMRUNS ]; do
112    COUNT=$(( $COUNT + 1 ))
113    echo "run_profile.py - $COUNT of $NUMRUNS"
114    $PYTHON25 run_profile.py >> $LOGFILE 2>&1
115    echo "$DELIM1" >> $LOGFILE
116done
117
118# run the okushiri profile code
119echo "run the okusihiri profile code $NUMRUNS times"
120HERE=$(pwd)
121cd okushiri
122COUNT=0
123while [ $COUNT -lt $NUMRUNS ]; do
124    COUNT=$(( $COUNT + 1 ))
125    echo "run_okushiri_profile.py - $COUNT of $NUMRUNS"
126    $PYTHON25 run_okushiri_profile.py > $TMPFILE 2>&1
127    tail -40 $TMPFILE >> $LOGFILE
128    echo "$DELIM1" >> $LOGFILE
129done
130cd $HERE
131
132echo "" >> $LOGFILE
133echo "$DELIM2" >> $LOGFILE
134echo "" >> $LOGFILE
135
136
Note: See TracBrowser for help on using the repository browser.