[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 | |
---|
[10713] | 13 | function get_dorv() { |
---|
| 14 | if [ $lastchange == 'old' ] ; then |
---|
| 15 | dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l ` |
---|
| 16 | dorv=`echo $dorv | sed -e 's:.*/::'` |
---|
| 17 | else |
---|
| 18 | dorv=$lastchange |
---|
| 19 | fi |
---|
| 20 | } |
---|
| 21 | |
---|
[8468] | 22 | function restfile() { |
---|
| 23 | # Rebuild ice restart for SAS CONFIG, and restartability checks. Expects LONG and SHORT run directories. |
---|
| 24 | # For Stand Alone Surface configuration ocean is not running, just run ice model; so no outputs ocean files. |
---|
| 25 | # Compares LONG rebuild restart ice file with equivalent entry from the SHORT rebuild restart ice file. |
---|
| 26 | # |
---|
[9019] | 27 | # check nco module loaded, and load it if not |
---|
| 28 | if [ ! $( echo $LOADEDMODULES | grep cdo ) ]; then module load cdo >& /dev/null ; fi |
---|
| 29 | # |
---|
[8468] | 30 | vdir=$1 |
---|
| 31 | nam=$2 |
---|
| 32 | pass=$3 |
---|
[9019] | 33 | |
---|
[10713] | 34 | # get $dorv |
---|
| 35 | get_dorv |
---|
[8468] | 36 | # |
---|
[10708] | 37 | # check if directory is here |
---|
| 38 | if [ ! -d $vdir/$nam/$mach/$dorv ]; then |
---|
[10713] | 39 | printf "%-27s %s %s\n" $nam " directory MISSING : " $dorv |
---|
[10708] | 40 | return |
---|
| 41 | fi |
---|
| 42 | |
---|
| 43 | if [ -d $vdir/$nam/$mach/$dorv/ ]; then |
---|
[8468] | 44 | rep1=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -2l | head -1 ` |
---|
| 45 | rep2=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -1l` |
---|
| 46 | cd ${SAS_RESTART_DIR}/LONG |
---|
| 47 | #SF add here compilation of rebuild_tools to rebuild restart files, and add comparison of restart files |
---|
| 48 | cd ${TOOLS_DIR} |
---|
| 49 | ./maketools -n REBUILD_NEMO -m ${mach} > /dev/null 2>&1 |
---|
| 50 | cd ${TOOLS_DIR}/REBUILD_NEMO |
---|
| 51 | #SF echo "REBUILD LONG restart SAS files, without standard output" |
---|
[9663] | 52 | ./rebuild_nemo -t 4 ../../cfgs/ORCA2_SAS_ICE_ST/LONG/SAS_00000240_restart_ice $NPROC > /dev/null 2>&1 |
---|
[8468] | 53 | #SF echo "REBUILD SHORT restart SAS files, without standard output" |
---|
[9663] | 54 | ./rebuild_nemo -t 4 ../../cfgs/ORCA2_SAS_ICE_ST/SHORT/SAS_00000240_restart_ice $NPROC >&- |
---|
[8468] | 55 | cd ${SAS_RESTART_DIR}/LONG |
---|
| 56 | #SF echo "COPY rebuild restart files" |
---|
[8815] | 57 | cp SAS_00000240_restart_ice.nc $vdir/$nam/$mach/$dorv/LONG/. |
---|
| 58 | cp ../SHORT/SAS_00000240_restart_ice.nc $vdir/$nam/$mach/$dorv/SHORT/. |
---|
[8468] | 59 | |
---|
[8815] | 60 | f1o=$vdir/$nam/$mach/$dorv/LONG/SAS_00000240_restart_ice.nc |
---|
| 61 | f2o=$vdir/$nam/$mach/$dorv/SHORT/SAS_00000240_restart_ice.nc |
---|
[8468] | 62 | if [ ! -f $f1o ] && [ ! -f $f2o ] ; then |
---|
[9525] | 63 | printf "%-27s %s\n" $nam " REBUILD SAS restart ice DOES NOT exists; incomplete test"; |
---|
[8468] | 64 | return; |
---|
| 65 | fi |
---|
| 66 | # |
---|
| 67 | done_oce=0 |
---|
| 68 | # |
---|
[9019] | 69 | if [ -f $f1o ] && [ -f $f2o ]; then |
---|
| 70 | ## Compare the two netcdf files |
---|
| 71 | cdo diffn $f1o $f2o > cdo_diff.out 2> /dev/null |
---|
| 72 | ## Identical if cdo_diff.out exists but has zero size |
---|
| 73 | if [ ! -s cdo_diff.out ]; then |
---|
| 74 | difi=0 |
---|
| 75 | else |
---|
| 76 | ## Identical if first character of $dif ==0 |
---|
| 77 | dif=$( grep -om1 '[0-9]* of [0-9]* records differ' cdo_diff.out ) |
---|
| 78 | # difi contains the first character of summary of cdo dif. if = 0, then 0 record differ between the 2 files |
---|
| 79 | if [ -n "$dif" ]; then |
---|
| 80 | difi=`echo $dif | cut -c -1` |
---|
| 81 | fi |
---|
| 82 | fi |
---|
| 83 | \rm cdo_diff.out |
---|
| 84 | |
---|
| 85 | if [ $difi == 0 ]; then |
---|
| 86 | if [ $pass == 0 ]; then |
---|
[9525] | 87 | printf "%-27s %s %s\n" $nam " ice restarts are IDENTICAL passed : " $dorv |
---|
[9019] | 88 | fi |
---|
| 89 | else |
---|
[9525] | 90 | printf "%-27s %s %s\n" $nam " ice restarts are DIFFERENT FAILED : " $dorv |
---|
[8468] | 91 | # |
---|
| 92 | # Offer view of differences on the second pass |
---|
| 93 | # |
---|
| 94 | if [ $pass == 1 ]; then |
---|
| 95 | echo "<return> to view restart_ice.nc differences" |
---|
| 96 | read y |
---|
| 97 | cdo -diffv $f1o $f2o |
---|
| 98 | done_oce=1 |
---|
| 99 | #echo "<return> to continue" |
---|
| 100 | #read y |
---|
| 101 | fi |
---|
| 102 | fi |
---|
[9019] | 103 | else |
---|
[9525] | 104 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[9019] | 105 | return; |
---|
| 106 | fi |
---|
[8468] | 107 | # |
---|
| 108 | fi |
---|
| 109 | } |
---|
| 110 | |
---|
[6124] | 111 | function resttest() { |
---|
| 112 | # |
---|
| 113 | # Restartability checks. Expects LONG and SHORT run directories |
---|
| 114 | # Compares end of LONG stat files with equivalent entries from the SHORT stat files. |
---|
| 115 | # |
---|
| 116 | vdir=$1 |
---|
| 117 | nam=$2 |
---|
| 118 | pass=$3 |
---|
| 119 | # |
---|
[10713] | 120 | # get $dorv |
---|
| 121 | get_dorv |
---|
[10708] | 122 | # |
---|
| 123 | # check if directory is here |
---|
| 124 | if [ ! -d $vdir/$nam/$mach/$dorv ]; then |
---|
[10713] | 125 | printf "%-27s %s %s\n" $nam " directory MISSING : " $dorv |
---|
[10708] | 126 | return |
---|
| 127 | fi |
---|
| 128 | |
---|
| 129 | if [ -d $vdir/$nam/$mach/$dorv ]; then |
---|
[10713] | 130 | # check ocean output |
---|
| 131 | runtest $vdir $nam $pass RST |
---|
| 132 | # |
---|
| 133 | # run restartibility test |
---|
[6124] | 134 | f1o=$vdir/$nam/$mach/$dorv/LONG/ocean.output |
---|
[9019] | 135 | f1s=$vdir/$nam/$mach/$dorv/LONG/run.stat |
---|
[6124] | 136 | f1t=$vdir/$nam/$mach/$dorv/LONG/tracer.stat |
---|
| 137 | f2o=$vdir/$nam/$mach/$dorv/SHORT/ocean.output |
---|
[9019] | 138 | f2s=$vdir/$nam/$mach/$dorv/SHORT/run.stat |
---|
[6124] | 139 | f2t=$vdir/$nam/$mach/$dorv/SHORT/tracer.stat |
---|
| 140 | |
---|
[6152] | 141 | if [ ! -f $f1s ] && [ ! -f $f1t ] ; then |
---|
[9525] | 142 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 143 | return; |
---|
| 144 | fi |
---|
[6152] | 145 | if [ ! -f $f2s ] && [ ! -f $f2t ] ; then |
---|
[9525] | 146 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 147 | return; |
---|
| 148 | fi |
---|
| 149 | # |
---|
| 150 | done_oce=0 |
---|
| 151 | |
---|
[6152] | 152 | if [ -f $f1s ] && [ -f $f2s ]; then |
---|
| 153 | nl=(`wc -l $f2s`) |
---|
| 154 | tail -${nl[0]} $f1s > f1.tmp$$ |
---|
| 155 | cmp -s f1.tmp$$ $f2s |
---|
| 156 | if [ $? == 0 ]; then |
---|
| 157 | if [ $pass == 0 ]; then |
---|
[9525] | 158 | printf "%-27s %s %s\n" $nam " run.stat restartability passed : " $dorv |
---|
[6152] | 159 | fi |
---|
| 160 | else |
---|
[9525] | 161 | printf "%-27s %s %s\n" $nam " run.stat restartability FAILED : " $dorv |
---|
[6124] | 162 | # |
---|
| 163 | # Offer view of differences on the second pass |
---|
| 164 | # |
---|
[6152] | 165 | if [ $pass == 1 ]; then |
---|
[9019] | 166 | echo "<return> to view run.stat differences" |
---|
[6152] | 167 | read y |
---|
| 168 | sdiff f1.tmp$$ $f2s |
---|
| 169 | echo "<return> to view ocean.output differences" |
---|
| 170 | read y |
---|
| 171 | sdiff $f1o $f2o | grep "|" |
---|
| 172 | done_oce=1 |
---|
| 173 | echo "<return> to continue" |
---|
| 174 | read y |
---|
| 175 | fi |
---|
[6124] | 176 | fi |
---|
| 177 | fi |
---|
| 178 | # |
---|
| 179 | # Check tracer.stat files (if they exist) |
---|
| 180 | # |
---|
[6152] | 181 | if [ -f $f1t ] && [ -f $f2t ]; then |
---|
[6124] | 182 | nl=(`wc -l $f2t`) |
---|
| 183 | tail -${nl[0]} $f1t > f1.tmp$$ |
---|
| 184 | cmp -s f1.tmp$$ $f2t |
---|
| 185 | if [ $? == 0 ]; then |
---|
[6152] | 186 | if [ $pass == 0 ]; then |
---|
[9525] | 187 | printf "%-27s %s %s\n" $nam " tracer.stat restartability passed : " $dorv |
---|
[6152] | 188 | fi |
---|
[6124] | 189 | else |
---|
[9525] | 190 | printf "%-27s %s %s\n" $nam " tracer.stat restartability FAILED : " $dorv |
---|
[6124] | 191 | # |
---|
| 192 | # Offer view of differences on the second pass |
---|
| 193 | # |
---|
| 194 | if [ $pass == 1 ]; then |
---|
| 195 | echo "<return> to view tracer.stat differences" |
---|
| 196 | read y |
---|
| 197 | sdiff f1.tmp$$ $f2t |
---|
| 198 | # |
---|
| 199 | # Only offer ocean.output view if it has not been viewed previously |
---|
| 200 | # |
---|
| 201 | if [ $done_oce == 0 ]; then |
---|
| 202 | echo "<return> to view ocean.output differences" |
---|
| 203 | read y |
---|
| 204 | sdiff $f1o $f2o | grep "|" |
---|
| 205 | fi |
---|
| 206 | echo "<return> to continue" |
---|
| 207 | read y |
---|
| 208 | fi |
---|
| 209 | fi |
---|
| 210 | fi |
---|
| 211 | rm f1.tmp$$ |
---|
| 212 | fi |
---|
| 213 | } |
---|
| 214 | |
---|
| 215 | function reprotest(){ |
---|
| 216 | # |
---|
| 217 | # Reproducibility checks. Expects REPRO_N_M and REPRO_I_J run directories |
---|
| 218 | # Compares end of stat files from each |
---|
| 219 | # |
---|
| 220 | vdir=$1 |
---|
| 221 | nam=$2 |
---|
| 222 | pass=$3 |
---|
| 223 | # |
---|
[10713] | 224 | # get $dorv |
---|
| 225 | get_dorv |
---|
| 226 | # |
---|
[10708] | 227 | # check if directory is here |
---|
| 228 | if [ ! -d $vdir/$nam/$mach/$dorv ]; then |
---|
[10713] | 229 | printf "%-27s %s %s\n" $nam " directory MISSING : " $dorv |
---|
[10708] | 230 | return |
---|
| 231 | fi |
---|
| 232 | # |
---|
| 233 | if [ -d $vdir/$nam/$mach/$dorv ]; then |
---|
[10713] | 234 | # check ocean output |
---|
| 235 | runtest $vdir $nam $pass REPRO |
---|
| 236 | # |
---|
| 237 | # check reproducibility |
---|
[9019] | 238 | rep1=`ls -1rt $vdir/$nam/$mach/$dorv/ | grep REPRO | tail -2l | head -1 ` |
---|
| 239 | rep2=`ls -1rt $vdir/$nam/$mach/$dorv/ | grep REPRO | tail -1l` |
---|
[6124] | 240 | f1o=$vdir/$nam/$mach/$dorv/$rep1/ocean.output |
---|
[9019] | 241 | f1s=$vdir/$nam/$mach/$dorv/$rep1/run.stat |
---|
[6124] | 242 | f1t=$vdir/$nam/$mach/$dorv/$rep1/tracer.stat |
---|
| 243 | f2o=$vdir/$nam/$mach/$dorv/$rep2/ocean.output |
---|
[9019] | 244 | f2s=$vdir/$nam/$mach/$dorv/$rep2/run.stat |
---|
[6124] | 245 | f2t=$vdir/$nam/$mach/$dorv/$rep2/tracer.stat |
---|
| 246 | |
---|
[6152] | 247 | if [ ! -f $f1s ] && [ ! -f $f1t ] ; then |
---|
[9525] | 248 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 249 | return; |
---|
| 250 | fi |
---|
[6152] | 251 | if [ ! -f $f2s ] && [ ! -f $f2t ] ; then |
---|
[9525] | 252 | printf "%-27s %s\n" $nam " incomplete test"; |
---|
[6124] | 253 | return; |
---|
| 254 | fi |
---|
| 255 | # |
---|
| 256 | done_oce=0 |
---|
| 257 | |
---|
[6152] | 258 | if [ -f $f1s ] && [ -f $f2s ] ; then |
---|
| 259 | cmp -s $f1s $f2s |
---|
| 260 | if [ $? == 0 ]; then |
---|
| 261 | if [ $pass == 0 ]; then |
---|
[9525] | 262 | printf "%-27s %s %s\n" $nam " run.stat reproducibility passed : " $dorv |
---|
[6152] | 263 | fi |
---|
| 264 | else |
---|
[9525] | 265 | printf "%-27s %s %s\n" $nam " run.stat reproducibility FAILED : " $dorv |
---|
[6124] | 266 | # |
---|
| 267 | # Offer view of differences on the second pass |
---|
| 268 | # |
---|
[6152] | 269 | if [ $pass == 1 ]; then |
---|
[9019] | 270 | echo "<return> to view run.stat differences" |
---|
[6152] | 271 | read y |
---|
[9911] | 272 | sdiff $f1s $f2s |
---|
[6152] | 273 | echo "<return> to view ocean.output differences" |
---|
| 274 | read y |
---|
| 275 | sdiff $f1o $f2o | grep "|" |
---|
| 276 | done_oce=1 |
---|
| 277 | echo "<return> to continue" |
---|
| 278 | read y |
---|
| 279 | fi |
---|
[6124] | 280 | fi |
---|
| 281 | fi |
---|
| 282 | # |
---|
| 283 | # Check tracer.stat files (if they exist) |
---|
| 284 | # |
---|
[6152] | 285 | if [ -f $f1t ] && [ -f $f2t ] ; then |
---|
[6124] | 286 | cmp -s $f1t $f2t |
---|
| 287 | if [ $? == 0 ]; then |
---|
[9525] | 288 | if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam " tracer.stat reproducibility passed : " $dorv |
---|
[6152] | 289 | fi |
---|
[6124] | 290 | else |
---|
[10708] | 291 | printf "%-27s %s %s\n" $nam " tracer.stat reproducibility FAILED : " $dorv |
---|
[6124] | 292 | # |
---|
| 293 | # Offer view of differences on the second pass |
---|
| 294 | # |
---|
| 295 | if [ $pass == 1 ]; then |
---|
| 296 | echo "<return> to view tracer.stat differences" |
---|
| 297 | read y |
---|
| 298 | sdiff $f1t $f2t |
---|
| 299 | # |
---|
| 300 | # Only offer ocean.output view if it has not been viewed previously |
---|
| 301 | # |
---|
| 302 | if [ $done_oce == 0 ]; then |
---|
| 303 | echo "<return> to view ocean.output differences" |
---|
| 304 | read y |
---|
| 305 | sdiff $f1o $f2o | grep "|" |
---|
| 306 | fi |
---|
| 307 | echo "<return> to continue" |
---|
| 308 | read y |
---|
| 309 | fi |
---|
| 310 | fi |
---|
| 311 | fi |
---|
[9223] | 312 | fi |
---|
| 313 | } |
---|
[10687] | 314 | function runcmpres(){ |
---|
| 315 | # |
---|
| 316 | # compare *.stat file with reference file from a previous sette test or previous version |
---|
| 317 | # store in NEMO_VALID_REF at revision NEMO_REV_REF |
---|
| 318 | # Compares end of stat files from each |
---|
| 319 | # |
---|
| 320 | vdir=$1 |
---|
| 321 | nam=$2 |
---|
| 322 | vdirref=$3 |
---|
| 323 | dorvref=$4 |
---|
| 324 | pass=$5 |
---|
| 325 | # |
---|
[10713] | 326 | # get $dorv |
---|
| 327 | get_dorv |
---|
| 328 | # |
---|
[10698] | 329 | # check if reference directory is present |
---|
| 330 | if [ ! -d $vdirref/$nam/$mach/$dorvref ]; then |
---|
[10709] | 331 | printf "%-27s %s\n" $nam " REFERENCE directory at $dorvref is MISSING" |
---|
[10698] | 332 | return |
---|
| 333 | fi |
---|
[10708] | 334 | if [ ! -d $vdir/$nam/$mach/$dorv ]; then |
---|
[10709] | 335 | printf "%-27s %s\n" $nam " VALID directory at $dorv is MISSING" |
---|
[10708] | 336 | return |
---|
| 337 | fi |
---|
| 338 | |
---|
[10698] | 339 | # |
---|
[10708] | 340 | if [ -d $vdir/$nam/$mach/$dorv ]; then |
---|
[10687] | 341 | f1s=$vdir/$nam/$mach/$dorv/LONG/run.stat |
---|
| 342 | f1t=$vdir/$nam/$mach/$dorv/LONG/tracer.stat |
---|
| 343 | f2s=$vdirref/$nam/$mach/$dorvref/LONG/run.stat |
---|
| 344 | f2t=$vdirref/$nam/$mach/$dorvref/LONG/tracer.stat |
---|
| 345 | if [ ! -f $f1s ] && [ ! -f $f1t ] ; then |
---|
| 346 | printf "%-20s %s\n" $nam " incomplete test"; |
---|
| 347 | return; |
---|
| 348 | fi |
---|
| 349 | if [ ! -f $f2s ] && [ ! -f $f2t ] ; then |
---|
| 350 | printf "%-20s %s\n" $nam " incomplete test"; |
---|
| 351 | return; |
---|
| 352 | fi |
---|
| 353 | # |
---|
| 354 | done_oce=0 |
---|
[9223] | 355 | |
---|
[10687] | 356 | if [ -f $f1s ] && [ -f $f2s ] ; then |
---|
| 357 | cmp -s $f1s $f2s |
---|
| 358 | if [ $? == 0 ]; then |
---|
| 359 | if [ $pass == 0 ]; then |
---|
[10713] | 360 | printf "%-20s %s %s\n" $nam " run.stat files are identical " |
---|
[10687] | 361 | fi |
---|
| 362 | else |
---|
[10713] | 363 | printf "%-20s %s %s\n" $nam " run.stat files are DIFFERENT " |
---|
[10687] | 364 | # |
---|
| 365 | # Offer view of differences on the second pass |
---|
| 366 | # |
---|
| 367 | if [ $pass == 1 ]; then |
---|
| 368 | echo "<return> to view run.stat differences" |
---|
| 369 | read y |
---|
[10713] | 370 | sdiff $f1s $f2s |
---|
[10687] | 371 | done_oce=1 |
---|
| 372 | echo "<return> to continue" |
---|
| 373 | read y |
---|
| 374 | fi |
---|
| 375 | fi |
---|
| 376 | fi |
---|
| 377 | # Check tracer.stat files (if they exist) |
---|
| 378 | # |
---|
| 379 | if [ -f $f1t ] && [ -f $f2t ] ; then |
---|
| 380 | cmp -s $f1t $f2t |
---|
| 381 | if [ $? == 0 ]; then |
---|
| 382 | if [ $pass == 0 ]; then |
---|
[10713] | 383 | printf "%-20s %s %s\n" $nam " tracer.stat files are identical " |
---|
[10687] | 384 | fi |
---|
| 385 | else |
---|
[10713] | 386 | printf "%-20s %s %s\n" $nam " tracer.stat files are DIFFERENT " |
---|
[10687] | 387 | # |
---|
| 388 | # Offer view of differences on the second pass |
---|
| 389 | # |
---|
| 390 | if [ $pass == 1 ]; then |
---|
| 391 | echo "<return> to view tracer.stat differences" |
---|
| 392 | read y |
---|
| 393 | sdiff $f1t $f2t |
---|
| 394 | fi |
---|
| 395 | fi |
---|
| 396 | fi |
---|
| 397 | fi |
---|
| 398 | } |
---|
| 399 | |
---|
[9223] | 400 | function runtest(){ |
---|
| 401 | # |
---|
| 402 | # Run checks. |
---|
| 403 | # Check presence of E R R O R in ocean.output from each |
---|
| 404 | # |
---|
| 405 | vdir=$1 |
---|
| 406 | nam=$2 |
---|
| 407 | pass=$3 |
---|
[10713] | 408 | ttype=$4 |
---|
| 409 | [[ $ttype == 'RST' ]] && ttype="LONG|SHORT" |
---|
[9223] | 410 | # |
---|
[10713] | 411 | # get $dorv |
---|
| 412 | get_dorv |
---|
| 413 | # |
---|
[10708] | 414 | # no print needed if the repository is not here (already catch before) |
---|
| 415 | # |
---|
| 416 | if [ -d $vdir/$nam/$mach/$dorv/ ]; then |
---|
[10713] | 417 | # |
---|
| 418 | # apply check for all ttype directory |
---|
| 419 | rep1=$(ls -rt $vdir/$nam/$mach/$dorv/ | grep -E $ttype) |
---|
| 420 | for tdir in $rep1 ; do |
---|
| 421 | f1o=$vdir/$nam/$mach/$dorv/$tdir/ocean.output |
---|
| 422 | if [ ! -f $f1o ] ; then |
---|
| 423 | if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam " ocean.output MISSING : " $dorv ; fi |
---|
| 424 | return; |
---|
| 425 | else |
---|
| 426 | nerr=`grep 'E R R O R' $f1o | wc -l` |
---|
| 427 | if [[ $nerr > 0 ]]; then |
---|
| 428 | printf "%-27s %s %s %s\n" $nam " run FAILED : " $dorv " ( E R R O R in ocean.output) " |
---|
| 429 | if [ $pass == 1 ]; then |
---|
| 430 | echo "<return> to view end of ocean.output" |
---|
| 431 | read y |
---|
| 432 | tail -100 $f1o |
---|
| 433 | echo '' |
---|
| 434 | echo "full ocean.output available here: $f1o" |
---|
| 435 | fi |
---|
| 436 | return; |
---|
| 437 | fi |
---|
| 438 | fi |
---|
| 439 | done |
---|
[9221] | 440 | else |
---|
[10713] | 441 | if [ $pass == 0 ]; then printf "%-27s %s %s\n" $nam " directory MISSING : " $dorv ; fi |
---|
[6124] | 442 | fi |
---|
| 443 | } |
---|
[9019] | 444 | |
---|
| 445 | function identictest(){ |
---|
| 446 | # |
---|
| 447 | # checks AGRIF does not corrupe results with no AGRIF zoom. Expects ORCA2AGUL/AGRIFNOZ and ORCA2AGUL_NAGR/AGRIFNO run directories |
---|
| 448 | # Compares solver.stat files for each |
---|
| 449 | # |
---|
| 450 | vdir=$1 |
---|
| 451 | dir1=$2 |
---|
| 452 | dir2=$3 |
---|
| 453 | pass=$4 |
---|
| 454 | # |
---|
| 455 | if [ -d $vdir/$dir1 ] && [ -d $vdir/$dir2 ]; then |
---|
| 456 | dorv1=`ls -1rt $vdir/$dir1/$mach/ | tail -1l ` |
---|
| 457 | dorv1=`echo $dorv1 | sed -e 's:.*/::'` |
---|
| 458 | dorv2=`ls -1rt $vdir/$dir2/$mach/ | tail -1l ` |
---|
| 459 | dorv2=`echo $dorv2 | sed -e 's:.*/::'` |
---|
| 460 | |
---|
[9518] | 461 | rep1=`ls -1rt $vdir/$dir1/$mach/$dorv1/ | tail -1l` |
---|
[9525] | 462 | #clem rep2=`ls -1rt $vdir/$dir2/$mach/$dorv2/ | tail -1l` |
---|
| 463 | rep2=`ls -1rt $vdir/$dir1/$mach/$dorv1/ | tail -1l` |
---|
[9019] | 464 | f1s=$vdir/$dir1/$mach/$dorv1/$rep1/run.stat |
---|
| 465 | f2s=$vdir/$dir2/$mach/$dorv2/$rep2/run.stat |
---|
| 466 | |
---|
| 467 | if [ ! -f $f1s ] && [ ! -f $f2s ] ; then |
---|
[9525] | 468 | printf "%-27s %s\n" $dir1 $dir2 " incomplete test"; |
---|
[9019] | 469 | return; |
---|
| 470 | fi |
---|
| 471 | # |
---|
| 472 | done_oce=0 |
---|
| 473 | |
---|
| 474 | if [ -f $f1s ] && [ -f $f2s ] ; then |
---|
| 475 | cmp -s $f1s $f2s |
---|
| 476 | if [ $? == 0 ]; then |
---|
| 477 | if [ $pass == 0 ]; then |
---|
[9525] | 478 | printf "%-5s %s %-5s %s %s %s\n" $rep1 "AGRIF vs" $rep2 "NOAGRIF run.stat unchanged - passed : " $dorv1 $dorv2 |
---|
[9019] | 479 | fi |
---|
| 480 | else |
---|
[9525] | 481 | printf "%-5s %s %-5s %s %s %s\n" $rep1 "AGRIF vs" $rep2 "NOAGRIF run.stat changed - FAILED : " $dorv1 $dorv2 |
---|
[9019] | 482 | # |
---|
| 483 | # Offer view of differences on the second pass |
---|
| 484 | # |
---|
| 485 | if [ $pass == 1 ]; then |
---|
| 486 | echo "<return> to view run.stat differences" |
---|
| 487 | read y |
---|
| 488 | sdiff $f1s $f2s |
---|
| 489 | done_oce=1 |
---|
| 490 | echo "<return> to continue" |
---|
| 491 | read y |
---|
| 492 | fi |
---|
| 493 | fi |
---|
| 494 | fi |
---|
| 495 | else |
---|
[9525] | 496 | printf "%-27s %s\n" $dir1 $dir2 " incomplete test"; |
---|
[9019] | 497 | fi |
---|
| 498 | } |
---|
[6124] | 499 | ########################### END of function definitions ################################# |
---|
| 500 | ## ## |
---|
| 501 | ## Main script ## |
---|
| 502 | ## ## |
---|
| 503 | ######################################################################################### |
---|
| 504 | # |
---|
[10687] | 505 | # LOAD param variable (COMPILER, NEMO_VALIDATION_DIR, SVN_CMD) |
---|
[10717] | 506 | SETTE_DIR=$(cd $(dirname "$0"); pwd) |
---|
| 507 | MAIN_DIR=$(dirname $SETTE_DIR) |
---|
[10687] | 508 | . ./param.cfg |
---|
| 509 | |
---|
| 510 | mach=${COMPILER} |
---|
| 511 | NEMO_VALID=${NEMO_VALIDATION_DIR} |
---|
| 512 | NEMO_VALID_REF=${NEMO_VALIDATION_REF} |
---|
| 513 | LANG=en_US |
---|
[6124] | 514 | # |
---|
| 515 | if [ ! -d $NEMO_VALID ]; then |
---|
| 516 | echo "$NEMO_VALID validation directory not found" |
---|
| 517 | exit |
---|
| 518 | fi |
---|
| 519 | # |
---|
[9019] | 520 | # Directory to run the tests |
---|
[9602] | 521 | CONFIG_DIR0=${MAIN_DIR}/cfgs |
---|
[9605] | 522 | TOOLS_DIR=${MAIN_DIR}/tools |
---|
[9019] | 523 | NPROC=32 |
---|
[9663] | 524 | SAS_RESTART_DIR=${CONFIG_DIR0}/ORCA2_SAS_ICE_ST |
---|
[9019] | 525 | # |
---|
| 526 | # Show current revision tag and branch name |
---|
| 527 | # |
---|
[10687] | 528 | echo "" |
---|
| 529 | lastchange=`LC_MESSAGES=${LANG} ${SVN_CMD} info ${MAIN_DIR} | grep 'Last Changed Rev' | awk '{print $NF}'` |
---|
| 530 | revision=`LC_MESSAGES=${LANG} ${SVN_CMD} info ${MAIN_DIR} | grep 'Revision' | awk '{print $NF}'` |
---|
| 531 | branchname=`LC_MESSAGES=${LANG} ${SVN_CMD} info ${MAIN_DIR} | grep ^URL | awk -F ipsl/forge/projets/nemo/svn/ '{print $NF}'` |
---|
[10708] | 532 | echo "Current code is : $branchname @ r$revision ( last change @ r$lastchange )" |
---|
| 533 | |
---|
| 534 | # overwrite revision is argument 1 present |
---|
[10713] | 535 | [[ $# -eq 1 ]] && lastchange=$1 |
---|
[10708] | 536 | |
---|
| 537 | echo "" |
---|
[10769] | 538 | echo "SETTE validation report generated for : " |
---|
[10708] | 539 | echo "" |
---|
[10769] | 540 | echo " $branchname @ r$lastchange (last changed revision)" |
---|
| 541 | echo "" |
---|
| 542 | echo " on $COMPILER arch file" |
---|
| 543 | echo "" |
---|
[10708] | 544 | |
---|
[9019] | 545 | # |
---|
[6124] | 546 | # The script also needs the date or revision tag. Currently this is taken from the latest sub-directory found in each directory |
---|
| 547 | # |
---|
| 548 | for pass in 0 1 |
---|
| 549 | do |
---|
| 550 | # |
---|
[9525] | 551 | if [ $pass == 0 ]; then |
---|
| 552 | echo "" |
---|
| 553 | echo "!!---------------1st pass------------------!!" |
---|
| 554 | fi |
---|
| 555 | if [ $pass == 1 ]; then |
---|
| 556 | echo "" |
---|
| 557 | echo "!!---------------2nd pass------------------!!" |
---|
| 558 | fi |
---|
[6124] | 559 | # |
---|
[8468] | 560 | |
---|
| 561 | # Rebuild and restartability test for SAS |
---|
[9518] | 562 | # clem: not needed anymore |
---|
[9663] | 563 | # for restart_file in WORCA2_SAS_ICE_ST |
---|
[9518] | 564 | # do |
---|
| 565 | # restfile $NEMO_VALID $restart_file $pass |
---|
| 566 | # done |
---|
[8468] | 567 | # |
---|
[6124] | 568 | # Restartability test |
---|
[9525] | 569 | echo "" |
---|
[9518] | 570 | echo " !----restart----! " |
---|
[10517] | 571 | for restart_test in WGYRE_PISCES_ST WORCA2_ICE_PISCES_ST WORCA2_OFF_PISCES_ST WAMM12_ST WORCA2_SAS_ICE_ST WAGRIF_DEMO_ST WSPITZ12_ST WISOMIP_ST WOVERFLOW_ST WLOCK_EXCHANGE_ST WVORTEX_ST WICE_AGRIF_ST |
---|
[6124] | 572 | do |
---|
| 573 | resttest $NEMO_VALID $restart_test $pass |
---|
| 574 | done |
---|
| 575 | # |
---|
| 576 | # Reproducibility tests |
---|
[9525] | 577 | echo "" |
---|
[9518] | 578 | echo " !----repro----! " |
---|
[10517] | 579 | for repro_test in WGYRE_PISCES_ST WORCA2_ICE_PISCES_ST WORCA2_OFF_PISCES_ST WAMM12_ST WORCA2_SAS_ICE_ST WORCA2_ICE_OBS_ST WAGRIF_DEMO_ST WSPITZ12_ST WISOMIP_ST WVORTEX_ST WICE_AGRIF_ST |
---|
[6124] | 580 | do |
---|
| 581 | reprotest $NEMO_VALID $repro_test $pass |
---|
| 582 | done |
---|
[9019] | 583 | |
---|
[9518] | 584 | # AGRIF special check to ensure results are unchanged with and without key_agrif |
---|
[9525] | 585 | echo "" |
---|
[9518] | 586 | echo " !----agrif check----! " |
---|
[9776] | 587 | dir1=WAGRIF_DEMO_NOAGRIF_ST |
---|
| 588 | dir2=WAGRIF_DEMO_ST |
---|
[9019] | 589 | identictest $NEMO_VALID $dir1 $dir2 $pass |
---|
[10687] | 590 | # |
---|
| 591 | # before/after tests |
---|
[10713] | 592 | if [ $lastchange == 'old' ] ; then |
---|
| 593 | echo "" |
---|
| 594 | echo " !---- 'old' specified as revision => no comparison with reference results ----! " |
---|
| 595 | echo "" |
---|
[10687] | 596 | else |
---|
[10713] | 597 | echo "" |
---|
| 598 | echo " !----result comparison check----! " |
---|
| 599 | if [ $NEMO_VALID_REF != "/path/to/reference/sette/results" ]; then |
---|
| 600 | echo '' |
---|
| 601 | echo 'check result differences between :' |
---|
| 602 | echo "VALID directory : $NEMO_VALID at rev $lastchange" |
---|
| 603 | echo 'and' |
---|
| 604 | echo "REFERENCE directory : $NEMO_VALID_REF at rev $NEMO_REV_REF" |
---|
| 605 | echo '' |
---|
| 606 | for repro_test in WGYRE_PISCES_ST WORCA2_ICE_PISCES_ST WORCA2_OFF_PISCES_ST WAMM12_ST WISOMIP_ST WORCA2_SAS_ICE_ST WAGRIF_DEMO_ST WSPITZ12_ST WISOMIP_ST WVORTEX_ST WICE_AGRIF_ST |
---|
| 607 | do |
---|
| 608 | runcmpres $NEMO_VALID $repro_test $NEMO_VALID_REF $NEMO_REV_REF $pass |
---|
| 609 | done |
---|
| 610 | else |
---|
| 611 | echo '' |
---|
| 612 | echo ' No path for comparison specified. Result are not compare with any other revision. ' |
---|
| 613 | echo ' To do it please fill NEMO_VALID_REF and NEMO_REV_REF in param.cfg. ' |
---|
| 614 | echo '' |
---|
| 615 | fi |
---|
[10687] | 616 | fi |
---|
[9019] | 617 | done |
---|
[6124] | 618 | # |
---|
| 619 | exit |
---|