New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
sette.sh in utils/CI/sette_ticket2673 – NEMO

source: utils/CI/sette_ticket2673/sette.sh @ 14867

Last change on this file since 14867 was 14867, checked in by acc, 3 years ago

Branch: sette_ticket2673. Fully working version of revamped submission scripts. See #2673 for details of changes. Still some work to do to bring the associated scripts such as sette_list_avail_rev.sh in line with new design.

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