source: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/SETTE/sette_rpt.sh

Last change on this file was 6487, checked in by davestorkey, 5 years ago

Changes from nemo_v3_6_STABLE_copy branch.
Custom merge into /branches/UKMO/dev_r5518_GO6_package/NEMOGCM: r6237 cf. r5781 of /branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM@6486

  • Property svn:executable set to *
File size: 10.2 KB
Line 
1#!/bin/bash -f
2#
3# simple SETTE report generator.
4#
5# This version should be run in the SETTE directory.
6# The machine name will be picked up from the sette.sh script but the location of the
7# validation directory needs to be set here (currently assumed to reside in the ../CONFIG directory)
8#
9#########################################################################################
10######################### Start of function definitions #################################
11##
12function resttest() { 
13#
14# Restartability checks. Expects LONG and SHORT run directories
15# Compares end of LONG stat files with equivalent entries from the SHORT stat files.
16#
17  vdir=$1
18  nam=$2
19  pass=$3
20  mach=$4
21#
22  if [ -d $vdir/$nam ]; then
23    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
24    dorv=`echo $dorv | sed -e 's:.*/::'`
25    f1o=$vdir/$nam/$mach/$dorv/LONG/ocean.output
26    f1s=$vdir/$nam/$mach/$dorv/LONG/solver.stat
27    f1t=$vdir/$nam/$mach/$dorv/LONG/tracer.stat
28    f2o=$vdir/$nam/$mach/$dorv/SHORT/ocean.output
29    f2s=$vdir/$nam/$mach/$dorv/SHORT/solver.stat
30    f2t=$vdir/$nam/$mach/$dorv/SHORT/tracer.stat
31
32    if  [ ! -f $f1s ] &&  [ ! -f $f1t ] ; then
33      printf "%-20s %s\n" $nam " incomplete test";
34      return;
35    fi
36    if  [ ! -f $f2s ] &&  [ ! -f $f2t ] ; then
37      printf "%-20s %s\n" $nam " incomplete test";
38      return;
39    fi
40#
41    done_oce=0
42
43    if  [  -f $f1s ] && [  -f $f2s ]; then
44      nl=(`wc -l $f2s`)
45      tail -${nl[0]} $f1s > f1.tmp$$
46      cmp -s f1.tmp$$ $f2s
47      if [ $? == 0 ]; then
48        if [ $pass == 0 ]; then
49          printf "%-20s %s %s\n" $nam  " solver.stat restartability  passed : " $dorv
50        fi
51      else
52        printf "%-20s %s %s\n" $nam  " solver.stat restartability  FAILED : " $dorv 
53#
54# Offer view of differences on the second pass
55#
56        if [ $pass == 1 ]; then
57          echo "<return> to view solver.stat differences"
58          read y
59          sdiff f1.tmp$$ $f2s
60          echo "<return> to view ocean.output differences"
61          read y
62          sdiff $f1o $f2o | grep "|"
63          done_oce=1
64          echo "<return> to continue"
65          read y
66        fi
67      fi
68    fi
69#
70# Check tracer.stat files (if they exist)
71#
72    if  [  -f $f1t ] && [  -f $f2t ]; then
73      nl=(`wc -l $f2t`)
74      tail -${nl[0]} $f1t > f1.tmp$$
75      cmp -s f1.tmp$$ $f2t
76      if [ $? == 0 ]; then
77        if [ $pass == 0 ]; then
78          printf "%-20s %s %s\n" $nam  " tracer.stat restartability  passed : " $dorv
79        fi
80      else
81        printf "%-20s %s %s\n" $nam  " tracer.stat restartability  FAILED : " $dorv 
82#
83# Offer view of differences on the second pass
84#
85        if [ $pass == 1 ]; then
86          echo "<return> to view tracer.stat differences"
87          read y
88          sdiff f1.tmp$$ $f2t
89#
90# Only offer ocean.output view if it has not been viewed previously
91#
92          if [ $done_oce == 0 ]; then
93            echo "<return> to view ocean.output differences"
94            read y
95            sdiff $f1o $f2o | grep "|"
96          fi
97          echo "<return> to continue"
98          read y
99        fi
100      fi
101    fi
102    rm f1.tmp$$
103  fi
104}
105
106function reprotest(){
107#
108# Reproducibility checks. Expects REPRO_N_M and REPRO_I_J run directories
109# Compares end of stat files from each
110#
111  vdir=$1
112  nam=$2
113  pass=$3
114  mach=$4
115#
116  if [ -d $vdir/$nam ]; then
117    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
118    dorv=`echo $dorv | sed -e 's:.*/::'`
119    rep1=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -2l | head -1 `
120    rep2=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -1l`
121    f1o=$vdir/$nam/$mach/$dorv/$rep1/ocean.output
122    f1s=$vdir/$nam/$mach/$dorv/$rep1/solver.stat
123    f1t=$vdir/$nam/$mach/$dorv/$rep1/tracer.stat
124    f2o=$vdir/$nam/$mach/$dorv/$rep2/ocean.output
125    f2s=$vdir/$nam/$mach/$dorv/$rep2/solver.stat
126    f2t=$vdir/$nam/$mach/$dorv/$rep2/tracer.stat
127
128    if  [ ! -f $f1s ] && [ ! -f $f1t ] ; then
129      printf "%-20s %s\n" $nam " incomplete test";
130      return;
131    fi
132    if  [ ! -f $f2s ] && [ ! -f $f2t ] ; then
133      printf "%-20s %s\n" $nam " incomplete test";
134      return;
135    fi
136#
137    done_oce=0
138
139    if  [ -f $f1s ] && [ -f $f2s ] ; then
140      cmp -s $f1s $f2s
141      if [ $? == 0 ]; then
142        if [ $pass == 0 ]; then
143          printf "%-20s %s %s\n" $nam  " solver.stat reproducibility passed : " $dorv
144        fi
145      else
146        printf "%-20s %s %s\n" $nam  " solver.stat reproducibility FAILED : " $dorv 
147#
148# Offer view of differences on the second pass
149#
150        if [ $pass == 1 ]; then
151          echo "<return> to view solver.stat differences"
152          read y
153          sdiff f1.tmp$$ $f2s
154          echo "<return> to view ocean.output differences"
155          read y
156          sdiff $f1o $f2o | grep "|"
157          done_oce=1
158          echo "<return> to continue"
159          read y
160        fi
161      fi
162    fi
163#
164# Check tracer.stat files (if they exist)
165#
166    if  [ -f $f1t ] && [ -f $f2t ] ; then
167      cmp -s $f1t $f2t
168      if [ $? == 0 ]; then
169        if [ $pass == 0 ]; then           printf "%-20s %s %s\n" $nam  " tracer.stat reproducibility passed : " $dorv
170        fi
171      else
172        printf "%-20s %s %s\n" $nam  " tracer.stat reproducibility  FAILED : " $dorv
173#
174# Offer view of differences on the second pass
175#
176        if [ $pass == 1 ]; then
177          echo "<return> to view tracer.stat differences"
178          read y
179          sdiff $f1t $f2t
180#
181# Only offer ocean.output view if it has not been viewed previously
182#
183          if [ $done_oce == 0 ]; then
184            echo "<return> to view ocean.output differences"
185            read y
186            sdiff $f1o $f2o | grep "|"
187          fi
188          echo "<return> to continue"
189          read y
190        fi
191      fi
192    fi
193  fi
194}
195
196function xiostest() { 
197#
198# XIOS functionality checks. Expects ATTACHED_MULTIPLE, ATTACHED_ONE, DETACHED_MULTIPLE and
199# DETACHED_ONE run directories.
200# Compares stat files from ATTACHED_MULTIPLE with equivalent entries from the others
201#
202  vdir=$1
203  nam=$2
204  pass=$3
205  mach=$4
206#
207  if [ -d $vdir/$nam ]; then
208    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
209    dorv=`echo $dorv | sed -e 's:.*/::'`
210    f1o=$vdir/$nam/$mach/$dorv/ATTACHED_MULTIPLE/ocean.output
211    f1s=$vdir/$nam/$mach/$dorv/ATTACHED_MULTIPLE/solver.stat
212    f1t=$vdir/$nam/$mach/$dorv/ATTACHED_MULTIPLE/tracer.stat
213    if [ $pass == 0 ]; then printf "%-20s %s %s\n" $nam " checking against " "ATTACHED_MULTIPLE" ; fi
214    for OTHER in ATTACHED_ONE DETACHED_MULTIPLE DETACHED_ONE
215    do
216      f2o=$vdir/$nam/$mach/$dorv/$OTHER/ocean.output
217      f2s=$vdir/$nam/$mach/$dorv/$OTHER/solver.stat
218      f2t=$vdir/$nam/$mach/$dorv/$OTHER/tracer.stat
219
220      if  [ ! -f $f1s ] &&  [ ! -f $f1t ] ; then
221        printf "%-20s %s %s\n" $nam " incomplete test " $OTHER;
222        return;
223      fi
224      if  [ ! -f $f2s ] &&  [ ! -f $f2t ] ; then
225        printf "%-20s %s %s\n" $nam " incomplete test " $OTHER;
226        return;
227      fi
228#
229      done_oce=0
230
231      if  [  -f $f1s ] && [  -f $f2s ]; then
232        nl=(`wc -l $f2s`)
233        tail -${nl[0]} $f1s > f1.tmp$$
234        cmp -s f1.tmp$$ $f2s
235        if [ $? == 0 ]; then
236          if [ $pass == 0 ]; then
237            printf "%-20s %s %s %s\n" $nam  " solver.stat restartability  passed : " $dorv $OTHER
238          fi
239        else
240          printf "%-20s %s %s %s\n" $nam  " solver.stat restartability  FAILED : " $dorv  $OTHER
241#
242# Offer view of differences on the second pass
243#
244          if [ $pass == 1 ]; then
245            echo "<return> to view solver.stat differences"
246            read y
247            sdiff f1.tmp$$ $f2s
248            echo "<return> to view ocean.output differences"
249            read y
250            sdiff $f1o $f2o | grep "|"
251            done_oce=1
252            echo "<return> to continue"
253            read y
254          fi
255        fi
256      fi
257#
258# Check tracer.stat files (if they exist)
259#
260      if  [  -f $f1t ] && [  -f $f2t ]; then
261        nl=(`wc -l $f2t`)
262        tail -${nl[0]} $f1t > f1.tmp$$
263        cmp -s f1.tmp$$ $f2t
264        if [ $? == 0 ]; then
265          if [ $pass == 0 ]; then
266            printf "%-20s %s %s %s\n" $nam  " tracer.stat restartability  passed : " $dorv $OTHER
267          fi
268        else
269          printf "%-20s %s %s %s\n" $nam  " tracer.stat restartability  FAILED : " $dorv  $OTHER
270#
271# Offer view of differences on the second pass
272#
273          if [ $pass == 1 ]; then
274            echo "<return> to view tracer.stat differences"
275            read y
276            sdiff f1.tmp$$ $f2t
277#
278# Only offer ocean.output view if it has not been viewed previously
279#
280            if [ $done_oce == 0 ]; then
281              echo "<return> to view ocean.output differences"
282              read y
283              sdiff $f1o $f2o | grep "|"
284            fi
285            echo "<return> to continue"
286            read y
287          fi
288        fi
289      fi
290      rm f1.tmp$$
291    done
292  fi
293}
294
295########################### END of function definitions #################################
296##                                                                                     ##
297##    Main script                                                                      ##
298##                                                                                     ##
299#########################################################################################
300#
301  mach1=`grep "COMPILER=" ./sette.sh | sed -e 's/COMPILER=//'`
302  mach2=`grep "COMPILER=" ./sette_xios.sh | sed -e 's/COMPILER=//'`
303  NEMO_VALID=`grep "NEMO_VALIDATION_DIR=" ./param.cfg | sed -e 's/NEMO_VALIDATION_DIR=//'`
304#
305  if [ ! -d $NEMO_VALID ]; then
306    echo "$NEMO_VALID validation directory not found"
307    exit
308  fi
309#
310# The script also needs the date or revision tag. Currently this is taken from the latest sub-directory found in each directory
311
312for pass in  0 1
313do
314#
315 if [ $pass == 1 ]; then echo "---------------2nd pass------------------";fi
316#
317# Restartability test
318#
319 for restart_test in WGYRE_LONG WISOMIP_LONG WORCA2LIMPIS_LONG WORCA2OFFPIS_LONG WAMM12_LONG WORCA2LIM3_LONG WSAS_LONG WORCA2AGUL_LONG
320 do
321   resttest $NEMO_VALID $restart_test $pass $mach1
322 done
323#
324# sette_xios tests (allow for the possibility of a different compiler base)
325#
326 for xios_test in WGYRE_XIOS_LR WGYRE_XIOS_HR
327 do
328   xiostest $NEMO_VALID $xios_test $pass $mach2
329 done
330#
331# Reproducibility tests
332#
333 for repro_test in WGYRE_4 WISOMIP_4 WORCA2LIMPIS_16 WORCA2OFFPIS_16 WAMM12_32 WORCA2LIM3_16 WORCA2_LIM_OBS WSAS_32 WORCA2AGUL_1_2 WORCA2AGUL_16 WORCA2AGUL_2_2_NAG
334 do
335   reprotest $NEMO_VALID $repro_test $pass $mach1
336 done
337#
338done
339exit
Note: See TracBrowser for help on using the repository browser.