[7256] | 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 | |
---|
| 8 | LOGFILE=$(pwd)/run_profile.log |
---|
| 9 | TMPFILE=$(pwd)/tmp_xyzzy |
---|
| 10 | #NUMRUNS=5 |
---|
| 11 | NUMRUNS=1 |
---|
| 12 | ANUGA_NUMERIC_BASE=/nas/gemd/georisk_models/inundation/sandpits/rwilson/anuga_core/source/anuga |
---|
| 13 | ANUGA_NUMPY_BASE=/nas/gemd/georisk_models/inundation/sandpits/rwilson/branches/numpy/anuga |
---|
| 14 | DELIM1="--------------------------------------------------------------------------------------" |
---|
| 15 | DELIM2="######################################################################################" |
---|
| 16 | PYTHON25=/usr/local/bin/python2.5 |
---|
| 17 | PYTHON24=/usr/bin/python2.4 |
---|
| 18 | |
---|
| 19 | # clear the logfile |
---|
| 20 | rm -f $LOGFILE |
---|
| 21 | echo "$DELIM2" >> $LOGFILE |
---|
| 22 | |
---|
| 23 | rm -f $TMPFILE |
---|
| 24 | |
---|
| 25 | # set environment to python2.4, Numeric trunk |
---|
| 26 | echo "set environment to python2.4, Numeric trunk" |
---|
| 27 | export PYTHONPATH=$(dirname $ANUGA_NUMERIC_BASE) |
---|
| 28 | if [ -d ~/bin ]; then |
---|
| 29 | mv ~/bin ~/xbin |
---|
| 30 | hash >/dev/null 2>&1 |
---|
| 31 | fi |
---|
| 32 | |
---|
| 33 | echo "$DELIM2" >> $LOGFILE |
---|
| 34 | echo "Python 2.4, Numeric trunk" >> $LOGFILE |
---|
| 35 | echo "$DELIM2" >> $LOGFILE |
---|
| 36 | echo "" >> $LOGFILE |
---|
| 37 | |
---|
| 38 | # dump the environment to the log file |
---|
| 39 | echo "PYTHONPATH=$PYTHONPATH" >> $LOGFILE |
---|
| 40 | VERSION=$($PYTHON24 -V 2>&1) |
---|
| 41 | echo "python version is $VERSION" >> $LOGFILE |
---|
| 42 | echo "$DELIM1" >> $LOGFILE |
---|
| 43 | |
---|
| 44 | # compile the code. |
---|
| 45 | echo "compile the code" |
---|
| 46 | HERE=$(pwd) |
---|
| 47 | cd $ANUGA_NUMERIC_BASE |
---|
| 48 | $PYTHON24 compile_all.py >> $LOGFILE 2>&1 |
---|
| 49 | echo "run test_all.py" |
---|
| 50 | $PYTHON24 test_all.py >> $LOGFILE 2>&1 |
---|
| 51 | cd $HERE |
---|
| 52 | echo "$DELIM1" >> $LOGFILE |
---|
| 53 | |
---|
| 54 | # run the profile code $NUMRUNS times |
---|
| 55 | echo "run the profile code $NUMRUNS times" |
---|
| 56 | COUNT=0 |
---|
| 57 | while [ $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 |
---|
| 62 | done |
---|
| 63 | |
---|
| 64 | # run the okushiri profile code |
---|
| 65 | echo "run the okushiri profile code $NUMRUNS times" |
---|
| 66 | HERE=$(pwd) |
---|
| 67 | cd okushiri |
---|
| 68 | COUNT=0 |
---|
| 69 | while [ $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 |
---|
| 75 | done |
---|
| 76 | cd $HERE |
---|
| 77 | |
---|
| 78 | echo "" >> $LOGFILE |
---|
| 79 | echo "$DELIM2" >> $LOGFILE |
---|
| 80 | echo "Python 2.5, numpy branch" >> $LOGFILE |
---|
| 81 | echo "$DELIM2" >> $LOGFILE |
---|
| 82 | echo "" >> $LOGFILE |
---|
| 83 | |
---|
| 84 | # set environment to python2.5, numpy trunk |
---|
| 85 | echo "set environment to python2.5, numpy trunk" |
---|
| 86 | export PYTHONPATH=$(dirname $ANUGA_NUMPY_BASE) |
---|
| 87 | if [ -d ~/xbin ]; then |
---|
| 88 | mv ~/xbin ~/bin |
---|
| 89 | hash >/dev/null 2>&1 |
---|
| 90 | fi |
---|
| 91 | |
---|
| 92 | # dump the environment to the log file |
---|
| 93 | echo "PYTHONPATH=$PYTHONPATH" >> $LOGFILE |
---|
| 94 | VERSION=$($PYTHON25 -V 2>&1) |
---|
| 95 | echo "python version is $VERSION" >> $LOGFILE |
---|
| 96 | echo "$DELIM1" >> $LOGFILE |
---|
| 97 | |
---|
| 98 | # compile the code. |
---|
| 99 | echo "compile the code" |
---|
| 100 | HERE=$(pwd) |
---|
| 101 | cd $ANUGA_NUMPY_BASE |
---|
| 102 | $PYTHON25 compile_all.py >> $LOGFILE 2>&1 |
---|
| 103 | echo "run test_all.py" |
---|
| 104 | $PYTHON25 test_all.py >> $LOGFILE 2>&1 |
---|
| 105 | cd $HERE |
---|
| 106 | echo "$DELIM1" >> $LOGFILE |
---|
| 107 | |
---|
| 108 | # run the profile code $NUMRUNS times |
---|
| 109 | echo "run the profile code $NUMRUNS times" |
---|
| 110 | COUNT=0 |
---|
| 111 | while [ $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 |
---|
| 116 | done |
---|
| 117 | |
---|
| 118 | # run the okushiri profile code |
---|
| 119 | echo "run the okusihiri profile code $NUMRUNS times" |
---|
| 120 | HERE=$(pwd) |
---|
| 121 | cd okushiri |
---|
| 122 | COUNT=0 |
---|
| 123 | while [ $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 |
---|
| 129 | done |
---|
| 130 | cd $HERE |
---|
| 131 | |
---|
| 132 | echo "" >> $LOGFILE |
---|
| 133 | echo "$DELIM2" >> $LOGFILE |
---|
| 134 | echo "" >> $LOGFILE |
---|
| 135 | |
---|
| 136 | |
---|