1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/mitgcm.org/scripts/testing_score,v 1.4 2023/05/30 17:51:36 jmc Exp $ |
4 |
# |
5 |
# The purpose of this script is to print the testing score of all testreport results |
6 |
# stored in the monthly archive dir, either from few selected platform or from all platform |
7 |
|
8 |
#INDIR="/net/orwell/export/export-9/mitgcm-testing/results/$PERIOD" |
9 |
INDIR="/u/u0/httpd/html/testing/results/$PERIOD" |
10 |
#INDIR="./2009_06" |
11 |
INDIR="." |
12 |
|
13 |
YYMM=`( cd $INDIR ; pwd | sed 's/\// /g' | awk '{print $NF}' | sed 's/_//' )` |
14 |
xx=`echo $YYMM | sed 's/[0-9]*/x/'` |
15 |
#echo "YYMM='$YYMM' ; xx='$xx'" |
16 |
if test $xx != x ; then YYMM=`date +%Y%m` ; fi |
17 |
( cd $INDIR ; ls -1 *_${YYMM}??_*/summary.txt | sed 's/\/summary.txt//' ) > ./dir_all |
18 |
#( cd $INDIR ; ls -1 -t *_${YYMM}??_*/summary.txt | sed 's/\/summary.txt//' ) > ./dir_all |
19 |
|
20 |
addHost=0 |
21 |
if [ $# -gt 0 ] ; then if test $1 = '+h' ; then |
22 |
addHost=1 ; shift |
23 |
fi ; fi |
24 |
if test $# = 0 ; then |
25 |
#-- local way of getting all platforms: |
26 |
#MALL=`cat ./dir_all | sed -e 's|_| |g' | sed -e 's|\-| |' | sed -e 's|\+| |' \ |
27 |
# | awk '{print $2}' | sort | uniq` |
28 |
#echo $MALL |
29 |
#MACHINES=$MALL |
30 |
#-- as done in "make_summary" (front_content/) and "check_outp" (scripts/): |
31 |
MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq` |
32 |
MACHINES="villon batsi engaging1 engaging- svante glacier" |
33 |
MACHINES="$MACHINES albedo pleiades archer" |
34 |
for madd in $MALL ; do |
35 |
present=0 |
36 |
for m in $MACHINES ; do |
37 |
echo $madd | grep $m > /dev/null 2>&1 |
38 |
RETVAL=$? |
39 |
test $RETVAL = 0 && present=1 |
40 |
continue |
41 |
done |
42 |
test $present = 0 && MACHINES="$MACHINES $madd" |
43 |
done |
44 |
else |
45 |
MACHINES=$* |
46 |
fi |
47 |
|
48 |
for mname in $MACHINES ; do |
49 |
|
50 |
#echo " $mname" |
51 |
printf '== %-30s ======================\n' "$mname :" |
52 |
|
53 |
dir_list=`grep $mname ./dir_all` |
54 |
#echo -n "" > ./mlist |
55 |
|
56 |
#- re-order dir_list: |
57 |
sub_list=`grep $mname ./dir_all | sed "s/_$YYMM.._/_YYYYMMDD_/g" | sort | uniq` |
58 |
#echo 'sub_list=' $sub_list '<' |
59 |
dir_list='' |
60 |
for i in $sub_list ; do |
61 |
pp=`echo $i | sed 's/_YYYYMMDD_.*$//'` |
62 |
ss=`echo $i | sed 's/^.*_YYYYMMDD_//'` |
63 |
#add=`grep "${pp}_${YYMM}.._${ss}$" ./dir_all` |
64 |
#dir_list="$dir_list $add" |
65 |
dir_list="$dir_list "`grep "${pp}_${YYMM}.._${ss}$" ./dir_all` |
66 |
done |
67 |
#echo 'dir_list=' $dir_list '<' |
68 |
|
69 |
for i in $dir_list ; do |
70 |
|
71 |
dir=$INDIR"/"$i |
72 |
OPTFILE= |
73 |
if test -r $dir/summary.txt ; then |
74 |
comm=`grep 'OPTFILE=' $dir/summary.txt` |
75 |
eval $comm |
76 |
OPTFILE=${OPTFILE##*/} |
77 |
fi |
78 |
if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then |
79 |
comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null` |
80 |
eval $comm |
81 |
OPTFILE=${OPTFILE##*/} |
82 |
fi |
83 |
if test "x$OPTFILE" = x ; then |
84 |
comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1` |
85 |
comm=${comm##*#} |
86 |
eval $comm |
87 |
OPTFILE=${OPTFILE##*/} |
88 |
fi |
89 |
if test "x$OPTFILE" = x ; then |
90 |
OPTFILE="not_explicitly_specified" |
91 |
fi |
92 |
|
93 |
ADJOINT=0 |
94 |
TANGLIN=0 |
95 |
OPENAD=0 |
96 |
TAPENAD=0 |
97 |
RESTART=0 |
98 |
EXTRA= |
99 |
FAST=0 |
100 |
DVLP=0 |
101 |
MPI=0 |
102 |
MTH=0 |
103 |
UR4=0 |
104 |
HOST='' |
105 |
if test -r $dir/summary.txt ; then |
106 |
TAPENAD=`grep -c ' generated by Tapenade' $dir/summary.txt` |
107 |
ADJOINT=`grep -c -i '^ADJOINT' $dir/summary.txt` |
108 |
TANGLIN=`grep -c -i '^TANGLIN' $dir/summary.txt` |
109 |
if test "x$ADJOINT" = x1 ; then |
110 |
OPENAD=`grep -c '^Adjoint .* OpenAD' $dir/summary.txt` |
111 |
fi |
112 |
RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt` |
113 |
FAST=`grep -c "^run: .*testreport.* '*-fast'*" $dir/summary.txt` |
114 |
if test "x$FAST" = x0 ; then |
115 |
FAST=`grep -c "^run: .*testreport.* '*-noieee'*" $dir/summary.txt` |
116 |
fi |
117 |
DVLP=`grep -c "^run: .*testreport.* '*-devel'*" $dir/summary.txt` |
118 |
MPI=`grep -c "^run: .*testreport.* -mpi " $dir/summary.txt` |
119 |
if test "x$MPI" = x0 ; then |
120 |
MPI=`grep -c "^run: .*testreport.* -MPI " $dir/summary.txt` |
121 |
fi |
122 |
MTH=`grep -c "^run: .*testreport.* -mth " $dir/summary.txt` |
123 |
UR4=`grep -c "^run: .*testreport.* -use_r4 " $dir/summary.txt` |
124 |
if test "x$UR4" = x0 ; then |
125 |
UR4=`grep -c "^run: .*testreport.* -ur4 " $dir/summary.txt` |
126 |
fi |
127 |
if test $addHost = 1 ; then |
128 |
HOST=`grep '^on : ' $dir/summary.txt \ |
129 |
| awk '{print $4}' | sed 's/\..*$//'` |
130 |
fi |
131 |
fi |
132 |
if test "x$ADJOINT" = x1 ; then |
133 |
kind="adm-TAF" ; order=0 |
134 |
if test "x$TAPENAD" = x1 ; then |
135 |
kind="adm-TAP" ; order=2 |
136 |
elif test "x$OPENAD" = x1 ; then |
137 |
kind="adm-OAD" ; order=4 |
138 |
fi |
139 |
elif test "x$TANGLIN" = x1 ; then |
140 |
kind="tlm-TAF" ; order=1 |
141 |
if test "x$TAPENAD" = x1 ; then kind="tlm-TAP" ; order=3 ; fi |
142 |
elif test "x$RESTART" = x0 ; then |
143 |
kind="forward" ; order=6 |
144 |
else |
145 |
kind="restart" ; order=7 |
146 |
fi |
147 |
if test "x$UR4" = x1 ; then |
148 |
OPTFILE="${OPTFILE}.use_r4" |
149 |
fi |
150 |
if test "x$MPI" = x1 ; then |
151 |
yy=`echo $OPTFILE | grep -c '+mpi'` |
152 |
if test $yy = 0 ; then OPTFILE="${OPTFILE}+mpi" ; fi |
153 |
fi |
154 |
if test "x$MTH" = x1 ; then |
155 |
yy=`echo $OPTFILE | grep -c '+mth$'` |
156 |
if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi |
157 |
fi |
158 |
if test "x$FAST" = x1 ; then |
159 |
OPTFILE="${OPTFILE}.fast" |
160 |
fi |
161 |
if test "x$DVLP" = x1 ; then |
162 |
OPTFILE="${OPTFILE}.dvlp" |
163 |
fi |
164 |
|
165 |
t_pass="--" |
166 |
t_tot="--" |
167 |
if test -r $dir/summary.txt ; then |
168 |
grep '^[YN] [YN] [YN] [YN]' $dir/summary.txt > ./all_tests 2>/dev/null |
169 |
t_tot=`cat ./all_tests | wc -l | sed -e 's| ||g'` |
170 |
#t_pass=`grep 'pass ' ./all_tests | wc -l | sed -e 's| ||g'` |
171 |
t_pass=`grep '^Y Y Y Y' $dir/summary.txt | grep 'pass ' | wc -l | sed -e 's| ||g'` |
172 |
fi |
173 |
rm -f ./all_tests |
174 |
#echo "${dir##*/} : $t_pass out of $t_tot (of=$OPTFILE , $kind)" |
175 |
if test $OPTFILE = 'sp5-32' -a $kind = 'forward' ; then |
176 |
echo "${dir##*/} : $t_pass out of $t_tot (of=$OPTFILE , $kind)" |
177 |
fi |
178 |
|
179 |
#echo "$OPTFILE$kind $DAY $OPTFILE $kind $i $t_pass:$t_tot" >> ./mlist |
180 |
if test $addHost = 1 ; then |
181 |
if [ $t_tot -lt 100 ] ; then |
182 |
printf ' %3i:%2.2i %-40s %s %-40s %s\n' $t_pass $t_tot $i $kind $OPTFILE $HOST |
183 |
else |
184 |
printf ' %3i:%3.3i %-40s %s %-40s %s\n' $t_pass $t_tot $i $kind $OPTFILE $HOST |
185 |
fi |
186 |
else |
187 |
if [ $t_tot -lt 100 ] ; then |
188 |
printf ' %3i:%2.2i %-40s %s %s\n' $t_pass $t_tot $i $kind $OPTFILE |
189 |
else |
190 |
printf ' %3i:%3.3i %-40s %s %s\n' $t_pass $t_tot $i $kind $OPTFILE |
191 |
fi |
192 |
fi |
193 |
|
194 |
done |
195 |
|
196 |
# helpful for debugging |
197 |
#cat ./mlist |
198 |
|
199 |
done |
200 |
|
201 |
#rm -f ./mlist |
202 |
rm -f ./dir_all |