[6124] | 1 | #!/bin/bash -f |
---|
[9019] | 2 | # set -vx |
---|
[6124] | 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 |
---|
[9602] | 7 | # validation directory needs to be set here (currently assumed to reside in the ../cfgs directory) |
---|
[6124] | 8 | # |
---|
| 9 | ######################################################################################### |
---|
| 10 | ######################### Start of function definitions ################################# |
---|
| 11 | ## |
---|
[8468] | 12 | |
---|
[11161] | 13 | function get_dorv() { |
---|
| 14 | if [ $lastchange == 'old' ] ; then |
---|
[14981] | 15 | dorv=`ls -1rt $vdir/$mach/ | tail -1l ` |
---|
[8468] | 16 | dorv=`echo $dorv | sed -e 's:.*/::'` |
---|
[14981] | 17 | dorv2=`ls -1rt $vdir/$mach/ 2>/dev/null | tail -1l ` |
---|
[11497] | 18 | dorv2=`echo $dorv2 | sed -e 's:.*/::'` |
---|
[9019] | 19 | else |
---|
[11161] | 20 | dorv=$lastchange |
---|
[11497] | 21 | dorv2=$lastchange |
---|
[9019] | 22 | fi |
---|
[8468] | 23 | } |
---|
| 24 | |
---|
[11161] | 25 | function get_ktdiff() { |
---|
| 26 | ktdiff=`diff ${1} ${2} | head -2 | grep it | awk '{ print $4 }'` |
---|
| 27 | } |
---|
| 28 | |
---|
[14825] | 29 | function get_ktdiff2() { |
---|
| 30 | ktdiff=`diff ${1} ${2} | head -2 | tail -1l | awk '{print $2}'` |
---|
| 31 | } |
---|
| 32 | |
---|
[6124] | 33 | function resttest() { |
---|
| 34 | # |
---|
| 35 | # Restartability checks. Expects LONG and SHORT run directories |
---|
| 36 | # Compares end of LONG stat files with equivalent entries from the SHORT stat files. |
---|
| 37 | # |
---|
| 38 | vdir=$1 |
---|
| 39 | nam=$2 |
---|
| 40 | pass=$3 |
---|
| 41 | # |
---|
[11161] | 42 | # get $dorv |
---|
| 43 | get_dorv |
---|
| 44 | # |
---|
| 45 | # check if directory is here |
---|
[14981] | 46 | if [ ! -d $vdir/$mach/$dorv/$nam ]; then |
---|
[11161] | 47 | printf "%-27s %s %s\n" $nam " directory MISSING : " $dorv |
---|
| 48 | return |
---|
| 49 | fi |
---|
| 50 | |
---|
[14981] | 51 | if [ -d $vdir/$mach/$dorv/$nam ]; then |
---|
[11161] | 52 | # check ocean output |
---|
| 53 | runtest $vdir $nam $pass RST |
---|
| 54 | # |
---|
| 55 | # run restartibility test |
---|
[14981] | 56 | f1o=$vdir/$mach/$dorv/$nam/LONG/ocean.output |
---|
| 57 | f1s=$vdir/$mach/$dorv/$nam/LONG/run.stat |
---|
| 58 | f1t=$vdir/$mach/$dorv/$nam/LONG/tracer.stat |
---|
| 59 | f2o=$vdir/$mach/$dorv/$nam/SHORT/ocean.output |
---|
| 60 | f2s=$vdir/$mach/$dorv/$nam/SHORT/run.stat |
---|
| 61 | f2t=$vdir/$mach/$dorv/$nam/SHORT/tracer.stat |
---|
[6124] | 62 | |
---|
[6152] | 63 | if [ ! -f $f1s ] && [ ! -f $f1t ] ; then |
---|
[9525] | 64 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 65 | return; |
---|
| 66 | fi |
---|
[6152] | 67 | if [ ! -f $f2s ] && [ ! -f $f2t ] ; then |
---|
[9525] | 68 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 69 | return; |
---|
| 70 | fi |
---|
| 71 | # |
---|
| 72 | done_oce=0 |
---|
| 73 | |
---|
[6152] | 74 | if [ -f $f1s ] && [ -f $f2s ]; then |
---|
| 75 | nl=(`wc -l $f2s`) |
---|
| 76 | tail -${nl[0]} $f1s > f1.tmp$$ |
---|
| 77 | cmp -s f1.tmp$$ $f2s |
---|
| 78 | if [ $? == 0 ]; then |
---|
| 79 | if [ $pass == 0 ]; then |
---|
[9525] | 80 | printf "%-27s %s %s\n" $nam " run.stat restartability passed : " $dorv |
---|
[6152] | 81 | fi |
---|
| 82 | else |
---|
[11161] | 83 | get_ktdiff f1.tmp$$ $f2s |
---|
| 84 | printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam " run.stat restartability FAILED : " $dorv " (results are different after " $ktdiff " time steps)" |
---|
[6124] | 85 | # |
---|
| 86 | # Offer view of differences on the second pass |
---|
| 87 | # |
---|
[6152] | 88 | if [ $pass == 1 ]; then |
---|
[9019] | 89 | echo "<return> to view run.stat differences" |
---|
[6152] | 90 | read y |
---|
| 91 | sdiff f1.tmp$$ $f2s |
---|
| 92 | echo "<return> to view ocean.output differences" |
---|
| 93 | read y |
---|
| 94 | sdiff $f1o $f2o | grep "|" |
---|
| 95 | done_oce=1 |
---|
| 96 | echo "<return> to continue" |
---|
| 97 | read y |
---|
| 98 | fi |
---|
[6124] | 99 | fi |
---|
| 100 | fi |
---|
| 101 | # |
---|
| 102 | # Check tracer.stat files (if they exist) |
---|
| 103 | # |
---|
[6152] | 104 | if [ -f $f1t ] && [ -f $f2t ]; then |
---|
[6124] | 105 | nl=(`wc -l $f2t`) |
---|
| 106 | tail -${nl[0]} $f1t > f1.tmp$$ |
---|
| 107 | cmp -s f1.tmp$$ $f2t |
---|
| 108 | if [ $? == 0 ]; then |
---|
[6152] | 109 | if [ $pass == 0 ]; then |
---|
[9525] | 110 | printf "%-27s %s %s\n" $nam " tracer.stat restartability passed : " $dorv |
---|
[6152] | 111 | fi |
---|
[6124] | 112 | else |
---|
[14825] | 113 | get_ktdiff2 f1.tmp$$ $f2t |
---|
[11161] | 114 | printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam " tracer.stat restartability FAILED : " $dorv " (results are different after " $ktdiff " time steps)" |
---|
[6124] | 115 | # |
---|
| 116 | # Offer view of differences on the second pass |
---|
| 117 | # |
---|
| 118 | if [ $pass == 1 ]; then |
---|
| 119 | echo "<return> to view tracer.stat differences" |
---|
| 120 | read y |
---|
| 121 | sdiff f1.tmp$$ $f2t |
---|
| 122 | # |
---|
| 123 | # Only offer ocean.output view if it has not been viewed previously |
---|
| 124 | # |
---|
| 125 | if [ $done_oce == 0 ]; then |
---|
| 126 | echo "<return> to view ocean.output differences" |
---|
| 127 | read y |
---|
| 128 | sdiff $f1o $f2o | grep "|" |
---|
| 129 | fi |
---|
| 130 | echo "<return> to continue" |
---|
| 131 | read y |
---|
| 132 | fi |
---|
| 133 | fi |
---|
| 134 | fi |
---|
| 135 | rm f1.tmp$$ |
---|
| 136 | fi |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | function reprotest(){ |
---|
| 140 | # |
---|
| 141 | # Reproducibility checks. Expects REPRO_N_M and REPRO_I_J run directories |
---|
| 142 | # Compares end of stat files from each |
---|
| 143 | # |
---|
| 144 | vdir=$1 |
---|
| 145 | nam=$2 |
---|
| 146 | pass=$3 |
---|
| 147 | # |
---|
[11161] | 148 | # get $dorv |
---|
| 149 | get_dorv |
---|
| 150 | # |
---|
| 151 | # check if directory is here |
---|
[14981] | 152 | if [ ! -d $vdir/$mach/$dorv/$nam ]; then |
---|
[11161] | 153 | printf "%-27s %s %s\n" $nam " directory MISSING : " $dorv |
---|
| 154 | return |
---|
| 155 | fi |
---|
| 156 | # |
---|
[14981] | 157 | if [ -d $vdir/$mach/$dorv/$nam ]; then |
---|
[11161] | 158 | # check ocean output |
---|
| 159 | runtest $vdir $nam $pass REPRO |
---|
| 160 | # |
---|
| 161 | # check reproducibility |
---|
[14981] | 162 | rep1=`ls -1rt $vdir/$mach/$dorv/$nam/ | grep REPRO | tail -2l | head -1 ` |
---|
| 163 | rep2=`ls -1rt $vdir/$mach/$dorv/$nam/ | grep REPRO | tail -1l` |
---|
[13785] | 164 | if [ $rep1 == $rep2 ]; then |
---|
| 165 | rep2='' |
---|
| 166 | fi |
---|
[14981] | 167 | f1o=$vdir/$mach/$dorv/$nam/$rep1/ocean.output |
---|
| 168 | f1s=$vdir/$mach/$dorv/$nam/$rep1/run.stat |
---|
| 169 | f1t=$vdir/$mach/$dorv/$nam/$rep1/tracer.stat |
---|
| 170 | f2o=$vdir/$mach/$dorv/$nam/$rep2/ocean.output |
---|
| 171 | f2s=$vdir/$mach/$dorv/$nam/$rep2/run.stat |
---|
| 172 | f2t=$vdir/$mach/$dorv/$nam/$rep2/tracer.stat |
---|
[6124] | 173 | |
---|
[6152] | 174 | if [ ! -f $f1s ] && [ ! -f $f1t ] ; then |
---|
[9525] | 175 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 176 | return; |
---|
| 177 | fi |
---|
[6152] | 178 | if [ ! -f $f2s ] && [ ! -f $f2t ] ; then |
---|
[9525] | 179 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 180 | return; |
---|
| 181 | fi |
---|
| 182 | # |
---|
| 183 | done_oce=0 |
---|
| 184 | |
---|
[6152] | 185 | if [ -f $f1s ] && [ -f $f2s ] ; then |
---|
| 186 | cmp -s $f1s $f2s |
---|
| 187 | if [ $? == 0 ]; then |
---|
| 188 | if [ $pass == 0 ]; then |
---|
[9525] | 189 | printf "%-27s %s %s\n" $nam " run.stat reproducibility passed : " $dorv |
---|
[6152] | 190 | fi |
---|
| 191 | else |
---|
[11161] | 192 | get_ktdiff $f1s $f2s |
---|
| 193 | printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam " run.stat reproducibility FAILED : " $dorv " (results are different after " $ktdiff " time steps)" |
---|
[6124] | 194 | # |
---|
| 195 | # Offer view of differences on the second pass |
---|
| 196 | # |
---|
[6152] | 197 | if [ $pass == 1 ]; then |
---|
[9019] | 198 | echo "<return> to view run.stat differences" |
---|
[6152] | 199 | read y |
---|
[9911] | 200 | sdiff $f1s $f2s |
---|
[6152] | 201 | echo "<return> to view ocean.output differences" |
---|
| 202 | read y |
---|
| 203 | sdiff $f1o $f2o | grep "|" |
---|
| 204 | done_oce=1 |
---|
| 205 | echo "<return> to continue" |
---|
| 206 | read y |
---|
| 207 | fi |
---|
[6124] | 208 | fi |
---|
| 209 | fi |
---|
| 210 | # |
---|
| 211 | # Check tracer.stat files (if they exist) |
---|
| 212 | # |
---|
[6152] | 213 | if [ -f $f1t ] && [ -f $f2t ] ; then |
---|
[6124] | 214 | cmp -s $f1t $f2t |
---|
| 215 | if [ $? == 0 ]; then |
---|
[9525] | 216 | if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam " tracer.stat reproducibility passed : " $dorv |
---|
[6152] | 217 | fi |
---|
[6124] | 218 | else |
---|
[14825] | 219 | get_ktdiff2 $f1t $f2t |
---|
[12569] | 220 | printf "\e[38;5;196m%-27s %s %s %s %-5s %s\e[0m\n" $nam " tracer.stat reproducibility FAILED : " $dorv " (results are different after " $ktdiff " time steps)" |
---|
[6124] | 221 | # |
---|
| 222 | # Offer view of differences on the second pass |
---|
| 223 | # |
---|
| 224 | if [ $pass == 1 ]; then |
---|
| 225 | echo "<return> to view tracer.stat differences" |
---|
| 226 | read y |
---|
| 227 | sdiff $f1t $f2t |
---|
| 228 | # |
---|
| 229 | # Only offer ocean.output view if it has not been viewed previously |
---|
| 230 | # |
---|
| 231 | if [ $done_oce == 0 ]; then |
---|
| 232 | echo "<return> to view ocean.output differences" |
---|
| 233 | read y |
---|
| 234 | sdiff $f1o $f2o | grep "|" |
---|
| 235 | fi |
---|
| 236 | echo "<return> to continue" |
---|
| 237 | read y |
---|
| 238 | fi |
---|
| 239 | fi |
---|
| 240 | fi |
---|
[9223] | 241 | fi |
---|
| 242 | } |
---|
[11161] | 243 | function runcmpres(){ |
---|
[9223] | 244 | # |
---|
[11161] | 245 | # compare *.stat file with reference file from a previous sette test or previous version |
---|
| 246 | # store in NEMO_VALID_REF at revision NEMO_REV_REF |
---|
| 247 | # Compares end of stat files from each |
---|
[9223] | 248 | # |
---|
| 249 | vdir=$1 |
---|
| 250 | nam=$2 |
---|
[11161] | 251 | vdirref=$3 |
---|
| 252 | dorvref=$4 |
---|
| 253 | pass=$5 |
---|
[9223] | 254 | # |
---|
[11161] | 255 | # get $dorv |
---|
| 256 | get_dorv |
---|
| 257 | # |
---|
| 258 | # check if reference directory is present |
---|
[14981] | 259 | if [ ! -d $vdirref/$mach/$dorvref/$nam ]; then |
---|
[11161] | 260 | printf "%-27s %s\n" $nam " REFERENCE directory at $dorvref is MISSING" |
---|
| 261 | return |
---|
| 262 | fi |
---|
[14981] | 263 | if [ ! -d $vdir/$mach/$dorv/$nam ]; then |
---|
[11161] | 264 | printf "%-27s %s\n" $nam " VALID directory at $dorv is MISSING" |
---|
| 265 | return |
---|
| 266 | fi |
---|
| 267 | |
---|
| 268 | # |
---|
[14981] | 269 | if [ -d $vdir/$mach/$dorv/$nam ]; then |
---|
| 270 | f1s=$vdir/$mach/$dorv/$nam/LONG/run.stat |
---|
| 271 | f1t=$vdir/$mach/$dorv/$nam/LONG/tracer.stat |
---|
| 272 | f2s=$vdirref/$mach/$dorvref/$nam/LONG/run.stat |
---|
| 273 | f2t=$vdirref/$mach/$dorvref/$nam/LONG/tracer.stat |
---|
[11161] | 274 | if [ ! -f $f1s ] && [ ! -f $f1t ] ; then |
---|
| 275 | printf "%-20s %s\n" $nam " incomplete test"; |
---|
| 276 | return; |
---|
[9911] | 277 | fi |
---|
[11161] | 278 | if [ ! -f $f2s ] && [ ! -f $f2t ] ; then |
---|
| 279 | printf "%-20s %s\n" $nam " incomplete test"; |
---|
[9223] | 280 | return; |
---|
[11161] | 281 | fi |
---|
| 282 | # |
---|
| 283 | done_oce=0 |
---|
| 284 | |
---|
| 285 | if [ -f $f1s ] && [ -f $f2s ] ; then |
---|
| 286 | cmp -s $f1s $f2s |
---|
| 287 | if [ $? == 0 ]; then |
---|
| 288 | if [ $pass == 0 ]; then |
---|
| 289 | printf "%-20s %s %s\n" $nam " run.stat files are identical " |
---|
| 290 | fi |
---|
| 291 | else |
---|
[12569] | 292 | get_ktdiff $f1s $f2s |
---|
| 293 | printf "%-20s %s %s %-5s %s\n" $nam " run.stat files are DIFFERENT (results are different after " $ktdiff " time steps)" |
---|
[11161] | 294 | # |
---|
| 295 | # Offer view of differences on the second pass |
---|
| 296 | # |
---|
[9223] | 297 | if [ $pass == 1 ]; then |
---|
[11161] | 298 | echo "<return> to view run.stat differences" |
---|
[9223] | 299 | read y |
---|
[11161] | 300 | sdiff $f1s $f2s |
---|
| 301 | done_oce=1 |
---|
| 302 | echo "<return> to continue" |
---|
| 303 | read y |
---|
[9223] | 304 | fi |
---|
| 305 | fi |
---|
| 306 | fi |
---|
[11161] | 307 | # Check tracer.stat files (if they exist) |
---|
| 308 | # |
---|
| 309 | if [ -f $f1t ] && [ -f $f2t ] ; then |
---|
| 310 | cmp -s $f1t $f2t |
---|
| 311 | if [ $? == 0 ]; then |
---|
| 312 | if [ $pass == 0 ]; then |
---|
| 313 | printf "%-20s %s %s\n" $nam " tracer.stat files are identical " |
---|
| 314 | fi |
---|
| 315 | else |
---|
[14825] | 316 | get_ktdiff2 $f1t $f2t |
---|
[12569] | 317 | printf "%-20s %s %s %-5s %s\n" $nam " tracer.stat files are DIFFERENT (results are different after " $ktdiff " time steps) " |
---|
[11161] | 318 | # |
---|
| 319 | # Offer view of differences on the second pass |
---|
| 320 | # |
---|
| 321 | if [ $pass == 1 ]; then |
---|
| 322 | echo "<return> to view tracer.stat differences" |
---|
| 323 | read y |
---|
| 324 | sdiff $f1t $f2t |
---|
| 325 | fi |
---|
| 326 | fi |
---|
| 327 | fi |
---|
[14844] | 328 | fi |
---|
| 329 | } |
---|
| 330 | |
---|
| 331 | function runcmptim(){ |
---|
[14825] | 332 | # |
---|
[14844] | 333 | # compare timing.output file with reference file from a previous sette test or previous version |
---|
| 334 | # |
---|
| 335 | vdir=$1 |
---|
| 336 | nam=$2 |
---|
| 337 | vdirref=$3 |
---|
| 338 | dorvref=$4 |
---|
| 339 | pass=$5 |
---|
| 340 | # |
---|
| 341 | # get $dorv |
---|
| 342 | get_dorv |
---|
| 343 | # |
---|
| 344 | # check if reference directory is present |
---|
[14981] | 345 | if [ ! -d $vdirref/$mach/$dorvref/$nam ]; then |
---|
[14844] | 346 | return |
---|
| 347 | fi |
---|
[14981] | 348 | if [ ! -d $vdir/$mach/$dorv/$nam ]; then |
---|
[14844] | 349 | return |
---|
| 350 | fi |
---|
| 351 | |
---|
| 352 | # |
---|
[14981] | 353 | if [ -d $vdir/$mach/$dorv/$nam ]; then |
---|
| 354 | f1a=$vdir/$mach/$dorv/$nam/LONG/timing.output |
---|
| 355 | f2a=$vdirref/$mach/$dorvref/$nam/LONG/timing.output |
---|
[14844] | 356 | # |
---|
[14825] | 357 | # Report average CPU time differences (if available) |
---|
| 358 | # |
---|
| 359 | if [ -f $f1a ] && [ -f $f2a ] ; then |
---|
| 360 | tnew=$(grep 'Average ' $f1a | awk '{print $5}') |
---|
| 361 | tref=$(grep 'Average ' $f2a | awk '{print $5}') |
---|
| 362 | if [ $? == 0 ]; then |
---|
| 363 | if [ $pass == 0 ]; then |
---|
| 364 | tdif=$( echo ${tnew} ${tref} | awk '{print $1 - $2}') |
---|
| 365 | if (( $(echo "$tnew > $tref" |bc -l) )); then |
---|
| 366 | printf "%-20s %14s %10s %14s %10s %14s \\e[41;33;196m%10s\\e[0m\n" $nam " ref. time:" $tref "cur. time:" $tnew "diff.:" $tdif |
---|
| 367 | else |
---|
| 368 | printf "%-20s %14s %10s %14s %10s %14s \\e[42;01;196m%10s\\e[0m\n" $nam " ref. time:" $tref "cur. time:" $tnew "diff.:" $tdif |
---|
| 369 | fi |
---|
| 370 | fi |
---|
| 371 | fi |
---|
| 372 | fi |
---|
[11161] | 373 | fi |
---|
| 374 | } |
---|
| 375 | |
---|
| 376 | function runtest(){ |
---|
| 377 | # |
---|
| 378 | # Run checks. |
---|
| 379 | # Check presence of E R R O R in ocean.output from each |
---|
| 380 | # |
---|
| 381 | vdir=$1 |
---|
| 382 | nam=$2 |
---|
| 383 | pass=$3 |
---|
| 384 | ttype=$4 |
---|
| 385 | [[ $ttype == 'RST' ]] && ttype="LONG|SHORT" |
---|
| 386 | # |
---|
| 387 | # get $dorv |
---|
| 388 | get_dorv |
---|
| 389 | # |
---|
| 390 | # no print needed if the repository is not here (already catch before) |
---|
| 391 | # |
---|
[14981] | 392 | if [ -d $vdir/$mach/$dorv/$nam/ ]; then |
---|
[11161] | 393 | # |
---|
| 394 | # apply check for all ttype directory |
---|
[14981] | 395 | rep1=$(ls -rt $vdir/$mach/$dorv/$nam/ | grep -E $ttype) |
---|
[11161] | 396 | for tdir in $rep1 ; do |
---|
[14981] | 397 | f1o=$vdir/$mach/$dorv/$nam/$tdir/ocean.output |
---|
[11161] | 398 | if [ ! -f $f1o ] ; then |
---|
| 399 | if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam " ocean.output MISSING : " $dorv ; fi |
---|
| 400 | return; |
---|
| 401 | else |
---|
| 402 | nerr=`grep 'E R R O R' $f1o | wc -l` |
---|
| 403 | if [[ $nerr > 0 ]]; then |
---|
| 404 | printf "\e[38;5;196m%-27s %s %s %s\e[0m\n" $nam " run FAILED : " $dorv " ( E R R O R in ocean.output) " |
---|
| 405 | if [ $pass == 1 ]; then |
---|
| 406 | echo "<return> to view end of ocean.output" |
---|
| 407 | read y |
---|
| 408 | tail -100 $f1o |
---|
| 409 | echo '' |
---|
| 410 | echo "full ocean.output available here: $f1o" |
---|
| 411 | fi |
---|
| 412 | return; |
---|
| 413 | fi |
---|
| 414 | fi |
---|
| 415 | done |
---|
[9221] | 416 | else |
---|
[11161] | 417 | if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam " directory MISSING : " $dorv ; fi |
---|
[6124] | 418 | fi |
---|
| 419 | } |
---|
[9019] | 420 | |
---|
| 421 | function identictest(){ |
---|
| 422 | # |
---|
[11497] | 423 | # Checks AGRIF does not corrupt results with no AGRIF zoom by comparing run.stat files |
---|
[9019] | 424 | # |
---|
| 425 | vdir=$1 |
---|
[11497] | 426 | nam=$2 |
---|
| 427 | nam2=$3 |
---|
[9019] | 428 | pass=$4 |
---|
| 429 | # |
---|
[11497] | 430 | get_dorv |
---|
[9019] | 431 | # |
---|
[14981] | 432 | rep=`ls -1rt $vdir/$mach/$dorv/$nam/ | tail -1l` |
---|
| 433 | f1s=${vdir}/${mach}/${dorv}/${nam}/${rep}/run.stat |
---|
| 434 | f2s=${vdir}/${mach}/${dorv2}/${nam2}/${rep}/run.stat |
---|
[11497] | 435 | # |
---|
| 436 | if [ -f $f1s ] && [ -f $f2s ] ; then |
---|
[9019] | 437 | cmp -s $f1s $f2s |
---|
| 438 | if [ $? == 0 ]; then |
---|
[11497] | 439 | if [ $pass == 0 ]; then |
---|
| 440 | printf "%-5s %s %-5s %s %s %s\n" $rep "AGRIF vs" $rep "NOAGRIF run.stat unchanged - passed : " $dorv $dorv2 |
---|
| 441 | fi |
---|
[9019] | 442 | else |
---|
[11497] | 443 | get_ktdiff $f1s $f2s |
---|
| 444 | printf "\e[38;5;196m%-5s %s %-5s %s %s %s %s %-5s %s\e[0m\n" $rep "AGRIF vs" $rep "NOAGRIF run.stat changed - FAILED : " $dorv $dorv2 " (results are different after " $ktdiff " time steps)" |
---|
[9019] | 445 | # |
---|
| 446 | # Offer view of differences on the second pass |
---|
| 447 | # |
---|
[11497] | 448 | if [ $pass == 1 ]; then |
---|
| 449 | echo "<return> to view run.stat differences" |
---|
| 450 | read y |
---|
| 451 | sdiff $f1s $f2s |
---|
| 452 | echo "<return> to continue" |
---|
| 453 | read y |
---|
| 454 | fi |
---|
[9019] | 455 | fi |
---|
| 456 | else |
---|
[11497] | 457 | printf "%-27s %-27s %s\n" $nam $nam2 " incomplete test" |
---|
[9019] | 458 | fi |
---|
| 459 | } |
---|
[6124] | 460 | ########################### END of function definitions ################################# |
---|
| 461 | ## ## |
---|
| 462 | ## Main script ## |
---|
| 463 | ## ## |
---|
| 464 | ######################################################################################### |
---|
| 465 | # |
---|
[11161] | 466 | # LOAD param variable (COMPILER, NEMO_VALIDATION_DIR, SVN_CMD) |
---|
| 467 | SETTE_DIR=$(cd $(dirname "$0"); pwd) |
---|
| 468 | MAIN_DIR=$(dirname $SETTE_DIR) |
---|
| 469 | . ./param.cfg |
---|
| 470 | |
---|
| 471 | mach=${COMPILER} |
---|
[14981] | 472 | # overwrite revision (later) or compiler |
---|
| 473 | if [ $# -gt 0 ]; then |
---|
| 474 | while getopts r:R:c:v:V:h option; do |
---|
| 475 | case $option in |
---|
| 476 | c) mach=$OPTARG;; |
---|
| 477 | r) rev=$OPTARG;; |
---|
| 478 | R) refrev=$OPTARG;; |
---|
| 479 | v) SETTE_SUB_VAL=$OPTARG;; |
---|
| 480 | V) SETTE_SUB_VAL2=$OPTARG |
---|
| 481 | if [ -d ${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2} ] ; then |
---|
| 482 | export NEMO_VALIDATION_REF=${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2} |
---|
| 483 | else |
---|
| 484 | echo "Requested comparison subdirectory: ${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2} does not exist" |
---|
| 485 | fi |
---|
| 486 | ;; |
---|
| 487 | h | *) echo '' |
---|
| 488 | echo 'sette_rpt.sh : ' |
---|
| 489 | echo ' display result for the latest change' |
---|
| 490 | echo ' -c COMPILER_name :' |
---|
| 491 | echo ' display result for the specified compiler' |
---|
| 492 | echo ' -r REVISION_number :' |
---|
| 493 | echo ' display sette results for the specified revision (set old for the latest revision available for each config)' |
---|
| 494 | echo ' -R REFERENCE REVISION_number :' |
---|
| 495 | echo ' compare sette results against the specified revision (use to over-ride value set in param.cfg)' |
---|
| 496 | echo ' -v sub_dir :' |
---|
| 497 | echo ' validation sub-directory below NEMO_VALIDATION_DIR' |
---|
| 498 | echo ' -V sub_dir2 :' |
---|
| 499 | echo ' 2nd validation sub-directory below NEMO_VALIDATION_DIR' |
---|
| 500 | echo ' if set the comparison is between two subdirectory trees beneath NEMO_VALIDATION_DIR' |
---|
| 501 | echo '' |
---|
| 502 | exit 42;; |
---|
| 503 | esac |
---|
| 504 | done |
---|
| 505 | shift $((OPTIND - 1)) |
---|
| 506 | fi |
---|
| 507 | # if $1 (remaining arguments) |
---|
| 508 | if [[ ! -z $1 ]] ; then rev=$1 ; fi |
---|
| 509 | |
---|
| 510 | if [ ! -z $SETTE_SUB_VAL ] ; then |
---|
| 511 | export NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL |
---|
| 512 | if [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] ; then |
---|
| 513 | while true; do |
---|
| 514 | read -p "$NEMO_VALIDATION_REF/$SETTE_SUB_VAL exists. Do you wish to use it as a reference? " yn |
---|
| 515 | case $yn in |
---|
| 516 | [Yy]* ) export $NEMO_VALIDATION_REF/$SETTE_SUB_VAL; break;; |
---|
| 517 | [Nn]* ) echo "Ok, continuing with ${NEMO_VALIDATION_REF}/MAIN as the reference directory" |
---|
| 518 | export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/MAIN |
---|
| 519 | break |
---|
| 520 | ;; |
---|
| 521 | * ) echo "Please answer yes or no.";; |
---|
| 522 | esac |
---|
| 523 | done |
---|
| 524 | fi |
---|
| 525 | else |
---|
| 526 | export NEMO_VALIDATION_DIR=${NEMO_VALIDATION_DIR}/MAIN |
---|
| 527 | export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/MAIN |
---|
| 528 | fi |
---|
[11161] | 529 | NEMO_VALID=${NEMO_VALIDATION_DIR} |
---|
| 530 | NEMO_VALID_REF=${NEMO_VALIDATION_REF} |
---|
[14981] | 531 | if [ ! -z $refrev ] ; then |
---|
| 532 | NEMO_REV_REF=${refrev} |
---|
| 533 | fi |
---|
[6124] | 534 | # |
---|
| 535 | if [ ! -d $NEMO_VALID ]; then |
---|
| 536 | echo "$NEMO_VALID validation directory not found" |
---|
| 537 | exit |
---|
| 538 | fi |
---|
| 539 | # |
---|
[9019] | 540 | # |
---|
| 541 | # Show current revision tag and branch name |
---|
| 542 | # |
---|
[11161] | 543 | echo "" |
---|
[12569] | 544 | lastchange=`${SVN_CMD} info ${MAIN_DIR} | grep 'Last Changed Rev' | awk '{print $NF}'` |
---|
| 545 | revision=`${SVN_CMD} info ${MAIN_DIR} | grep 'Revision' | awk '{print $NF}'` |
---|
| 546 | branchname=`${SVN_CMD} info ${MAIN_DIR} | grep ^URL | awk -F ipsl/forge/projets/nemo/svn/ '{print $NF}'` |
---|
[11161] | 547 | echo "Current code is : $branchname @ r$revision ( last change @ r$lastchange )" |
---|
[13795] | 548 | [ `${SVN_CMD} status -q ${MAIN_DIR}/{cfgs,tests,src} | wc -l` -ge 1 ] && lastchange=${lastchange}+ |
---|
[11161] | 549 | |
---|
[12569] | 550 | # by default use the current lastchanged revision |
---|
| 551 | lastchange=${rev:-$lastchange} |
---|
| 552 | |
---|
[11161] | 553 | echo "" |
---|
| 554 | echo "SETTE validation report generated for : " |
---|
| 555 | echo "" |
---|
| 556 | echo " $branchname @ r$lastchange (last changed revision)" |
---|
| 557 | echo "" |
---|
| 558 | echo " on $COMPILER arch file" |
---|
| 559 | echo "" |
---|
| 560 | |
---|
[9019] | 561 | # |
---|
[6124] | 562 | # The script also needs the date or revision tag. Currently this is taken from the latest sub-directory found in each directory |
---|
| 563 | # |
---|
[12569] | 564 | for pass in $RPT_PASSES |
---|
[6124] | 565 | do |
---|
| 566 | # |
---|
[9525] | 567 | if [ $pass == 0 ]; then |
---|
| 568 | echo "" |
---|
| 569 | echo "!!---------------1st pass------------------!!" |
---|
| 570 | fi |
---|
| 571 | if [ $pass == 1 ]; then |
---|
| 572 | echo "" |
---|
| 573 | echo "!!---------------2nd pass------------------!!" |
---|
| 574 | fi |
---|
[6124] | 575 | # |
---|
[8468] | 576 | |
---|
[6124] | 577 | # Restartability test |
---|
[9525] | 578 | echo "" |
---|
[9518] | 579 | echo " !----restart----! " |
---|
[14981] | 580 | for restart_test in GYRE_PISCES ORCA2_ICE_PISCES ORCA2_OFF_PISCES AMM12 ORCA2_SAS_ICE AGRIF_DEMO WED025 ISOMIP+ OVERFLOW LOCK_EXCHANGE VORTEX ICE_AGRIF SWG |
---|
[6124] | 581 | do |
---|
| 582 | resttest $NEMO_VALID $restart_test $pass |
---|
| 583 | done |
---|
| 584 | # |
---|
| 585 | # Reproducibility tests |
---|
[9525] | 586 | echo "" |
---|
[9518] | 587 | echo " !----repro----! " |
---|
[14981] | 588 | for repro_test in GYRE_PISCES ORCA2_ICE_PISCES ORCA2_OFF_PISCES AMM12 ORCA2_SAS_ICE ORCA2_ICE_OBS AGRIF_DEMO WED025 ISOMIP+ VORTEX ICE_AGRIF SWG |
---|
[6124] | 589 | do |
---|
| 590 | reprotest $NEMO_VALID $repro_test $pass |
---|
| 591 | done |
---|
[9019] | 592 | |
---|
[9518] | 593 | # AGRIF special check to ensure results are unchanged with and without key_agrif |
---|
[9525] | 594 | echo "" |
---|
[9518] | 595 | echo " !----agrif check----! " |
---|
[14981] | 596 | dir1=AGRIF_DEMO_NOAGRIF |
---|
| 597 | dir2=AGRIF_DEMO |
---|
[9019] | 598 | identictest $NEMO_VALID $dir1 $dir2 $pass |
---|
[11161] | 599 | # |
---|
| 600 | # before/after tests |
---|
| 601 | if [ $lastchange == 'old' ] ; then |
---|
| 602 | echo "" |
---|
| 603 | echo " !---- 'old' specified as revision => no comparison with reference results ----! " |
---|
| 604 | echo "" |
---|
| 605 | else |
---|
| 606 | echo "" |
---|
| 607 | echo " !----result comparison check----! " |
---|
| 608 | if [ $NEMO_VALID_REF != "/path/to/reference/sette/results" ]; then |
---|
| 609 | echo '' |
---|
| 610 | echo 'check result differences between :' |
---|
| 611 | echo "VALID directory : $NEMO_VALID at rev $lastchange" |
---|
| 612 | echo 'and' |
---|
| 613 | echo "REFERENCE directory : $NEMO_VALID_REF at rev $NEMO_REV_REF" |
---|
| 614 | echo '' |
---|
[14981] | 615 | checklist=(GYRE_PISCES ORCA2_ICE_PISCES ORCA2_OFF_PISCES AMM12 ORCA2_SAS_ICE AGRIF_DEMO WED025 ISOMIP+ VORTEX ICE_AGRIF OVERFLOW LOCK_EXCHANGE SWG) |
---|
[14844] | 616 | for repro_test in ${checklist[@]} |
---|
[11161] | 617 | do |
---|
| 618 | runcmpres $NEMO_VALID $repro_test $NEMO_VALID_REF $NEMO_REV_REF $pass |
---|
| 619 | done |
---|
[14844] | 620 | echo '' |
---|
| 621 | echo 'Report timing differences between REFERENCE and VALID (if available) :' |
---|
| 622 | for repro_test in ${checklist[@]} |
---|
| 623 | do |
---|
| 624 | runcmptim $NEMO_VALID $repro_test $NEMO_VALID_REF $NEMO_REV_REF $pass |
---|
| 625 | done |
---|
[11161] | 626 | else |
---|
| 627 | echo '' |
---|
| 628 | echo ' No path for comparison specified. Result are not compare with any other revision. ' |
---|
| 629 | echo ' To do it please fill NEMO_VALID_REF and NEMO_REV_REF in param.cfg. ' |
---|
| 630 | echo '' |
---|
| 631 | fi |
---|
| 632 | fi |
---|
[9019] | 633 | done |
---|
[6124] | 634 | # |
---|
| 635 | exit |
---|