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