6 # This script runs a large number of WRF regression tests. On the
7 # IBM machines (which at NCAR allow queueing), the jobs are sent to
8 # the queue system via load leveler commands. On all other machines,
9 # the jobs are sent in sequentially as soon as the process returns
10 # from completing the previous task.
17 # mkdir /data3/mp/$USER/`hostname`
18 # put all_reg.csh, regtest.csh, and wrf.tar in dir
21 # flex lm errors show up as fails to compile
24 # bluevista or blueice
25 # put all_reg.csh, regtest.csh, and wrf.tar in ~
29 # Unless you are editing the script, no changes are required below
32 #=======================================================================
33 #=======================================================================
35 # The only really important thing.
37 if ( ! -e wrf.
tar ) then
39 echo "Whoa there pardner, where is that wrf.tar file"
44 # What these tests do, must be a single string.
46 set NAME
= ( "Standard" "NESTED=FALSE" "NESTED=FALSE" "NONE" 1 \
47 "Moving_Nest1" "NESTED1=FALSE" "NESTED1=TRUE" "NONE" 2 \
48 "Moving_Nest2" "NESTED2=FALSE" "NESTED2=TRUE" "NONE" 3 \
49 "NMM_Nest" "NESTED2=FALSE" "NESTED2=FALSE" "NONE" 4 \
50 "Full_Optimization" "REG_TYPE=BIT4BIT" "REG_TYPE=OPTIMIZED" "NONE" 5 \
51 "Chemistry" "CHEM=FALSE" "CHEM=TRUE" "NONE" 6 \
52 "Chemistry2" "KPP=FALSE" "KPP=TRUE" "NONE" 7 \
53 "Quilting" "QUILT=FALSE" "QUILT=TRUE" "NONE" 8 \
54 "Binary_IO" "IO_FORM=2" "IO_FORM=1" "NONE" 9 \
55 "GriB1_Output" "IO_FORM=2" "IO_FORM=5" "NONE" 10 \
56 "REAL8_Floats" "REAL8=FALSE" "REAL8=TRUE" "NONE" 11 \
57 "FDDA" "FDDA=FALSE" "FDDA=TRUE" "NONE" 12 \
58 "FDDA2" "FDDA2=FALSE" "FDDA2=TRUE" "NONE" 13 \
59 "ESMF_Library" "ESMF_LIB=FALSE" "ESMF_LIB=TRUE" "ONLY_AIX" 14 \
60 "Global" "GLOBAL=FALSE" "GLOBAL=TRUE" "NONE" 15 \
61 "Adaptive" "ADAPTIVE=FALSE" "ADAPTIVE=TRUE" "NONE" 16 \
64 # Where are we located.
66 set starting_dir
= `pwd`
68 # Get the tag manually. This is for the auto-report that gets
69 # sent to the WRF web page on the history of the regression tests.
71 set current_year4
= `date -u +"%Y"`
72 set current_month
= `date -u +"%m"`
73 set current_day
= `date -u +"%d"`
74 set current_hour
= `date -u +"%H"`
75 set current_minute
= `date -u +"%M"`
76 set current_second
= `date -u +"%S"`
77 set datehms
= ${current_year4}-${current_month}-${current_day}_${current_hour}:${current_minute}:${current_second}_UTC
78 set dateh
= ${current_year4}${current_month}${current_day}${current_hour}
79 set date = ${current_year4}${current_month}${current_day}
81 if ( $user == michalak
) then
83 else if ( $user == hender
) then
85 else if ( $user == gill
) then
87 else if ( $user == dudhia
) then
89 else if ( $user == weiwang
) then
94 echo the TAG is NOT defined
95 echo Please define an environment variable that is the WRFV3 tag
96 echo Something such as
: setenv TAG trunk_
${date}_
${initials}
101 # Are we only interested in the PASS/FAIL report?
103 if ( $#argv == 1 ) then
104 if ( $argv[1] == PASSFAIL
) then
109 # If there are any command line args, they are processed, else
110 # we run all of the regression tests without a generate or
111 # compare flag being set.
113 if ( $#argv == 0 ) then
115 set BASELINE
= RUN_ONLY
123 while ( $count_test < $#NAME )
124 set tests
= ( $tests "$NAME[$count_test]" )
126 set OLD_TEXT
= ( $OLD_TEXT "$NAME[$count_test]" )
128 set NEW_TEXT
= ( $NEW_TEXT "$NAME[$count_test]" )
130 set TOAST
= ( $TOAST "$NAME[$count_test]" )
132 set TEST_NUM
= ( $TEST_NUM "$NAME[$count_test]" )
136 # We have some command line args. They are either a request to run
137 # the test with a generate/compare flag, or a list of tests to perform.
141 set INIT_OPTS
= ( $
* )
143 # First, find the baseline type. This is going to be one of three
144 # possibilities: GENERATE, COMPARE, or a RUN_ONLY option. The
145 # default is RUN_ONLY. Only the first baseline option found is
149 while ( $count < $#INIT_OPTS )
151 set arg
= $INIT_OPTS[$count]
152 if ( ( $arg == GENERATE
) || \
153 ( $arg == COMPARE
) || \
154 ( $arg == RUN_ONLY
) ) then
156 goto FINISHED_BASELINE_TYPE
159 set BASELINE
= RUN_ONLY
160 FINISHED_BASELINE_TYPE
:
162 # If there was only one input, and it was telling us to do which type of baseline
163 # option (GENERATE, COMPARE, RUN_ONLY), we assume they want all of the tests
166 if ( $#INIT_OPTS == 1 ) then
167 if ( ( $INIT_OPTS == GENERATE
) ||
( $INIT_OPTS == COMPARE
) ||
( $INIT_OPTS == RUN_ONLY
) ) then
174 while ( $count_test < $#NAME )
175 set tests
= ( $tests "$NAME[$count_test]" )
177 set OLD_TEXT
= ( $OLD_TEXT "$NAME[$count_test]" )
179 set NEW_TEXT
= ( $NEW_TEXT "$NAME[$count_test]" )
181 set TOAST
= ( $TOAST "$NAME[$count_test]" )
183 set TEST_NUM
= ( $TEST_NUM "$NAME[$count_test]" )
186 goto FINISHED_TEST_LIST
190 # Find which tests are to be conducted. Loop over all of the
191 # input, and compare each of the input fields with the list
192 # of available test names. When a match occurs, increment the
193 # test found counter, and save the test name.
201 while ( $count < $#INIT_OPTS )
204 while ( $count_test < $#NAME )
205 if ( $INIT_OPTS[$count] == $NAME[$count_test] ) then
206 set tests
= ( $tests "$NAME[$count_test]" )
208 set OLD_TEXT
= ( $OLD_TEXT "$NAME[$count_test]" )
210 set NEW_TEXT
= ( $NEW_TEXT "$NAME[$count_test]" )
212 set TOAST
= ( $TOAST "$NAME[$count_test]" )
214 set TEST_NUM
= ( $TEST_NUM "$NAME[$count_test]" )
222 # If there are no recognizable tests requested, let them know our concern.
224 if ( $#tests == 0 ) then
225 echo No valid
test requested
in argument list
231 # A friendly check for the baseline directory existence, and locations for known
234 if ( ( $BASELINE == GENERATE
) ||
( $BASELINE == COMPARE
) ) then
235 if ( ( `uname` == AIX
) && ( ( `hostname | cut -c 1-2` != bs
) && \
236 ( `hostname | cut -c 1-2` != bv
) && ( `hostname | cut -c 1-2` != be
) ) ) then
237 set SAVE_DIR
= /ptmp
/${USER}/BASELINE
/`uname`
238 else if ( `uname` == AIX
) then
239 set SAVE_DIR
= /ptmp
/${USER}/BASELINE
/`uname`
240 else if ( ( `uname` == Linux
) && ( `hostname` == basswood
) ) then
241 set SAVE_DIR
= /basswood
/${user}/Regression_Tests
/BASELINE
/`uname`
242 else if ( ( `uname` == Darwin
) && ( `hostname` == stink
) ) then
243 set SAVE_DIR
= /stink
/${user}/Regression_Tests
/BASELINE
/`uname`
244 else if ( ( `uname` == Linux
) && ( `hostname` == bay-mmm
) ) then
245 set SAVE_DIR
= /data
3/mp
/${USER}/BASELINE
/`uname`
247 echo Hmm
, no idea where to put
/get this baseline data
, stopping
251 if ( ( -d $SAVE_DIR ) && ( $BASELINE == GENERATE
) ) then
252 echo "Troubles with SAVE_DIR logic."
253 echo "$SAVE_DIR should not exist for a $BASELINE run."
255 else if ( ( ! -d $SAVE_DIR ) && ( $BASELINE == COMPARE
) ) then
256 echo "Troubles with SAVE_DIR logic."
257 echo "$SAVE_DIR should exist for a $BASELINE run."
262 # We need the regtest.csh file, badly.
264 if ( ! -e regtest.csh
) then
265 echo we need regtest.csh
in this dir
266 echo "supply-ez vous, s'il vous plait"
270 # The regtest.csh file is treated as a template. The following
271 # strings (first occurrence) is sought (OLD_TEXT) and replaced
272 # with the modified string (NEW_TEXT). This edited regression
273 # script is then processed.
275 # Any exceptions to where they can run? NONE means no
276 # exceptions, should run on all machines. AIX/Linux
277 # means it will NOT run on that single machine. The
278 # option ONLY_AIX/ONLY_Linux means that the option
279 # ONLY works on that specific architecture.
282 # Loop over all selected tests.
285 while ( $count_test < $#tests )
290 while ( $count < $#NAME )
292 if ( "$tests[$count_test]" == "$NAME[$count]" ) then
293 goto FOUND_SELECTED_TEST
297 echo "Hmmm, no valid test found"
302 # Specifically skip this test on this architecture.
304 if ( `uname` == $TOAST[$count_test] ) then
305 echo skipping
test $tests[$count_test] for `uname` specifically
307 # Skip this test on this architecture because it ONLY runs
308 # on a different architecture.
310 else if ( ( `echo $TOAST[$count_test] | cut -c 1-5` == ONLY_
) && ( ONLY_
`uname` != $TOAST[$count_test] ) ) then
311 echo skipping
test $tests[$count_test] for `uname`, works on
$TOAST[$count_test]
313 # OK, we are allowed to run this test on this architecture.
315 else if ( ( $TOAST[$count_test] == NONE
) || \
316 ( $TOAST[$count_test] != `uname` ) || \
317 ( ONLY_
`uname` == $TOAST[$count_test] ) ) then
318 echo doing
test $tests[$count_test] for `uname`
320 # If this is the generate or compare baseline test, where do we
321 # save the data to/read the data from.
323 if ( ( $BASELINE == GENERATE
) ||
( $BASELINE == COMPARE
) ) then
324 if ( ( `uname` == AIX
) && ( ( `hostname | cut -c 1-2` != bs
) && \
325 ( `hostname | cut -c 1-2` != bv
) && ( `hostname | cut -c 1-2` != be
) ) ) then
326 set SAVE_DIR
= /ptmp
/${USER}/BASELINE
/`uname`/$tests[$count_test]
327 else if ( `uname` == AIX
) then
328 set SAVE_DIR
= /ptmp
/${USER}/BASELINE
/`uname`/$tests[$count_test]
329 else if ( ( `uname` == Linux
) && ( `hostname` == basswood
) ) then
330 set SAVE_DIR
= /basswood
/${USER}/Regression_Tests
/BASELINE
/`uname`/$tests[$count_test]
331 else if ( ( `uname` == Darwin
) && ( `hostname` == stink
) ) then
332 set SAVE_DIR
= /stink
/${USER}/Regression_Tests
/BASELINE
/`uname`/$tests[$count_test]
333 else if ( ( `uname` == Linux
) && ( `hostname` == bay-mmm
) ) then
334 set SAVE_DIR
= /data
3/mp
/${USER}/BASELINE
/`uname`/$tests[$count_test]
336 echo No idea where to put the data
, stopping
340 # Either zap existing stuff (GENERATE), or make sure it is there (COMPARE)
342 if ( $BASELINE == GENERATE
) then
343 /bin
/rm -rf $SAVE_DIR
344 else if ( ( $BASELINE == COMPARE
) && ( $tests[$count_test] != Full_Optimization
) ) then
345 if ( ! -d $SAVE_DIR ) then
346 echo $SAVE_DIR does not exist
for BASELINE comparison
, stopping
349 else if ( ( $BASELINE == COMPARE
) && ( $tests[$count_test] == Full_Optimization
) ) then
350 echo No comparison
done with baseline since this is an optimized run
354 # Build the short edit input script for ed and edit the regtest.csh file.
356 set OLDT
= `echo $OLD_TEXT[$count_test] | sed 's/=/ = /'`
357 set NEWT
= `echo $NEW_TEXT[$count_test] | sed 's/=/ = /'`
359 if ( $tests[$count_test] == "NMM_Nest" ) then
360 cp regtest_nmmnest.csh reg.foo.
$TEST_NUM[$count_test].
$tests[$count_test]
362 if ( ( $BASELINE == RUN_ONLY
) ||
( $tests[$count_test] == Full_Optimization
) ) then
363 if ( -e ed.
in ) rm ed.
in
366 ,s/1 2 3 4 5 6 7 8 9 10 11 12 13 14/1 2 3 4 5 6 7 8 9 10 11 12/
367 w reg.foo.$TEST_NUM[$count_test].$tests[$count_test]
370 else if ( $BASELINE == GENERATE
) then
371 if ( -e ed.
in ) rm ed.
in
374 ,s/1 2 3 4 5 6 7 8 9 10 11 12 13 14/1 2 3 4 5 6 7 8 9 10 11 12/
375 ,s?GENERATE_BASELINE = FALSE?GENERATE_BASELINE = $SAVE_DIR?
376 w reg.foo.$TEST_NUM[$count_test].$tests[$count_test]
379 else if ( $BASELINE == COMPARE
) then
380 if ( -e ed.
in ) rm ed.
in
383 ,s/1 2 3 4 5 6 7 8 9 10 11 12 13 14/1 2 3 4 5 6 7 8 9 10 11 12/
384 ,s?COMPARE_BASELINE = FALSE?COMPARE_BASELINE = $SAVE_DIR?
385 w reg.foo.$TEST_NUM[$count_test].$tests[$count_test]
389 ed regtest.csh
< ed_in
>& /dev
/null
391 chmod +x reg.foo.
$TEST_NUM[$count_test].
$tests[$count_test]
393 # On AIX, we submit jobs to the load leveler queue for bluesky and to the LSF queue for
394 # bluevista. After submission, we wait around until it completes, and then we send in
397 if ( ( `uname` == AIX
) && ( `hostname | cut -c 1-2` == bs
) ) then
398 llsubmit reg.foo.
$TEST_NUM[$count_test].
$tests[$count_test] >&! llsub.out
402 sleep 10 ; llq
-u $USER >&! llq.report
403 grep `cat llsub.out | grep '"bs1' | cut -d\" -f2` llq.report
>& /dev
/null
405 if ( ( $ok == 0 ) && ( $in_already == 0 ) ) then
407 set joe_id
= `cat llsub.out | grep '"bs1' | cut -d\" -f2 | cut -d. -f2`
410 cp /ptmp
/$USER/wrf_regression.
$joe_id/wrftest.output wrftest.output.
$TEST_NUM[$count_test].
$tests[$count_test]
411 rm llsub.out llq.report
412 else if ( ( `uname` == AIX
) && ( ( `hostname | cut -c 1-2` == bv
) ||
( `hostname | cut -c 1-2` == be
) ) ) then
413 bsub
< reg.foo.
$TEST_NUM[$count_test].
$tests[$count_test] >&! bsub.out
417 sleep 10 ; bjobs
>&! bjobs.report
418 grep `cat bsub.out | grep Job | cut -d"<" -f2 | cut -d">" -f1` bjobs.report
>& /dev
/null
420 if ( ( $ok == 0 ) && ( $in_already == 0 ) ) then
422 set joe_id
= `cat bsub.out | grep Job | cut -d"<" -f2 | cut -d">" -f1`
425 cp /ptmp
/$USER/wrf_regression.
$joe_id/wrftest.output wrftest.output.
$TEST_NUM[$count_test].
$tests[$count_test]
426 rm bsub.out bjobs.report
427 else if ( ( `uname` == AIX
) && ( ( `hostname | cut -c 1-2` != bs
) && \
428 ( `hostname | cut -c 1-2` != bv
) && ( `hostname | cut -c 1-2` != be
) ) ) then
429 llsubmit reg.foo.
$TEST_NUM[$count_test].
$tests[$count_test] >&! llsub.out
433 sleep 10 ; llq
-u $USER >&! llq.report
434 set llsubmit_name_all
= `cat llsub.out | grep '"b' | cut -d\" -f2`
435 set llsubmit_name_front
= `echo $llsubmit_name_all | cut -d\. -f1`
436 set llsubmit_name_end
= `echo $llsubmit_name_all | cut -d\. -f5`
437 grep $llsubmit_name_front llq.report |
grep $llsubmit_name_end >& /dev
/null
439 if ( ( $ok == 0 ) && ( $in_already == 0 ) ) then
441 set joe_id
= `cat llsub.out | grep '"b' | cut -d\" -f2 | cut -d. -f5`
444 cp /ptmp
/$USER/wrf_regression.
$joe_id/wrftest.output wrftest.output.
$TEST_NUM[$count_test].
$tests[$count_test]
445 rm llsub.out llq.report
447 # On the "other" non-queued machines, we just execute the script and wait until
448 # we get the process returning control, then we move on.
451 reg.foo.
$TEST_NUM[$count_test].
$tests[$count_test] -f wrf.
tar >&! output.
$TEST_NUM[$count_test].
$tests[$count_test]
452 mv wrf_regression
/wrftest.output wrftest.output.
$TEST_NUM[$count_test].
$tests[$count_test]
453 if ( -d wrf_regression
) then
454 mv wrf_regression wrf_regression.
$TEST_NUM[$count_test].
$tests[$count_test]
460 if ( ( `uname` == AIX
) && ( ( `hostname | cut -c 1-2` != bs
) && \
461 ( `hostname | cut -c 1-2` != bv
) && ( `hostname | cut -c 1-2` != be
) ) ) then
462 echo no web page building
, stopping
468 # Build the html page. We only need the middle portion. It's
469 # a table with 5 columns: Date of test, WRFV3 tag, Developer
470 # who conducted the test, machine the test was run on, and the
471 # pass/fail status of the all_reg.csh script when compared
472 # to the benchmark results (usually a released code).
474 cat >! history_middle_OK.html
<< EOF
479 <td> XARCHITECTUREX </td>
480 <td BGCOLOR="#00FF00"><a href="ARCHITECTURE/wrftest.all_${datehms}">PASS</a>
481 <a href="ARCHITECTURE/message_${datehms}">DIFFS</a></td>
484 <a href="other_docs/${date}_notes">Descriptions</a>
485 <a href="other_docs/${date}_minutes">Minutes</a>
491 cat >! history_middle_OOPS.html
<< EOF
496 <td> XARCHITECTUREX </td>
497 <td BGCOLOR="#FF0000"><a href="ARCHITECTURE/wrftest.all_${datehms}">FAIL</a>
498 <a href="ARCHITECTURE/message_${datehms}">DIFFS</a></td>
501 <a href="other_docs/${date}_notes">Descriptions</a>
502 <a href="other_docs/${date}_minutes">Minutes</a>
510 ,s/ARCHITECTURE/${name}/g
511 w history_middle.html
515 # Get all of the wrftest.output.* files in one BIG file.
517 if ( -e wrftest.all_
$datehms ) rm wrftest.all_
$datehms
518 cat wrftest.output.?.
* wrftest.output.??.
* >>! wrftest.all_
$datehms
519 if ( -d `uname` ) rm -rf `uname`
521 mv wrftest.all_
$datehms `uname`
523 # Compare regression PASS/FAILs with previous runs.
525 pushd ~gill
/RESULTS
/`uname`
526 grep FAIL wrftest.output.
* >! ${starting_dir}/PREV.FAILS
528 grep FAIL wrftest.output.
* >! CURR.FAILS
529 echo Comparison of regression results on
`hostname` for `date` >! message
530 echo "==================================================================" >> message
532 echo "Previous FAILs" >> message
533 echo "==================" >> message
535 cat PREV.FAILS
>> message
537 echo "Current FAILs" >> message
538 echo "==================" >> message
540 cat CURR.FAILS
>> message
542 echo "Difference of FAILs" >> message
543 echo "==================" >> message
545 cat CURR.FAILS |
grep -vi baseline
>! CURR2.FAILS
546 diff PREV.FAILS CURR2.FAILS
>! diffs
550 cp message message_
$datehms
551 mv message_
$datehms `uname`
553 # Send out status info on the regression test.
557 if ( $#argv != 0 ) then
563 if ( ( $NUMARGS == 0 ) ||
( $ARG1 == PASSFAIL
) || \
564 ( ( $ARG1 == COMPARE
) && ( $NUMARGS == 1 ) ) || \
565 ( ( $ARG1 == GENERATE
) && ( $NUMARGS == 1 ) ) ) then
567 Mail
-s "REG DIFFS $OS" ${user}@ucar.edu
< message
569 echo "Different FAILS from before for $OS - repository may have been broken"
571 m4 -DXDATEX=${dateh} -DXTAGX=${TAG} -DXTESTERX=${user} -DXARCHITECTUREX=`uname` \
572 history_middle_OOPS.html
>! history_middle_1.html
573 else if ( $ok == 0 ) then
574 Mail
-s "REG OK $OS" ${user}@ucar.edu
< message
576 echo "Same FAILS as before for $OS - repository OK"
578 m4 -DXDATEX=${dateh} -DXTAGX=${TAG} -DXTESTERX=${user} -DXARCHITECTUREX=`uname` \
579 history_middle_OK.html
>! history_middle_1.html
582 # Store on the NCAR MSS system to circumvent security.
584 ed history_middle_1.html
< ed2.
in >& /dev
/null
585 tar -cf `uname`_hist.
tar history_middle.html
`uname`
586 echo Storing info on NCAR MSS
587 msrcp
`uname`_hist.
tar mss
:/GILL
/ALLREG
/`uname`_hist.
tar
588 if ( -e `uname`_NEW
) rm `uname`_NEW
589 echo "`uname` `date`" >! `uname`_NEW
590 msrcp
`uname`_NEW mss
:/GILL
/ALLREG
/`uname`_NEW
593 rm ed_in
>& /dev
/null
594 rm io_format
>& /dev
/null
595 rm PREV.FAILS CURR.FAILS CURR2.FAILS message diffs
>& /dev
/null
596 rm history_middle_OOPS.html history_middle_OK.html history_middle_1.html history_middle.html
>& /dev
/null
597 rm `uname`_hist.
tar `uname`_NEW ed2.
in >& /dev
/null
598 rm -rf `uname` >& /dev
/null