1 | #!/bin/sh |
---|
2 | # initialise user dependent variable |
---|
3 | export cmd=$0 ; export cmdargs=$@ |
---|
4 | SETTE_DIR=$(cd $(dirname "$0"); pwd) |
---|
5 | MAIN_DIR=$(dirname $SETTE_DIR) |
---|
6 | export CMPL_CORES=8 # Number of threads to use for compiling |
---|
7 | dry_run=0 |
---|
8 | NO_REPORT=0 |
---|
9 | # |
---|
10 | # controls for some common namelist, run-time options: |
---|
11 | # |
---|
12 | export USING_TIMING='yes' # Default: yes => set ln_timing=.true. ; use -T to disable |
---|
13 | export USING_ICEBERGS='yes' # Default: yes => set ln_icebergs=.true. ; use -i to disable |
---|
14 | export USING_EXTRA_HALO='yes' # Default: yes => set nn_hls=2 ; use -e to set nn_hls=1 |
---|
15 | export USING_COLLECTIVES='yes' # Default: yes => set nn_comm=2 ; use -C to set nn_comm=1 |
---|
16 | export USING_TILING='yes' # Default: yes => set ln_tile=.true. ; use -t to disable |
---|
17 | # Note: yes also ensures nn_hls=2 but -t will not alter nn_hls |
---|
18 | # |
---|
19 | # controls for some common compile-time keys: |
---|
20 | # |
---|
21 | export USING_NOSIGNED0='yes' # Default: yes => add key_nosignedzero ; use -z to delete key_nosignedzero |
---|
22 | export USING_QCO='yes' # Default: yes => add key_qco ; use -q to delete key_qco |
---|
23 | export USING_RK3='no' # Default: yes => add key_RK3 & key_qco ; use -Q to delete key_RK3 |
---|
24 | export USING_LOOP_FUSION='yes' # Default: yes => add key_loop_fusion ; use -F to delete key_loop_fusion |
---|
25 | export USING_XIOS='yes' # Default: yes => add key_xios ; use -X to delete key_xios |
---|
26 | # Note: changing USING_XIOS may require a change in arch file |
---|
27 | # |
---|
28 | # controls for some common batch-script, run-time options: |
---|
29 | # |
---|
30 | export USING_MPMD='yes' # Default: yes => run with detached XIOS servers ; use -A to run in attached (SPMD) mode |
---|
31 | # Note: yes also ensures key_xios but -A will not remove it |
---|
32 | export SETTE_SUB_VAL="" |
---|
33 | |
---|
34 | # Parse command-line arguments |
---|
35 | if [ $# -gt 0 ]; then |
---|
36 | while getopts n:x:v:cdrshTzqQteiACFX option; do |
---|
37 | case $option in |
---|
38 | c) export SETTE_CLEAN_CONFIGS='yes' |
---|
39 | export SETTE_SYNC_CONFIGS='yes' |
---|
40 | echo "-c: Configuration ${SETTE_TEST_CONFIGS[@]} will be cleaned; this option enforces also synchronisation" |
---|
41 | echo "";; |
---|
42 | d) dry_run=1 |
---|
43 | echo "";; |
---|
44 | r) NO_REPORT=1 |
---|
45 | echo "";; |
---|
46 | s) export SETTE_SYNC_CONFIGS='yes' |
---|
47 | echo "-s: MY_SRC and EXP00 in ${SETTE_TEST_CONFIGS[@]} will be synchronised with the MY_SRC and EXPREF from the reference configuration" |
---|
48 | echo "";; |
---|
49 | n) OPTSTR="$OPTARG" |
---|
50 | OPTSTR="${OPTSTR/ORCA2_SAS_ICE/SAS}" # Permit either shortened (expected) or full name for SAS |
---|
51 | OPTSTR="${OPTSTR/AGRIF_DEMO/AGRIF}" # Permit either shortened (expected) or full name for AGRIF |
---|
52 | export SETTE_TEST_CONFIGS=(${OPTSTR}) |
---|
53 | echo "==================================" |
---|
54 | if [ ${#SETTE_TEST_CONFIGS[@]} -gt 1 ]; then |
---|
55 | echo "-n: Configurations ${SETTE_TEST_CONFIGS[@]} will be tested if they are available" |
---|
56 | else |
---|
57 | echo "-n: Configuration ${SETTE_TEST_CONFIGS[@]} will be tested if it is available" |
---|
58 | fi |
---|
59 | echo "";; |
---|
60 | x) export SETTE_TEST_TYPES=(${OPTARG}) |
---|
61 | echo "-x: ${SETTE_TEST_TYPES[@]} tests requested" |
---|
62 | echo "";; |
---|
63 | v) export SETTE_SUB_VAL=($OPTARG) |
---|
64 | echo "-v: $SETTE_SUB_VAL validation sub-directory requested" |
---|
65 | echo "";; |
---|
66 | T) export USING_TIMING='no' |
---|
67 | echo "-T: ln_timing will be set to false" |
---|
68 | echo "";; |
---|
69 | t) export USING_TILING='no' |
---|
70 | echo "-t: ln_tile will be set to false" |
---|
71 | echo "";; |
---|
72 | e) export USING_EXTRA_HALO='no' |
---|
73 | echo "-e: nn_hls will be set to 1" |
---|
74 | echo "";; |
---|
75 | i) export USING_ICEBERGS='no' |
---|
76 | echo "-i: ln_icebergs will be set to false" |
---|
77 | echo "";; |
---|
78 | C) export USING_COLLECTIVES='no' |
---|
79 | echo "-C: nn_comm will be set to 1" |
---|
80 | echo "";; |
---|
81 | z) export USING_NOSIGNED0='no' |
---|
82 | echo "-z: key_nosignedzero will NOT be activated" |
---|
83 | echo "";; |
---|
84 | q) export USING_QCO='no' |
---|
85 | echo "-q: key_qco and key_linssh will NOT be activated" |
---|
86 | echo "";; |
---|
87 | Q) export USING_RK3='no' |
---|
88 | echo "-Q: key_qco and key_RK3 will not be activated" |
---|
89 | echo " This is the curent default for now since RK3 is not ready" |
---|
90 | echo "";; |
---|
91 | F) export USING_LOOP_FUSION='no' |
---|
92 | echo "-F: key_loop_fusion will not be activated" |
---|
93 | echo "";; |
---|
94 | X) export USING_XIOS='no' |
---|
95 | echo "-X: key_xios will not be activated" |
---|
96 | echo "";; |
---|
97 | A) export USING_MPMD='no' |
---|
98 | echo "-A: Tasks will be run in attached (SPMD) mode" |
---|
99 | echo "";; |
---|
100 | h | *) echo 'sette.sh with no arguments (in this case all configuration will be tested with default options)' |
---|
101 | echo '-T to set ln_timing false for all non-AGRIF configurations (default: true)' |
---|
102 | echo '-t set ln_tile false in all tests that support it (default: true)' |
---|
103 | echo '-e set nn_hls=1 (default: nn_hls=2)' |
---|
104 | echo '-i set ln_icebergs false (default: true)' |
---|
105 | echo '-C set nn_comm=1 (default: nn_comm=2 ==> use MPI3 collective comms)' |
---|
106 | echo '-z to remove the key_nosignedzero key (default: added)' |
---|
107 | echo '-q to remove the key_qco key (default: added)' |
---|
108 | echo '-X to remove the key_xios key (default: added)' |
---|
109 | echo '-F to remove the key_loop_fusion key (default: added)' |
---|
110 | echo '-Q to remove the key_RK3 key (currently a null-op since key_RK3 is not used)' |
---|
111 | echo '-A to run tests in attached (SPMD) mode (default: MPMD with key_xios)' |
---|
112 | echo '-n "CFG1_to_test CFG2_to_test ..." to test some specific configurations' |
---|
113 | echo '-x "TEST_type TEST_type ..." to specify particular types of test (RESTART is mandatory)' |
---|
114 | echo '-v "subdir" optional validation record subdirectory to be created below NEMO_VALIDATION_DIR' |
---|
115 | echo '-r to execute without waiting to run sette_rpt.sh at the end (useful for chaining sette.sh invocations)' |
---|
116 | echo '-d to perform a dryrun to simply report what settings will be used' |
---|
117 | echo '-c to clean each configuration' |
---|
118 | echo '-s to synchronise the sette MY_SRC and EXP00 with the reference MY_SRC and EXPREF'; exit 42 ;; |
---|
119 | esac |
---|
120 | done |
---|
121 | shift $((OPTIND - 1)) |
---|
122 | fi |
---|
123 | # |
---|
124 | # Option dependency tests |
---|
125 | # |
---|
126 | if [ ${USING_TILING} == "yes" ] ; then export USING_EXTRA_HALO="yes" ; fi |
---|
127 | |
---|
128 | # |
---|
129 | # Get SETTE parameters |
---|
130 | . ./param.cfg |
---|
131 | |
---|
132 | # |
---|
133 | # Set the common compile keys to add or delete based on command-line arguments: |
---|
134 | # |
---|
135 | export ADD_KEYS="" ; export DEL_KEYS="" |
---|
136 | if [ ${USING_XIOS} == "yes" ] ; then export ADD_KEYS="${ADD_KEYS}key_xios " ; fi |
---|
137 | if [ ${USING_XIOS} == "no" ] ; then export DEL_KEYS="${DEL_KEYS}key_xios " ; fi |
---|
138 | # |
---|
139 | if [ ${USING_NOSIGNED0} == "yes" ] ; then export ADD_KEYS="${ADD_KEYS}key_nosignedzero " ; fi |
---|
140 | if [ ${USING_NOSIGNED0} == "no" ] ; then export DEL_KEYS="${DEL_KEYS}key_nosignedzero " ; fi |
---|
141 | # |
---|
142 | if [ ${USING_LOOP_FUSION} == "yes" ] ; then export ADD_KEYS="${ADD_KEYS}key_loop_fusion " ; fi |
---|
143 | if [ ${USING_LOOP_FUSION} == "no" ] ; then export DEL_KEYS="${DEL_KEYS}key_loop_fusion " ; fi |
---|
144 | # |
---|
145 | if [ ${USING_QCO} == "yes" ] ; then export ADD_KEYS="${ADD_KEYS}key_qco " ; fi |
---|
146 | if [ ${USING_QCO} == "no" ] ; then export DEL_KEYS="${DEL_KEYS}key_qco key_linssh " ; fi |
---|
147 | # |
---|
148 | if [ ${USING_RK3} == "yes" ] ; then export ADD_KEYS="${ADD_KEYS}key_qco key_RK3 " ; fi |
---|
149 | if [ ${USING_RK3} == "no" ] ; then export DEL_KEYS="${DEL_KEYS}key_RK3 " ; fi |
---|
150 | |
---|
151 | # |
---|
152 | # Set validation record sub-directories (if required) |
---|
153 | # |
---|
154 | if [ ! -d $NEMO_VALIDATION_DIR ] ; then |
---|
155 | while true; do |
---|
156 | read -p "$NEMO_VALIDATION_DIR does not exist. Do you wish to create it? " yn |
---|
157 | case $yn in |
---|
158 | [Yy]* ) mkdir $NEMO_VALIDATION_DIR; break;; |
---|
159 | [Nn]* ) exit 42;; |
---|
160 | * ) echo "Please answer yes or no.";; |
---|
161 | esac |
---|
162 | done |
---|
163 | fi |
---|
164 | if [ ! -z $SETTE_SUB_VAL ] ; then |
---|
165 | if [ ! -d $NEMO_VALIDATION_DIR/$SETTE_SUB_VAL ] ; then |
---|
166 | mkdir $NEMO_VALIDATION_DIR/$SETTE_SUB_VAL |
---|
167 | fi |
---|
168 | export NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL |
---|
169 | fi |
---|
170 | |
---|
171 | if [ ${#SETTE_TEST_CONFIGS[@]} -eq 0 ]; then |
---|
172 | echo "==================================" |
---|
173 | echo "Configurations $TEST_CONFIGS will be tested if they are available" |
---|
174 | fi |
---|
175 | echo "Carrying out the following tests : ${TEST_TYPES[@]}" |
---|
176 | echo "requested by the command : "$cmd $cmdargs |
---|
177 | printf "%-33s : %s\n" USING_TIMING $USING_TIMING |
---|
178 | printf "%-33s : %s\n" USING_ICEBERGS $USING_ICEBERGS |
---|
179 | printf "%-33s : %s\n" USING_EXTRA_HALO $USING_EXTRA_HALO |
---|
180 | printf "%-33s : %s\n" USING_TILING $USING_TILING |
---|
181 | printf "%-33s : %s\n" USING_COLLECTIVES $USING_COLLECTIVES |
---|
182 | printf "%-33s : %s\n" USING_NOSIGNED0 $USING_NOSIGNED0 |
---|
183 | printf "%-33s : %s\n" USING_QCO $USING_QCO |
---|
184 | printf "%-33s : %s\n" USING_LOOP_FUSION $USING_LOOP_FUSION |
---|
185 | printf "%-33s : %s\n" USING_XIOS $USING_XIOS |
---|
186 | printf "%-33s : %s\n" USING_MPMD $USING_MPMD |
---|
187 | printf "%-33s : %s\n" USING_RK3 $USING_RK3 |
---|
188 | printf "%-33s : %s\n" "Common compile keys to be added" "$ADD_KEYS" |
---|
189 | printf "%-33s : %s\n" "Common compile keys to be deleted" "$DEL_KEYS" |
---|
190 | echo "Validation records to appear under: "$NEMO_VALIDATION_DIR |
---|
191 | echo "==================================" |
---|
192 | echo "" |
---|
193 | # |
---|
194 | # Option compatibility tests |
---|
195 | # |
---|
196 | if [ ${USING_MPMD} == "yes" ] && [ ${USING_XIOS} == "no" ] ; then echo "Incompatible choices. MPMD mode requires the XIOS server" ; exit ; fi |
---|
197 | |
---|
198 | if [ ${dry_run} -eq 1 ] ; then echo "dryrun only: no tests performed" ; exit ; fi |
---|
199 | |
---|
200 | # run sette on reference configuration |
---|
201 | . ./sette_reference-configurations.sh |
---|
202 | if [[ $? != 0 ]]; then |
---|
203 | echo "" |
---|
204 | echo "--------------------------------------------------------------" |
---|
205 | echo "./sette_cfg-ref.sh didn't finish properly, need investigations" |
---|
206 | echo "--------------------------------------------------------------" |
---|
207 | echo "" |
---|
208 | exit 42 |
---|
209 | fi |
---|
210 | |
---|
211 | # run sette on test cases |
---|
212 | . ./sette_test-cases.sh |
---|
213 | if [[ $? != 0 ]]; then |
---|
214 | echo "" |
---|
215 | echo "-----------------------------------------------------------------" |
---|
216 | echo "./sette_test-cases.sh didn't finish properly, need investigations" |
---|
217 | echo "-----------------------------------------------------------------" |
---|
218 | echo "" |
---|
219 | exit 42 |
---|
220 | fi |
---|
221 | |
---|
222 | if [ ${NO_REPORT} -ne 0 ] ; then exit ; fi |
---|
223 | # run sette report |
---|
224 | echo "" |
---|
225 | echo "-------------------------------------------------------------" |
---|
226 | echo "./sette_rpt.sh (script will wait all nemo_sette run are done)" |
---|
227 | echo "-------------------------------------------------------------" |
---|
228 | echo "" |
---|
229 | NRUN=999 |
---|
230 | NIT=0 |
---|
231 | while [[ $NRUN -ne 0 && $nit -le 1080 ]]; do |
---|
232 | nit=$((nit+1)) |
---|
233 | NRUN=$( ${BATCH_STAT} | grep ${BATCH_NAME} | wc -l ) |
---|
234 | if [[ $NRUN -ne 0 ]]; then |
---|
235 | printf "%-3d %s\r" $NRUN 'nemo_sette runs still in queue or running ...'; |
---|
236 | else |
---|
237 | printf "%-50s\n" " " |
---|
238 | . ./sette_rpt.sh |
---|
239 | exit |
---|
240 | fi |
---|
241 | sleep 10 |
---|
242 | done |
---|
243 | printf "\n" |
---|
244 | echo "" |
---|
245 | echo "Something wrong happened, it tooks more than 3 hours to run all the sette tests" |
---|
246 | echo "" |
---|