forked from davegill/wrf-coop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.csh
executable file
·976 lines (913 loc) · 48.2 KB
/
build.csh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
#!/bin/csh
# Choose which scripts to manufacture
set TEST_GEN = ALL
set TEST_GEN = TEST
set TEST_GEN = SOME
# How many procs do we play with: used for parallel build, openmp threads, mpi ranks
set PROCS = 8
# Sequential jobs, or all independent. Basically, do we remove the images?
set JOB = SEQUENTIAL
set JOB = INDEPENDENT
# Only input arg is the location where the OUTPUT (shared) volume for
# docker should be located.
if ( ${#argv} == 2 ) then
set DROPIT = $1
set SHARED = $2
if ( ! -d $SHARED ) then
echo " "
echo "Usage: $0 _directory_"
echo "where _directory_ is full path to where the OUTPUT directory will exist, or does exist"
echo "_directory_/OUTPUT is the host-machine's shared volume location that docker will use"
echo The '"'$SHARED'"' directory does not exist
echo " "
exit ( 1 )
else if ( `echo $SHARED | cut -c 1` != "/" ) then
echo " "
echo "Usage: $0 _directory_"
echo "where _directory_ is full path to where the OUTPUT directory will exist, or does exist"
echo "_directory_/OUTPUT is the host-machine's shared volume location that docker will use"
echo The '"'$SHARED'"' directory is not an absolute path to a directory
echo " "
exit ( 2 )
endif
endif
if ( ${#argv} == 0 ) then
echo " "
echo "Usage: $0 _dir_drop_ _dir_out_"
echo "1. where _dir_drop_ is full path to where the RUN file will be placed"
echo "2. where _dir_out_ is full path to where the OUTPUT directory will exist, or does exist"
echo "example: _dir_out_/OUTPUT is the host-machine's shared volume location that docker will use"
echo " "
exit ( 3 )
endif
if ( $TEST_GEN == ALL ) then
set NUMBER = ( 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 )
set TEST = ( \
"em_real 3dtke cesm conus rap tropical " \
"em_chem 1 2 5 " \
"em_quarter_ss 02 02NE 03 03NE 04 04NE 05 05NE 06 06NE 08 09 10 11NE 12NE 13NE 14NE " \
"em_b_wave 1 1NE 2 2NE 3 3NE 4 4NE 5 5NE " \
"em_real8 14 16 17 17AD 18 38 78 79" \
"em_quarter_ss8 02 03 04 05 06 08 09 10 " \
"em_move 01 02 " \
"em_fire 01 " \
"em_hill2d_x 01 " \
"em_realA 03 03DF 03FD 06 07NE " \
"em_realB 10 11 14 16 16DF " \
"em_realC 17 17AD 18 20 20NE " \
"em_realD 38 48 49 50 51 " \
"em_realE 52 52DF 52FD 60 60NE " \
"em_realF 65DF 66FD 71 78 79 " \
"em_realG kiaps1NE kiaps2 rala ralbNE " \
"em_realH cmt fsbm solaraNE solarb urb3aNE urb3bNE " \
"em_chem_kpp 101 107 120 201 " \
"nmm_hwrf 1NE 2NE 3NE 4 " \
)
else if ( $TEST_GEN == SOME ) then
set NUMBER = ( 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 )
set TEST = ( \
"em_real 3dtke conus rap tropical " \
"em_chem 1 2 5 " \
"em_quarter_ss 02NE 03 03NE 04 " \
"em_b_wave 1NE 2 2NE 3 " \
"em_real8 14 17AD " \
"em_quarter_ss8 06 08 09 " \
"em_move 01 " \
"em_fire 01 " \
"em_hill2d_x 01 " \
"em_realA 03 03DF 03FD 06 07NE " \
"em_realB 10 11 14 16 " \
"em_realC 17 17AD 18 20 20NE " \
"em_realD 38 48 49 50 51 " \
"em_realE 52 52DF 52FD 60 60NE " \
"em_realF 65DF 66FD 71 78 79 " \
"em_realG kiaps1NE kiaps2 " \
"em_realH cmt solaraNE urb3bNE " \
"em_chem_kpp 120 " \
"nmm_hwrf 1NE 2NE 3NE " \
)
else if ( $TEST_GEN == test ) then
set NUMBER = ( 01 02 ) # Logic is not set up to choose random (out of order) options
set NUMBER = ( 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 )
set TEST = ( \
"em_real conus " \
"em_chem 1 " \
"em_quarter_ss 02 " \
"em_b_wave 1 " \
"em_real8 14 " \
"em_quarter_ss8 02 " \
"em_move 01 " \
"em_fire 01 " \
"em_hill2d_x 01 " \
"em_realA 03 " \
"em_realB 10 " \
"em_realC 17 " \
"em_realD 38 " \
"em_realE 52 " \
"em_realF 65DF " \
"em_realG cmt " \
"em_realH fsbm " \
"em_chem_kpp 120 " \
"nmm_hwrf 1NE " \
)
set TEST = ( \
"em_real fail_test fail_comparison " \
"em_chem 1 " \
"em_quarter_ss 02 " \
"em_b_wave 1 " \
"em_real8 14 " \
"em_quarter_ss8 02 " \
"em_move 01 " \
"em_fire 01 " \
"em_hill2d_x 01 " \
"em_realA 03 " \
"em_realB 10 " \
"em_realC 17 " \
"em_realD 38 " \
"em_realE 52 " \
"em_realF 65DF " \
"em_realG cmt " \
"em_realH fsbm " \
"em_chem_kpp 120 " \
"nmm_hwrf 1NE " \
)
endif
# Options that are used for all test generation settings.
set SERIAL = ( T T T T T T F T T T T T T T T T T T F )
set OPENMP = ( T F T T T T F T F T T T T T T T F F F )
set MPI = ( T T T T T T T T F T T T T T T T T T T )
set NEST = ( 1 1 1 1 1 1 3 1 0 1 1 1 1 1 1 1 1 1 3 )
set NAME = ( em chem qss bwave real8 qss8 move fire hill em em em em em em em em kpp hwrf )
set COMPILE = ( em_real em_real em_quarter_ss em_b_wave em_real em_quarter_ss em_real em_fire em_hill2d_x em_real em_real em_real em_real em_real em_real em_real em_real em_real nmm_real )
set RUNDIR = ( em_real em_chem em_quarter_ss em_b_wave em_real8 em_quarter_ss8 em_move em_fire em_hill2d_x em_realA em_realB em_realC em_realD em_realE em_realF em_realG em_realH em_chem_kpp nmm_hwrf )
set DASHOPT1 = ( -d -d -d -d -d -d -d -d -d -d -d -d -d -d -d -d -d -d -d )
set DASHOPT2 = ( F F F F -r8 -r8 F F F F F F F F F F F F F )
set BUILDENV1 = ( F WRF_CHEM=1 F F F F F F F F F F F F F F F WRF_CHEM=1 WRF_NMM_CORE=1 )
set BUILDENV2 = ( J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS J=-j@$PROCS )
set BUILDENV3 = ( F F F F F F F F F F F F F F F F F WRF_KPP=1 HWRF=1 )
set BUILDENV4 = ( F F F F F F F F F F F F F F F F F FLEX_LIB_DIR=/usr/lib64 F )
set BUILDENV5 = ( F F F F F F F F F F F F F F F F F YACC=/usr/bin/yacc@-d F )
#set SERIALBG = ( T F T T T T F F F T T T T T T T T F F )
set SERIALBG = ( F F F F F F F F F F F F F F F F F F F )
set NP = ( $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS $PROCS )
set SERIAL_OPT = 32
set OPENMP_OPT = 33
set MPI_OPT = 34
# Info to determine if we eventually accomplish what we originally intended.
set NUM_TESTS = ${#TEST}
set NUM_BUILDS = 0
set count = 0
while ( $count < $NUM_TESTS )
@ count ++
if ( $SERIAL[$count] == T ) @ NUM_BUILDS ++
if ( $OPENMP[$count] == T ) @ NUM_BUILDS ++
if ( $MPI[$count] == T ) @ NUM_BUILDS ++
end
set NUM_COMPARISONS = 0
set count = 0
while ( $count < $NUM_TESTS )
@ count ++
if ( ( $SERIAL[$count] == T ) && ( $OPENMP[$count] == T ) ) then
set temp = `echo $TEST[$count] | wc -w`
@ temp --
@ NUM_COMPARISONS = $NUM_COMPARISONS + $temp
endif
if ( ( $SERIAL[$count] == T ) && ( $MPI[$count] == T ) ) then
set temp = `echo $TEST[$count] | wc -w`
@ temp --
@ NUM_COMPARISONS = $NUM_COMPARISONS + $temp
endif
end
set NUM_SIMS = 0
set count = 0
while ( $count < $NUM_TESTS )
@ count ++
if ( $SERIAL[$count] == T ) then
set temp = `echo $TEST[$count] | wc -w`
@ temp --
@ NUM_SIMS = $NUM_SIMS + $temp
endif
if ( $OPENMP[$count] == T ) then
set temp = `echo $TEST[$count] | wc -w`
@ temp --
@ NUM_SIMS = $NUM_SIMS + $temp
endif
if ( $MPI[$count] == T ) then
set temp = `echo $TEST[$count] | wc -w`
@ temp --
@ NUM_SIMS = $NUM_SIMS + $temp
endif
end
echo " " > email_01.txt
echo " WRF Scala Jenkins AWS Automated GitHub Testing " >> email_01.txt
echo " ============================================== " >> email_01.txt
echo " Number of Tests : $NUM_TESTS " >> email_01.txt
echo " Number of Builds : $NUM_BUILDS " >> email_01.txt
echo " Number of Simulations : $NUM_SIMS " >> email_01.txt
echo " Number of Comparisons : $NUM_COMPARISONS " >> email_01.txt
echo " " >> email_01.txt
echo " 1. Download wrf_output.zip " >> email_01.txt
echo " " >> email_01.txt
echo " 2. Remove previous output_testcase directory " >> email_01.txt
echo " " >> email_01.txt
echo " 3. Decompress file: " >> email_01.txt
echo " unzip wrf_output.zip " >> email_01.txt
echo " " >> email_01.txt
echo " 4. Go to output_testcase directory " >> email_01.txt
echo " " >> email_01.txt
echo " 5. Check files for Number of Tests " >> email_01.txt
echo ' ls -1 | grep output_ | wc -l ' >> email_01.txt
echo " " >> email_01.txt
echo " 6. Check files for Number of Builds " >> email_01.txt
echo ' grep -a " START" output_* | grep -av "CLEAN START" | grep -av "SIMULATION START" | grep -av "LOG START" | wc -l ' >> email_01.txt
echo " " >> email_01.txt
echo ' 7. Check files for Number of Executables (2 * # Builds) ' >> email_01.txt
echo ' grep -aw wrfuser output_* | grep -aw wrf | grep -a "WRF/main/" | grep -a ".exe" | wc -l' >> email_01.txt
echo " " >> email_01.txt
echo " 8. Check files for Number of Simulations " >> email_01.txt
echo ' grep -a " = STATUS" output_* | wc -l ' >> email_01.txt
echo " " >> email_01.txt
echo " 9. Number of FAILed Simulations (should = 0) " >> email_01.txt
echo ' grep -a " = STATUS" output_* | grep -av "0 = STATUS" | wc -l ' >> email_01.txt
echo " If there is a FAILed Simulation, which FAILed? " >> email_01.txt
echo ' grep -a " = STATUS" output_* | grep -av "0 = STATUS" ' >> email_01.txt
echo " What are the namelist / IC specifics of a FAILed case? " >> email_01.txt
echo " wget https://www2.mmm.ucar.edu/wrf/dave/nml.tar.gz " >> email_01.txt
echo " wget https://www2.mmm.ucar.edu/wrf/dave/data_smaller.tar.gz " >> email_01.txt
echo " " >> email_01.txt
echo "10. Check files for Number of Comparisons " >> email_01.txt
echo ' grep -a "status = " output_* | wc -l ' >> email_01.txt
echo " " >> email_01.txt
echo "11. Number of Comparisons not bit-for-bit (should = 0) " >> email_01.txt
echo ' grep -a "status = " output_* | grep -av "status = 0" | wc -l ' >> email_01.txt
echo " If there is a FAILed bit-for bit, which FAILed? " >> email_01.txt
echo ' grep -a "status = " output_* | grep -av "status = 0" ' >> email_01.txt
echo " " >> email_01.txt
# The docker image needs to be constructed.
if ( -e single_init.csh ) rm single_init.csh
touch single_init.csh
chmod +x single_init.csh
echo '#\!/bin/csh' >> single_init.csh
echo "##################### TOP OF JOB #####################" >> single_init.csh
echo "" >> single_init.csh
echo "# This script builds the docker image for the rest of the testing harness " >> single_init.csh
echo "" >> single_init.csh
echo "# The mandatory input argument is the name of the Dockerfile" >> single_init.csh
echo '# If the name is "Dockerfile", the ARW code is run' >> single_init.csh
echo '# If the name is "Dockerfile-NMM", the HWRF code is run' >> single_init.csh
echo "" >> single_init.csh
echo "date" >> single_init.csh
echo "set SHARED = $SHARED" >> single_init.csh
echo 'if ( ! -d ${SHARED}/OUTPUT ) mkdir ${SHARED}/OUTPUT' >> single_init.csh
echo 'chmod -R 777 ${SHARED}/OUTPUT' >> single_init.csh
echo "" >> single_init.csh
echo "date" >> single_init.csh
echo 'set num_containers = `docker ps -a | wc -l`' >> single_init.csh
echo 'if ( $num_containers > 1 ) then' >> single_init.csh
echo ' set hash = `docker ps -a | sed -n 2,${num_containers}p | ' "awk '{print " '$1}' "'" '`' >> single_init.csh
echo ' docker rm $hash' >> single_init.csh
echo "endif" >> single_init.csh
echo "" >> single_init.csh
echo 'set num_images = `docker images | wc -l`' >> single_init.csh
echo 'if ( $num_images > 1 ) then' >> single_init.csh
echo ' set hash = `docker images | sed -n 2,${num_images}p | ' "awk '{print " '$3}' "'" '`' >> single_init.csh
echo ' docker rmi --force $hash' >> single_init.csh
echo "endif" >> single_init.csh
echo "" >> single_init.csh
echo "date" >> single_init.csh
echo "if ( -d ${DROPIT}/Namelists ) then" >> single_init.csh
echo " cp -pr ${DROPIT}/Namelists ." >> single_init.csh
echo " tar -cf nml.tar Namelists" >> single_init.csh
echo " sed -e 's/#ADD/ADD/' Dockerfile > .foo" >> single_init.csh
echo " mv .foo Dockerfile" >> single_init.csh
echo " sed -e 's/#ADD/ADD/' Dockerfile-NMM > .foo" >> single_init.csh
echo " mv .foo Dockerfile-NMM" >> single_init.csh
echo "endif" >> single_init.csh
echo "" >> single_init.csh
echo '# -f $1 = name of the Dockerfile' >> single_init.csh
echo '# -t $2 = name of the generated docker image' >> single_init.csh
echo "" >> single_init.csh
echo 'docker build -f $1 -t $2 --build-arg argname=feature_tests .' >> single_init.csh
echo "date" >> single_init.csh
echo "" >> single_init.csh
echo "##################### END OF JOB #####################" >> single_init.csh
echo "Run ./single_init.csh"
# The docker image needs to be removed
if ( -e single_end.csh ) rm single_end.csh
touch single_end.csh
chmod +x single_end.csh
echo '#\!/bin/csh' >> single_end.csh
echo "##################### TOP OF JOB #####################" >> single_end.csh
echo "" >> single_end.csh
echo "# This script removes the docker image and" >> single_end.csh
echo "# does some seasonal pruning" >> single_end.csh
echo "" >> single_end.csh
echo "date" >> single_end.csh
echo 'docker rmi $1' >> single_end.csh
echo "set hash = "'`'"docker images | grep davegill | awk '{print " '$3' "}'" ' `' >> single_end.csh
echo 'docker rmi --force $hash' >> single_end.csh
echo "docker volume prune -f" >> single_end.csh
echo "docker system df" >> single_end.csh
echo "date" >> single_end.csh
echo "" >> single_end.csh
echo "##################### END OF JOB #####################" >> single_end.csh
# Build each of the scripts: serial, openmp, then mpi.
set COUNT = 1
foreach n ( $NUMBER )
foreach p ( SERIAL OPENMP MPI )
set string = ( docker exec )
if ( $p == SERIAL ) then
if ( ( $SERIAL[$COUNT] == T ) && ( $SERIALBG[$COUNT] == T ) ) then
set test_suffix = s
set fname = test_0${n}${test_suffix}.csh
if ( -e $fname ) rm $fname
touch $fname
chmod +x $fname
echo "Run ./$fname"
echo '#\!/bin/csh' >> $fname
echo "##################### TOP OF JOB #####################" >> $fname
echo "touch $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "echo TEST CASE = test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "set SHARED = $SHARED" >> $fname
echo "# Build: case = $NAME[$COUNT], SERIAL" >> $fname
set string = ( $string '$test' ./script.csh BUILD CLEAN $SERIAL_OPT $NEST[$COUNT] $COMPILE[$COUNT] )
if ( "$DASHOPT1[$COUNT]" == "F" ) then
set str = ""
else
set str = $DASHOPT1[$COUNT]
endif
if ( "$DASHOPT2[$COUNT]" != "F" ) then
set str = ( $str $DASHOPT2[$COUNT] )
endif
set string = ( $string $str )
if ( $BUILDENV1[$COUNT] == F ) then
set str = ""
else
set str = $BUILDENV1[$COUNT]
endif
set string = ( $string $str )
echo "set TCOUNT = 1" >> $fname
echo "foreach t ( $TEST[$COUNT] )" >> $fname
echo " set test = test_0${n}${test_suffix}"'_$t' >> $fname
echo " date" >> $fname
echo ' if ( $TCOUNT == 1 ) ' "goto aSKIP_test_0${n}${test_suffix}" >> $fname
echo " date" >> $fname
echo " echo Build container for" '$test' >> $fname
if ( $n == 19 ) then
echo " #docker run -it --name" '$test -v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest /bin/tcsh' >> $fname
echo " #docker exec -it " '$test /bin/tcsh' >> $fname
echo " #docker start -ai " '$test' >> $fname
echo " docker run -d -t --name" '$test -v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest' >> $fname
else
echo " #docker run -it --name" '$test -v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest /bin/tcsh' >> $fname
echo " #docker exec -it " '$test /bin/tcsh' >> $fname
echo " #docker start -ai " '$test' >> $fname
echo " docker run -d -t --name" '$test -v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest' >> $fname
endif
echo " date" >> $fname
echo " echo Build WRF executable for" '$test' >> $fname
echo " ( $string"' ) &' >> $fname
echo " date" >> $fname
echo "aSKIP_test_0${n}${test_suffix}:" >> $fname
echo ' @ TCOUNT ++' >> $fname
echo "end" >> $fname
echo "date" >> $fname
echo "echo waiting on BUILDs" >> $fname
echo "wait" >> $fname
echo "date" >> $fname
echo "set TCOUNT = 1" >> $fname
echo "foreach t ( $TEST[$COUNT] )" >> $fname
echo " set test = test_0${n}${test_suffix}"'_$t' >> $fname
echo " date" >> $fname
echo ' if ( $TCOUNT == 1 ) ' "goto bSKIP_test_0${n}${test_suffix}" >> $fname
echo " date" >> $fname
echo " echo '======================================================================'" >> $fname
echo " echo RUN WRF" '$test' "for $COMPILE[$COUNT] $SERIAL_OPT $RUNDIR[$COUNT], NML = " '$t' >> $fname
echo " ( docker exec" '$test' "./script.csh RUN $COMPILE[$COUNT] $SERIAL_OPT $RUNDIR[$COUNT]" '$t ) &' >> $fname
echo "bSKIP_test_0${n}${test_suffix}:" >> $fname
echo ' @ TCOUNT ++' >> $fname
echo "end" >> $fname
echo "date" >> $fname
echo "echo waiting on RUNs" >> $fname
echo "wait" >> $fname
echo "date" >> $fname
echo "set TCOUNT = 1" >> $fname
echo "foreach t ( $TEST[$COUNT] )" >> $fname
echo " set test = test_0${n}${test_suffix}"'_$t' >> $fname
echo ' if ( $TCOUNT == 1 ) ' "goto cSKIP_test_0${n}${test_suffix}" >> $fname
echo " date" >> $fname
echo " docker exec" '$test ls -ls WRF/main/wrf.exe' >> $fname
echo ' set OK_WRF = $status' >> $fname
if ( $COMPILE[$COUNT] == nmm_real ) then
echo " docker exec" '$test ls -ls WRF/main/real_nmm.exe' >> $fname
echo ' set OK_PRE = $status' >> $fname
else if ( $COMPILE[$COUNT] == em_real ) then
echo " docker exec" '$test ls -ls WRF/main/real.exe' >> $fname
echo ' set OK_PRE = $status' >> $fname
else
echo " docker exec" '$test ls -ls WRF/main/ideal.exe' >> $fname
echo ' set OK_PRE = $status' >> $fname
endif
echo ' if ( ( $OK_WRF == 0 ) && ( $OK_PRE == 0 ) && ( $TCOUNT == 2 ) ) then' >> $fname
echo ' echo "SUCCESSFUL BUILD"' >> $fname
echo " docker exec" '$test' "ls -ls wrfoutput | grep _BUILD_ | grep $COMPILE[$COUNT]_${SERIAL_OPT} " >> $fname
echo ' else if ( $TCOUNT == 2 ) then' >> $fname
echo ' echo "FAILED BUILD LOG START"' >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/compile.log.$COMPILE[$COUNT].${SERIAL_OPT}" >> $fname
echo ' echo "FAILED BUILD LOG END"' >> $fname
echo ' endif' >> $fname
echo " date" >> $fname
echo " echo 'PRE-PROC OUTPUT' " >> $fname
echo " docker exec" '$test' "cat WRF/test/$COMPILE[$COUNT]/real.print.out " >> $fname
echo " echo 'MODEL OUTPUT' " >> $fname
echo " docker exec" '$test' "cat WRF/test/$COMPILE[$COUNT]/wrf.print.out " >> $fname
echo " " >> $fname
echo " docker exec" '$test' "ls -ls WRF/test/$COMPILE[$COUNT] | grep wrfout " >> $fname
echo " docker exec" '$test' "ls -ls wrfoutput | grep _RUN_ | grep $COMPILE[$COUNT]_${SERIAL_OPT}_$RUNDIR[$COUNT]_"'$t ' >> $fname
echo " " >> $fname
echo " docker stop" '$test' >> $fname
echo " date" >> $fname
echo " docker rm" '$test' >> $fname
echo " date" >> $fname
echo "cSKIP_test_0${n}${test_suffix}:" >> $fname
echo ' @ TCOUNT ++' >> $fname
echo "end" >> $fname
echo "date" >> $fname
echo "touch $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "mv $DROPIT/DOING_NOW_test_0${n}${test_suffix} $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "##################### END OF JOB #####################" >> $fname
else if ( ( $SERIAL[$COUNT] == T ) && ( $SERIALBG[$COUNT] == F ) ) then
set test_suffix = s
set fname = test_0${n}${test_suffix}.csh
if ( -e $fname ) rm $fname
touch $fname
chmod +x $fname
echo "Run ./$fname"
echo '#\!/bin/csh' >> $fname
echo "##################### TOP OF JOB #####################" >> $fname
echo "touch $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "echo TEST CASE = test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "set SHARED = $SHARED" >> $fname
echo "# Build: case = $NAME[$COUNT], SERIAL" >> $fname
set string = ( $string test_0${n}${test_suffix} ./script.csh BUILD CLEAN $SERIAL_OPT $NEST[$COUNT] $COMPILE[$COUNT] )
if ( "$DASHOPT1[$COUNT]" == "F" ) then
set str = ""
else
set str = $DASHOPT1[$COUNT]
endif
if ( "$DASHOPT2[$COUNT]" != "F" ) then
set str = ( $str $DASHOPT2[$COUNT] )
endif
set string = ( $string $str )
if ( $BUILDENV1[$COUNT] == F ) then
set str = ""
else
set str = $BUILDENV1[$COUNT]
endif
if ( $BUILDENV2[$COUNT] != F ) then
set str = ( $str $BUILDENV2[$COUNT] )
endif
if ( $BUILDENV3[$COUNT] != F ) then
set str = ( $str $BUILDENV3[$COUNT] )
endif
if ( $BUILDENV4[$COUNT] != F ) then
set str = ( $str $BUILDENV4[$COUNT] )
endif
if ( $BUILDENV5[$COUNT] != F ) then
set str = ( $str $BUILDENV5[$COUNT] )
endif
set string = ( $string $str )
echo "echo Build container" >> $fname
if ( $n == 19 ) then
echo "#docker run -it --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest /bin/tcsh' >> $fname
echo "#docker exec -it test_0${n}${test_suffix} /bin/tcsh" >> $fname
echo "#docker start -ai test_0${n}${test_suffix}" >> $fname
echo "docker run -d -t --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest' >> $fname
else
echo "#docker run -it --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest /bin/tcsh' >> $fname
echo "#docker exec -it test_0${n}${test_suffix} /bin/tcsh" >> $fname
echo "#docker start -ai test_0${n}${test_suffix}" >> $fname
echo "docker run -d -t --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest' >> $fname
endif
echo "date" >> $fname
echo "echo Build WRF executable" >> $fname
echo $string >> $fname
echo "date" >> $fname
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/wrf.exe" >> $fname
echo 'set OK_WRF = $status' >> $fname
if ( $COMPILE[$COUNT] == nmm_real ) then
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/real_nmm.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
else if ( $COMPILE[$COUNT] == em_real ) then
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/real.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
else
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/ideal.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
endif
echo 'if ( ( $OK_WRF == 0 ) && ( $OK_PRE == 0 ) ) then' >> $fname
echo ' echo "SUCCESSFUL BUILD"' >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls wrfoutput | grep _BUILD_ | grep $COMPILE[$COUNT]_${SERIAL_OPT} " >> $fname
echo 'else' >> $fname
echo ' echo "FAILED BUILD LOG START"' >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/compile.log.$COMPILE[$COUNT].${SERIAL_OPT}" >> $fname
echo ' echo "FAILED BUILD LOG END"' >> $fname
echo 'endif' >> $fname
echo "date" >> $fname
echo " " >> $fname
set D = $DROPIT/Namelists/weekly/$RUNDIR[$COUNT]
if ( -d $D ) then
find $D -name namelist.input\* -exec ls -1 {} \; >& .foo1
set EXTRAS = `cat .foo1 | sed 's/^.*\.//' | sort -u`
rm .foo1
else
set EXTRAS = " "
endif
echo "set TCOUNT = 1" >> $fname
echo "foreach t ( $TEST[$COUNT] $EXTRAS )" >> $fname
echo " date" >> $fname
echo ' if ( $TCOUNT == 1 ) ' "goto SKIP_test_0${n}${test_suffix}" >> $fname
echo " echo '======================================================================'" >> $fname
echo " echo RUN WRF test_0${n}${test_suffix} for $COMPILE[$COUNT] $SERIAL_OPT $RUNDIR[$COUNT], NML = " '$t' >> $fname
echo " docker exec test_0${n}${test_suffix} ./script.csh RUN $COMPILE[$COUNT] $SERIAL_OPT $RUNDIR[$COUNT]" '$t' >> $fname
echo ' set OK = $status' >> $fname
echo ' echo $OK =' "STATUS test_0${n}${test_suffix} $NAME[$COUNT] $COMPILE[$COUNT] $SERIAL_OPT" '$t' >> $fname
echo " date" >> $fname
echo " " >> $fname
echo " echo 'PRE-PROC OUTPUT' " >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/test/$COMPILE[$COUNT]/real.print.out " >> $fname
echo " echo 'MODEL OUTPUT' " >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/test/$COMPILE[$COUNT]/wrf.print.out " >> $fname
echo " " >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls WRF/test/$COMPILE[$COUNT] | grep wrfout " >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls wrfoutput | grep _RUN_ | grep $COMPILE[$COUNT]_${SERIAL_OPT}_$RUNDIR[$COUNT]_"'$t ' >> $fname
echo " date" >> $fname
echo "SKIP_test_0${n}${test_suffix}:" >> $fname
echo ' @ TCOUNT ++' >> $fname
echo "end" >> $fname
echo "date" >> $fname
echo "docker stop test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "docker rm test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "touch $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "mv $DROPIT/DOING_NOW_test_0${n}${test_suffix} $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "##################### END OF JOB #####################" >> $fname
else
goto SKIP_THIS_ONE
endif
else if ( $p == OPENMP ) then
if ( $OPENMP[$COUNT] == T ) then
set test_suffix = o
set fname = test_0${n}${test_suffix}.csh
if ( -e $fname ) rm $fname
touch $fname
chmod +x $fname
echo "Run ./$fname"
echo '#\!/bin/csh' >> $fname
echo "##################### TOP OF JOB #####################" >> $fname
echo "touch $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "echo TEST CASE = test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "set SHARED = $SHARED" >> $fname
echo "# Build: case = $NAME[$COUNT], OPENMP" >> $fname
set string = ( $string test_0${n}${test_suffix} ./script.csh BUILD CLEAN $OPENMP_OPT $NEST[$COUNT] $COMPILE[$COUNT] )
if ( "$DASHOPT1[$COUNT]" == "F" ) then
set str = ""
else
set str = $DASHOPT1[$COUNT]
endif
if ( "$DASHOPT2[$COUNT]" != "F" ) then
set str = ( $str $DASHOPT2[$COUNT] )
endif
set string = ( $string $str )
if ( $BUILDENV1[$COUNT] == F ) then
set str = ""
else
set str = $BUILDENV1[$COUNT]
endif
if ( $BUILDENV2[$COUNT] != F ) then
set str = ( $str $BUILDENV2[$COUNT] )
endif
if ( $BUILDENV3[$COUNT] != F ) then
set str = ( $str $BUILDENV3[$COUNT] )
endif
if ( $BUILDENV4[$COUNT] != F ) then
set str = ( $str $BUILDENV4[$COUNT] )
endif
if ( $BUILDENV5[$COUNT] != F ) then
set str = ( $str $BUILDENV5[$COUNT] )
endif
set string = ( $string $str )
echo "echo Build container" >> $fname
if ( $n == 19 ) then
echo "#docker run -it --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest /bin/tcsh' >> $fname
echo "#docker exec -it test_0${n}${test_suffix} /bin/tcsh" >> $fname
echo "#docker start -ai test_0${n}${test_suffix}" >> $fname
echo "docker run -d -t --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest' >> $fname
else
echo "#docker run -it --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest /bin/tcsh' >> $fname
echo "#docker exec -it test_0${n}${test_suffix} /bin/tcsh" >> $fname
echo "#docker start -ai test_0${n}${test_suffix}" >> $fname
echo "docker run -d -t --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest' >> $fname
endif
echo "date" >> $fname
echo "echo Build WRF executable" >> $fname
echo $string >> $fname
echo "date" >> $fname
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/wrf.exe" >> $fname
echo 'set OK_WRF = $status' >> $fname
if ( $COMPILE[$COUNT] == nmm_real ) then
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/real_nmm.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
else if ( $COMPILE[$COUNT] == em_real ) then
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/real.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
else
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/ideal.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
endif
echo 'if ( ( $OK_WRF == 0 ) && ( $OK_PRE == 0 ) ) then' >> $fname
echo ' echo "SUCCESSFUL BUILD"' >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls wrfoutput | grep _BUILD_ | grep $COMPILE[$COUNT]_${OPENMP_OPT} " >> $fname
echo 'else' >> $fname
echo ' echo "FAILED BUILD LOG START"' >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/compile.log.$COMPILE[$COUNT].${OPENMP_OPT}" >> $fname
echo ' echo "FAILED BUILD LOG END"' >> $fname
echo 'endif' >> $fname
echo "date" >> $fname
echo " " >> $fname
set D = $DROPIT/Namelists/weekly/$RUNDIR[$COUNT]
if ( -d $D ) then
find $D -name namelist.input\* -exec ls -1 {} \; >& .foo1
set EXTRAS = `cat .foo1 | sed 's/^.*\.//' | sort -u`
rm .foo1
else
set EXTRAS = " "
endif
echo "set TCOUNT = 1" >> $fname
echo "foreach t ( $TEST[$COUNT] $EXTRAS )" >> $fname
echo " date" >> $fname
echo ' if ( $TCOUNT == 1 ) ' "goto SKIP_test_0${n}${test_suffix}" >> $fname
echo " echo '======================================================================'" >> $fname
echo " echo RUN WRF test_0${n}${test_suffix} for $COMPILE[$COUNT] $OPENMP_OPT $RUNDIR[$COUNT], NML = " '$t' >> $fname
echo " docker exec test_0${n}${test_suffix} ./script.csh RUN $COMPILE[$COUNT] $OPENMP_OPT $RUNDIR[$COUNT]" '$t' "OMP_NUM_THREADS=$NP[$COUNT]" >> $fname
echo ' set OK = $status' >> $fname
echo ' echo $OK =' "STATUS test_0${n}${test_suffix} $NAME[$COUNT] $COMPILE[$COUNT] $OPENMP_OPT" '$t' >> $fname
echo " date" >> $fname
echo " " >> $fname
echo " echo 'PRE-PROC OUTPUT' " >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/test/$COMPILE[$COUNT]/real.print.out " >> $fname
echo " echo 'MODEL OUTPUT' " >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/test/$COMPILE[$COUNT]/wrf.print.out " >> $fname
echo " " >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls WRF/test/$COMPILE[$COUNT] | grep wrfout " >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls wrfoutput | grep _RUN_ | grep $COMPILE[$COUNT]_${OPENMP_OPT}_$RUNDIR[$COUNT]_"'$t ' >> $fname
echo " date" >> $fname
echo "SKIP_test_0${n}${test_suffix}:" >> $fname
echo ' @ TCOUNT ++' >> $fname
echo "end" >> $fname
echo "date" >> $fname
echo "docker stop test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "docker rm test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "touch $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "mv $DROPIT/DOING_NOW_test_0${n}${test_suffix} $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "##################### END OF JOB #####################" >> $fname
else
goto SKIP_THIS_ONE
endif
else if ( $p == MPI ) then
if ( $MPI[$COUNT] == T ) then
set test_suffix = m
set fname = test_0${n}${test_suffix}.csh
if ( -e $fname ) rm $fname
touch $fname
chmod +x $fname
echo "Run ./$fname"
echo '#\!/bin/csh' >> $fname
echo "##################### TOP OF JOB #####################" >> $fname
echo "touch $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/DOING_NOW_test_0${n}${test_suffix}" >> $fname
echo "echo TEST CASE = test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "set SHARED = $SHARED" >> $fname
echo "# Build: case = $NAME[$COUNT], MPI" >> $fname
set string = ( $string test_0${n}${test_suffix} ./script.csh BUILD CLEAN $MPI_OPT $NEST[$COUNT] $COMPILE[$COUNT] )
if ( "$DASHOPT1[$COUNT]" == "F" ) then
set str = ""
else
set str = $DASHOPT1[$COUNT]
endif
if ( "$DASHOPT2[$COUNT]" != "F" ) then
set str = ( $str $DASHOPT2[$COUNT] )
endif
set string = ( $string $str )
if ( $BUILDENV1[$COUNT] == F ) then
set str = ""
else
set str = $BUILDENV1[$COUNT]
endif
if ( $BUILDENV2[$COUNT] != F ) then
set str = ( $str $BUILDENV2[$COUNT] )
endif
if ( $BUILDENV3[$COUNT] != F ) then
set str = ( $str $BUILDENV3[$COUNT] )
endif
if ( $BUILDENV4[$COUNT] != F ) then
set str = ( $str $BUILDENV4[$COUNT] )
endif
if ( $BUILDENV5[$COUNT] != F ) then
set str = ( $str $BUILDENV5[$COUNT] )
endif
set string = ( $string $str )
echo "echo Build container" >> $fname
if ( $n == 19 ) then
echo "#docker run -it --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest /bin/tcsh' >> $fname
echo "#docker exec -it test_0${n}${test_suffix} /bin/tcsh" >> $fname
echo "#docker start -ai test_0${n}${test_suffix}" >> $fname
echo "docker run -d -t --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_nmmregtest' >> $fname
else
echo "#docker run -it --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest /bin/tcsh' >> $fname
echo "#docker exec -it test_0${n}${test_suffix} /bin/tcsh" >> $fname
echo "#docker start -ai test_0${n}${test_suffix}" >> $fname
echo "docker run -d -t --name test_0${n}${test_suffix} " '-v $SHARED/OUTPUT:/wrf/wrfoutput wrf_regtest' >> $fname
endif
echo "date" >> $fname
echo "echo Build WRF executable" >> $fname
echo $string >> $fname
echo "date" >> $fname
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/wrf.exe" >> $fname
echo 'set OK_WRF = $status' >> $fname
if ( $COMPILE[$COUNT] == nmm_real ) then
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/real_nmm.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
else if ( $COMPILE[$COUNT] == em_real ) then
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/real.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
else
echo "docker exec test_0${n}${test_suffix} ls -ls WRF/main/ideal.exe" >> $fname
echo 'set OK_PRE = $status' >> $fname
endif
echo 'if ( ( $OK_WRF == 0 ) && ( $OK_PRE == 0 ) ) then' >> $fname
echo ' echo "SUCCESSFUL BUILD"' >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls wrfoutput | grep _BUILD_ | grep $COMPILE[$COUNT]_${MPI_OPT} " >> $fname
echo 'else' >> $fname
echo ' echo "FAILED BUILD LOG START"' >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/compile.log.$COMPILE[$COUNT].${MPI_OPT}" >> $fname
echo ' echo "FAILED BUILD LOG END"' >> $fname
echo 'endif' >> $fname
echo "date" >> $fname
echo " " >> $fname
set D = $DROPIT/Namelists/weekly/$RUNDIR[$COUNT]
if ( -d $D ) then
find $D -name namelist.input\* -exec ls -1 {} \; >& .foo1
set EXTRAS = `cat .foo1 | sed 's/^.*\.//' | sort -u`
rm .foo1
else
set EXTRAS = " "
endif
echo "set TCOUNT = 1" >> $fname
echo "foreach t ( $TEST[$COUNT] $EXTRAS )" >> $fname
echo " date" >> $fname
echo ' if ( $TCOUNT == 1 ) ' "goto SKIP_test_0${n}${test_suffix}" >> $fname
echo " echo '======================================================================'" >> $fname
echo " echo RUN WRF test_0${n}${test_suffix} for $COMPILE[$COUNT] $MPI_OPT $RUNDIR[$COUNT], NML = " '$t' >> $fname
if ( ( $RUNDIR[$COUNT] == em_real ) || \
( $RUNDIR[$COUNT] == em_realA ) || \
( $RUNDIR[$COUNT] == em_realB ) || \
( $RUNDIR[$COUNT] == em_realC ) || \
( $RUNDIR[$COUNT] == em_realD ) || \
( $RUNDIR[$COUNT] == em_realE ) || \
( $RUNDIR[$COUNT] == em_realF ) || \
( $RUNDIR[$COUNT] == em_realG ) || \
( $RUNDIR[$COUNT] == em_realH ) || \
( $RUNDIR[$COUNT] == em_real8 ) ) then
echo ' set is_nest = `echo $t | rev | cut -c 1-2 | rev`' >> $fname
echo ' if ( ( $is_nest == NE ) || ( $is_nest == VN ) ) then' >> $fname
echo " docker exec test_0${n}${test_suffix} ./script.csh RUN $COMPILE[$COUNT] $MPI_OPT $RUNDIR[$COUNT]" '$t' "NP=9" >> $fname
echo ' set OK = $status' >> $fname
echo ' else' >> $fname
echo " docker exec test_0${n}${test_suffix} ./script.csh RUN $COMPILE[$COUNT] $MPI_OPT $RUNDIR[$COUNT]" '$t' "NP=$NP[$COUNT]" >> $fname
echo ' set OK = $status' >> $fname
echo ' endif' >> $fname
else
echo " docker exec test_0${n}${test_suffix} ./script.csh RUN $COMPILE[$COUNT] $MPI_OPT $RUNDIR[$COUNT]" '$t' "NP=$NP[$COUNT]" >> $fname
echo ' set OK = $status' >> $fname
endif
echo ' echo $OK =' "STATUS test_0${n}${test_suffix} $NAME[$COUNT] $COMPILE[$COUNT] $MPI_OPT" '$t' >> $fname
echo " date" >> $fname
echo " " >> $fname
echo " echo 'PRE-PROC OUTPUT' " >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/test/$COMPILE[$COUNT]/real.print.out " >> $fname
echo " echo 'MODEL OUTPUT' " >> $fname
echo " docker exec test_0${n}${test_suffix} cat WRF/test/$COMPILE[$COUNT]/rsl.out.0000 " >> $fname
echo " " >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls WRF/test/$COMPILE[$COUNT] | grep wrfout " >> $fname
echo " docker exec test_0${n}${test_suffix} ls -ls wrfoutput | grep _RUN_ | grep $COMPILE[$COUNT]_${MPI_OPT}_$RUNDIR[$COUNT]_"'$t ' >> $fname
echo " date" >> $fname
echo "SKIP_test_0${n}${test_suffix}:" >> $fname
echo ' @ TCOUNT ++' >> $fname
echo "end" >> $fname
echo "date" >> $fname
echo "docker stop test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "docker rm test_0${n}${test_suffix}" >> $fname
echo "date" >> $fname
echo "touch $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "chmod 666 $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "mv $DROPIT/DOING_NOW_test_0${n}${test_suffix} $DROPIT/COMPLETE_test_0${n}${test_suffix}" >> $fname
echo "##################### END OF JOB #####################" >> $fname
else
goto SKIP_THIS_ONE
endif
endif
SKIP_THIS_ONE:
set string = ""
end
@ COUNT ++
end
if ( -e last_only_once.csh ) rm last_only_once.csh
touch last_only_once.csh
chmod +x last_only_once.csh
echo '#\!/bin/csh' >> last_only_once.csh
echo "" >> last_only_once.csh
echo "##################### TOP OF JOB #####################" >> last_only_once.csh
echo "" >> last_only_once.csh
echo "date" >> last_only_once.csh
echo "" >> last_only_once.csh
echo "# This compares serial vs openmp and serial vs mpi results" >> last_only_once.csh
echo "# Run this script ONLY once" >> last_only_once.csh
echo "# This job runs outside of a container" >> last_only_once.csh
echo "# All test cases of all builds must finish first" >> last_only_once.csh
echo "" >> last_only_once.csh
echo "echo 'Current Working Directory'" >> last_only_once.csh
echo "pwd" >> last_only_once.csh
echo "" >> last_only_once.csh
echo "echo 'LISTING OF FILES'" >> last_only_once.csh
echo "ls -lsR" >> last_only_once.csh
echo "" >> last_only_once.csh
echo "set SHARED = $SHARED" >> last_only_once.csh
echo 'pushd ${SHARED}/OUTPUT >& /dev/null' >> last_only_once.csh
echo "" >> last_only_once.csh
set COUNT = 1
foreach n ( $NUMBER )
set root1_file = SUCCESS_RUN_WRF
set root2_file_s = $COMPILE[$COUNT]_${SERIAL_OPT}_$RUNDIR[$COUNT]
set root2_file_o = $COMPILE[$COUNT]_${OPENMP_OPT}_$RUNDIR[$COUNT]
set root2_file_m = $COMPILE[$COUNT]_${MPI_OPT}_$RUNDIR[$COUNT]
set D = $DROPIT/Namelists/weekly/$RUNDIR[$COUNT]
if ( -d $D ) then
find $D -name namelist.input\* -exec ls -1 {} \; >& .foo1
set EXTRAS = `cat .foo1 | sed 's/^.*\.//' | sort -u`
rm .foo1
else
set EXTRAS = " "
endif
set TCOUNT = 0
foreach t ( $TEST[$COUNT] $EXTRAS )
@ TCOUNT ++
if ( $TCOUNT == 1 ) goto SKIP_THIS_TEST
if ( ( $SERIAL[$COUNT] == T ) && ( $OPENMP[$COUNT] == T ) ) then
foreach d ( d01 d02 d03 )
set file1 = ${root1_file}_${d}_${root2_file_s}_$t
set file2 = ${root1_file}_${d}_${root2_file_o}_$t
echo "if ( ( -e $file1 ) && ( -e $file2 ) ) then" >> last_only_once.csh
echo " diff -q $file1 $file2" >> last_only_once.csh
echo ' set OK = $status' >> last_only_once.csh
echo " echo $file1 vs $file2 status =" '$OK' >> last_only_once.csh
echo "endif" >> last_only_once.csh
echo "" >> last_only_once.csh
end
endif
if ( ( $SERIAL[$COUNT] == T ) && ( $MPI[$COUNT] == T ) ) then
foreach d ( d01 d02 d03 )
set file1 = ${root1_file}_${d}_${root2_file_s}_$t
set file2 = ${root1_file}_${d}_${root2_file_m}_$t
echo "if ( ( -e $file1 ) && ( -e $file2 ) ) then" >> last_only_once.csh
echo " diff -q $file1 $file2" >> last_only_once.csh
echo ' set OK = $status' >> last_only_once.csh
echo " echo $file1 vs $file2 status =" '$OK' >> last_only_once.csh
echo "endif" >> last_only_once.csh
echo "" >> last_only_once.csh
end
endif
SKIP_THIS_TEST:
end
@ COUNT ++
end
echo 'popd >& /dev/null' >> last_only_once.csh
echo "" >> last_only_once.csh
echo "date" >> last_only_once.csh
echo "" >> last_only_once.csh
echo "##################### END OF JOB #####################" >> last_only_once.csh
echo "Run ./last_only_once.csh"