| 1 |
#! /usr/bin/env bash |
| 2 |
|
| 3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/faulks/test_lcs,v 1.5 2007/01/15 03:22:41 edhill Exp $ |
| 4 |
|
| 5 |
# Ed Hill |
| 6 |
|
| 7 |
# Test script for MITgcm that should work on most of the lcs.mit.edu |
| 8 |
# Linux machines. |
| 9 |
|
| 10 |
usage() |
| 11 |
{ |
| 12 |
cat << EOF |
| 13 |
|
| 14 |
Usage: $0 [OPTIONS] |
| 15 |
|
| 16 |
where possible OPTIONS are: |
| 17 |
(-help|-h) print usage |
| 18 |
(-dir | -d) TDIR specify testing directory |
| 19 |
(def="$TDIR") |
| 20 |
(-of | -optfile) FILE specify an OPTFILE |
| 21 |
(def="$OPTFILE") |
| 22 |
(-[no]ieee) IEEE math flag |
| 23 |
(def="$IEEE") |
| 24 |
|
| 25 |
EOF |
| 26 |
exit 1 |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
# defaults |
| 31 |
export PATH='/usr/local/bin:/bin:/usr/bin' |
| 32 |
OPTFILE= |
| 33 |
TESTDIR="/scratch2/edhill/test_"`hostname` |
| 34 |
IEEE="-ieee" |
| 35 |
|
| 36 |
# Parse options |
| 37 |
ac_prev= |
| 38 |
for ac_option ; do |
| 39 |
|
| 40 |
# If the previous option needs an argument, assign it. |
| 41 |
if test -n "$ac_prev"; then |
| 42 |
eval "$ac_prev=\$ac_option" |
| 43 |
ac_prev= |
| 44 |
continue |
| 45 |
fi |
| 46 |
|
| 47 |
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` |
| 48 |
|
| 49 |
case $ac_option in |
| 50 |
|
| 51 |
-help | --help | -h | --h) |
| 52 |
usage ;; |
| 53 |
|
| 54 |
-dir | --dir | -d | --d) |
| 55 |
ac_prev=TESTDIR ;; |
| 56 |
-dir=* | --dir=* | -d=* | --d=*) |
| 57 |
TESTDIR=$ac_optarg ;; |
| 58 |
|
| 59 |
-of | --of | -optfile | --optfile) |
| 60 |
ac_prev=OPTFILE ;; |
| 61 |
--of=* | -of=* | --optfile=* | -optfile=*) |
| 62 |
OPTFILE=$ac_optarg ;; |
| 63 |
|
| 64 |
-ieee) |
| 65 |
IEEE="-ieee" ;; |
| 66 |
-noieee) |
| 67 |
IEEE= ;; |
| 68 |
|
| 69 |
*) |
| 70 |
echo "Error: don't understand argument \"$ac_option\"" |
| 71 |
usage |
| 72 |
;; |
| 73 |
|
| 74 |
esac |
| 75 |
|
| 76 |
done |
| 77 |
|
| 78 |
# Turn off stack limit for FIZHI |
| 79 |
ulimit -s unlimited |
| 80 |
|
| 81 |
echo -n "Creating a temp directory ..." |
| 82 |
mach=`hostname` |
| 83 |
file=${OPTFILE##*/} |
| 84 |
tdir=$TESTDIR"_"$file |
| 85 |
test -e $tdir && rm -rf $tdir |
| 86 |
mkdir $tdir |
| 87 |
echo " done" |
| 88 |
|
| 89 |
echo -n "Downloading the MITgcm code from CVS pserver..." |
| 90 |
cd $tdir |
| 91 |
export CVSROOT='/u/gcmpack' |
| 92 |
cvs co -P MITgcm > /dev/null 2>&1 |
| 93 |
echo " done" |
| 94 |
|
| 95 |
new_dir='MITgcm_g77' |
| 96 |
test -e $new_dir && rm -rf $new_dir |
| 97 |
mkdir $new_dir |
| 98 |
|
| 99 |
pushd $new_dir |
| 100 |
cp -ra ../MITgcm/* . |
| 101 |
echo "Running testreport using:" |
| 102 |
cd verification |
| 103 |
comm="./testreport $IEEE -a edhill@mitgcm.org" |
| 104 |
if test "x$OPTFILE" != x ; then |
| 105 |
comm="$comm -of=$OPTFILE" |
| 106 |
fi |
| 107 |
echo " \"$comm\"" |
| 108 |
echo "======================" |
| 109 |
echo |
| 110 |
$comm | tail -100 |
| 111 |
popd |
| 112 |
|
| 113 |
new_dir='MITgcm_ifort' |
| 114 |
test -e $new_dir && rm -rf $new_dir |
| 115 |
mkdir $new_dir |
| 116 |
|
| 117 |
pushd $new_dir |
| 118 |
cp -ra ../MITgcm/* . |
| 119 |
echo "Running testreport using:" |
| 120 |
cd verification |
| 121 |
comm="./testreport $IEEE -of ../tools/build_options/linux_ia32_ifort -a edhill@mitgcm.org" |
| 122 |
echo " \"$comm\"" |
| 123 |
echo "======================" |
| 124 |
echo |
| 125 |
$comm | tail -100 |
| 126 |
popd |
| 127 |
|
| 128 |
new_dir='MITgcm_pgi' |
| 129 |
test -e $new_dir && rm -rf $new_dir |
| 130 |
mkdir $new_dir |
| 131 |
|
| 132 |
pushd $new_dir |
| 133 |
cp -ra ../MITgcm/* . |
| 134 |
echo "Running testreport using:" |
| 135 |
export PGI=/usr/local/pkg/pgi/pgi-5.2-fc3 |
| 136 |
cd verification |
| 137 |
comm="./testreport $IEEE -of ../tools/build_options/linux_ia32_pgf77+authors_fc3 -a edhill@mitgcm.org" |
| 138 |
echo " \"$comm\"" |
| 139 |
echo "======================" |
| 140 |
echo |
| 141 |
$comm | tail -100 |
| 142 |
popd |
| 143 |
|
| 144 |
new_dir='MITgcm_adm' |
| 145 |
test -e $new_dir && rm -rf $new_dir |
| 146 |
mkdir $new_dir |
| 147 |
|
| 148 |
pushd $new_dir |
| 149 |
cp -ra ../MITgcm/* . |
| 150 |
echo "Running testreport using:" |
| 151 |
cd verification |
| 152 |
comm="./testreport -adm $IEEE -a edhill@mitgcm.org" |
| 153 |
if test "x$OPTFILE" != x ; then |
| 154 |
comm="$comm -of=$OPTFILE" |
| 155 |
fi |
| 156 |
echo " \"$comm\"" |
| 157 |
echo "======================" |
| 158 |
echo |
| 159 |
$comm | tail -100 |
| 160 |
popd |