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