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.
Changeset 8808 for branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh – NEMO

Ignore:
Timestamp:
2017-11-24T15:03:07+01:00 (6 years ago)
Author:
nicolasmartin
Message:

Continuation of global refactoring of the tool, in particular a intelligible variables namelist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh

    r8797 r8808  
    66## Set defaults 
    77##--------------------------------------------------- 
    8 TRUS_DIRE=$PWD 
    9 TRUS_DBUG=0; TRUS_PROD=0; TRUS_HELP=0 
     8TRUST_MAIN_DIR=$PWD 
     9TRUST_FLAG_DEBUG=0; TRUST_FLAG_PROD=0; TRUST_FLAG_HELP=0 
    1010## No update on SVN directories & 'FAILED' result for 'Unknown error' ) 
    11 TRUS_SVNA='svn status'; TRUS_RSLT='FAILED'; TRUS_RORR=0 
     11TRUST_SVN_ACTION='svn status' 
     12TRUST_FLAG_RESULT='FAILED'; TRUST_FLAG_ERROR=0 
     13 
    1214xios_mode='--full'; stdout_redir='>&' 
    1315rev=$( svn info | awk '(NR == 9) {print $NF}' ) 
     
    1719##--------------------------------------------------- 
    1820while [ $# -ne 0 ]; do 
     21 
    1922    case $1 in 
    20    '-a'|'--archive') TRUS_TARF=$2; shift 2;; '-b'|'--branch' ) TRUS_BRAN=$2; shift 2;; 
    21    '-d'|'--debug'  ) TRUS_DBUG=1 ; shift  ;; '-e'|'--email'  ) TRUS_MAIL=$2; shift 2;; 
    22    '-f'|'--forcdir') TRUS_FORC=$2; shift 2;; '-j'|'--job'    ) TRUS_NPRO=$2; shift 2;; 
    23    '-h'|'--help'   ) TRUS_HELP=1 ; shift  ;; '-m'|'--machine') TRUS_HPCC=$2; shift 2;; 
    24    '-n'|'--newconf') TRUS_CONF=$2; shift 2;; '-r'|'--refconf') TRUS_REFE=$2; shift 2;; 
    25    '-t'|'--time'   ) TRUS_TOUT=$2; shift 2;; '-p'|'--prod'   ) TRUS_PROD=1 ; shift  ;; 
    26    '-u'|'--user'   ) TRUS_USER=$2; shift 2;; '-v'|'--version') TRUS_SVNV=$2; shift 2;; 
    27    '-w'|'--workdir') TRUS_WORK=$2; shift 2;; "*"             ) TRUS_HELP=1 ; shift  ;; 
     23   '-a'|'--archive') TRUST_CFG_FORC=$2; shift 2;; '-b'|'--branch' ) TRUST_SVN_BRANCH=$2; shift 2;; 
     24   '-d'|'--debug'  ) TRUST_FLAG_DEBUG=1 ; shift  ;; '-e'|'--email'  ) TRUST_TEST_MAILING=$2; shift 2;; 
     25   '-f'|'--forcdir') TRUST_DIR_FORC=$2; shift 2;; '-j'|'--job'    ) TRUST_COMPILE_NPROC=$2; shift 2;; 
     26   '-h'|'--help'   ) TRUST_FLAG_HELP=1 ; shift  ;; '-m'|'--machine') TRUST_MAIN_HPCC=$2; shift 2;; 
     27   '-n'|'--newconf') TRUST_CFG_NEW=$2; shift 2;; '-r'|'--refconf') TRUST_CFG_REF=$2; shift 2;; 
     28   '-t'|'--time'   ) TRUST_JOB_TIMEOUT=$2; shift 2;; '-p'|'--prod'   ) TRUST_FLAG_PROD=1 ; shift  ;; 
     29   '-u'|'--user'   ) TRUST_MAIN_USER=$2; shift 2;; '-v'|'--version') TRUST_SVN_REV=$2; shift 2;; 
     30   '-w'|'--workdir') TRUST_DIR_WORK=$2; shift 2;; "*"             ) TRUST_FLAG_HELP=1 ; shift  ;; 
    2831    esac 
     32 
    2933done 
    3034 
     
    3236## Initialization (HPC & user environment) 
    3337##--------------------------------------------------- 
    34 if [[ ! -e cfg/${TRUS_USER}.cfg || ! -e cfg/${TRUS_HPCC}.cfg || ${TRUS_HELP} -eq 1 ]]; then 
     38if [[ ! -e cfg/${TRUST_MAIN_USER}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg || ${TRUST_FLAG_HELP} -eq 1 ]]; then 
    3539    cat ./inc/trusting_help.txt 
    3640 
    37     if [ ${TRUS_HELP} -eq 0 ]; then 
     41    if [ ${TRUST_FLAG_HELP} -eq 0 ]; then 
    3842   printf "\n\n\033[0;33m" 
    3943   printf "At least one configuration (arch or user) file is missing or misspelled:" 
    40    printf "\t'%s'.cfg\t'%s'.cfg" ${TRUS_USER} ${TRUS_HPCC} 
     44   printf "\t'%s'.cfg\t'%s'.cfg" ${TRUST_MAIN_USER} ${TRUST_MAIN_HPCC} 
    4145   printf "\033[0m" 
    4246    fi 
     
    5054 
    5155    ## DEBUG option to speed up & expand verbosity of compilation 
    52     [ ${TRUS_DBUG} -eq 1 ] && { set -vx; xios_mode=''; stdout_redir='>'; } 
     56    [ ${TRUST_FLAG_DEBUG} -eq 1 ] && { set -vx; xios_mode=''; stdout_redir='>'; } 
    5357 
    5458    ## If -v|--version option has been set, modify default SVN action on directories 
    55     if   [ $( echo ${TRUS_SVNV} | grep  "HEAD\|up\|update"                     ) ]; then 
    56    TRUS_SVNA='svn update -r HEAD' 
    57     elif [ $( echo ${TRUS_SVNV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then 
    58    TRUS_SVNA='svn update -r     '$( echo ${TRUS_SVNV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) 
    59     elif [ $( echo ${TRUS_SVNV} | grep -o '[0-9]*'                             ) ]; then 
    60    TRUS_SVNA='svn update -r     '$( echo ${TRUS_SVNV} | grep -o '[0-9]*' ) 
     59    if   [ $( echo ${TRUST_SVN_REV} | grep  "HEAD\|up\|update"                     ) ]; then 
     60   TRUST_SVN_ACTION='svn update -r HEAD' 
     61    elif [ $( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then 
     62   TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) 
     63    elif [ $( echo ${TRUST_SVN_REV} | grep -o '[0-9]*'                             ) ]; then 
     64   TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '[0-9]*' ) 
    6165    fi 
    6266 
     
    6771##--------------------------------------------------- 
    6872echo 
     73 
    6974if [ -t 0 ]; then cat ./inc/banner.txt; else cat ./inc/banner.html; fi 
     75 
    7076echo 
    7177echo '****************************************************************************************************' 
     
    7682echo '****************************************************************************************************' 
    7783echo 
    78 printf "\t§ Testing configuration\t\t%s based on %s\n" ${TRUS_CONF} ${TRUS_REFE} 
    79 printf "\t§ SVN working copy\t\t%s/%s\n"               ${TRUS_WORK} ${TRUS_BRAN} 
    80 printf "\t§ Benchmark folder\t\t%s\n"               ${TRUS_STOR} 
    81 printf "\t§ (Super)Computer\t\t%s\n"             ${TRUS_HPCC} 
    82 printf "\t§ User installation\t\t%s\n\n"         ${TRUS_USER} 
     84printf "\t§ Testing configuration\t\t%s based on %s\n" ${TRUST_CFG_NEW} ${TRUST_CFG_REF} 
     85printf "\t§ SVN working copy\t\t%s/%s\n"               ${TRUST_DIR_WORK} ${TRUST_SVN_BRANCH} 
     86printf "\t§ Benchmark folder\t\t%s\n"               ${TRUST_DIR_STORE} 
     87printf "\t§ (Super)Computer\t\t%s\n"             ${TRUST_MAIN_HPCC} 
     88printf "\t§ User installation\t\t%s\n\n"         ${TRUST_MAIN_USER} 
    8389 
    8490 
     
    8692##--------------------------------------------------- 
    8793print_step 'Timestamped testing directory' 
    88 mkdir -p ${TRUS_SCRA} ${TRUS_STOR} 
    89 cd       ${TRUS_SCRA} 
    90 echo     ${TRUS_SCRA} 
     94 
     95mkdir -p ${TRUST_DIR_SCRATCH} ${TRUST_DIR_STORE} 
     96cd       ${TRUST_DIR_SCRATCH} 
     97echo     ${TRUST_DIR_SCRATCH} 
     98 
    9199init_files 
     100 
    92101get_date 
    93102 
     
    95104## Get SVN revision on XIOS & NEMO essentials directories 
    96105##--------------------------------------------------- 
    97 print_step "SVN action on NEMO directories: ${TRUS_SVNA}" 
     106print_step "SVN action on NEMO directories: ${TRUST_SVN_ACTION}" 
     107 
    98108get_nemo_rev 
    99109 
     
    102112##--------------------------------------------------- 
    103113print_step 'Get testing environement' 
     114 
    104115get_soft_rel 
     116 
    105117cat model.log | awk '{printf "%-20s %s %s\n", $1, $2, $3}' 
    106118env | sort > env.log 
     
    110122##--------------------------------------------------- 
    111123print_step 'Compile XIOS' 
    112 cd ${TRUS_XIOS} 
    113 eval ./make_xios ${xios_mode} --arch ${TRUS_HPCC} --job ${TRUS_NPRO} \ 
     124 
     125cd ${TRUST_DIR_XIOS} 
     126 
     127eval ./make_xios ${xios_mode} --arch ${TRUST_MAIN_HPCC} --job ${TRUST_COMPILE_NPROC} \ 
    114128    ${stdout_redir} /dev/null 
     129 
    115130[ ! -e lib/libxios.a ] && get_out 1 || echo 'Success' 
    116131 
     
    118133## NEMO compilation from scratch 
    119134##--------------------------------------------------- 
    120 print_step "Compile ${TRUS_REFE} configuration" 
    121 cd ${TRUS_NGCM}/CONFIG 
    122 [[ -d ${TRUS_CONF} && ${TRUS_DBUG} -eq 0 ]] && ./makenemo -n ${TRUS_CONF} clean_config \ 
    123     > /dev/null <<EOF 
     135print_step "Compile ${TRUST_CFG_REF} configuration" 
     136 
     137cd ${TRUST_DIR_NEMOGCM}/CONFIG 
     138 
     139if [[ -d ${TRUST_CFG_NEW} && ${TRUST_FLAG_DEBUG} -eq 0 ]]; then 
     140    ./makenemo -n ${TRUST_CFG_NEW} clean_config \ 
     141   > /dev/null <<EOF 
    124142y 
    125143EOF 
    126  
    127 eval ./makenemo -n ${TRUS_CONF} -r ${TRUS_REFE} -m ${TRUS_HPCC} -j ${TRUS_NPRO} \ 
    128                 ${TRUS_KEYA} ${TRUS_KEYD}                                       \ 
     144fi 
     145 
     146eval ./makenemo -n ${TRUST_CFG_NEW} -r ${TRUST_CFG_REF} \ 
     147                -m ${TRUST_MAIN_HPCC} -j ${TRUST_COMPILE_NPROC} \ 
     148                   ${TRUST_CFG_KEY_ADD} ${TRUST_CFG_KEY_DEL}    \ 
    129149    ${stdout_redir} /dev/null 
    130 [ ! -e ${TRUS_CONF}/BLD/bin/nemo.exe ] && get_out 2 || echo 'Success' 
     150 
     151[ ! -e ${TRUST_CFG_NEW}/BLD/bin/nemo.exe ] && get_out 2 || echo 'Success' 
    131152 
    132153 
     
    134155##--------------------------------------------------- 
    135156print_step 'Set job (copying or extracting inputs)' 
    136 cd ${TRUS_SCRA} 
     157 
     158cd ${TRUST_DIR_SCRATCH} 
     159 
    137160get_inputs 
    138 cp   ${TRUS_NGCM}/CONFIG/${TRUS_CONF}/cpp_* . 
    139 find ${TRUS_NGCM}/CONFIG/${TRUS_CONF}/EXP00 -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)' \ 
    140                                             -exec  cp {} . \; 
     161 
     162cp   ${TRUST_DIR_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/cpp_* . 
     163find ${TRUST_DIR_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/EXP00   \ 
     164    -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)' \ 
     165    -exec  cp {} . \; 
    141166 
    142167 
     
    144169##--------------------------------------------------- 
    145170print_step 'Compare inputs' 
     171 
    146172diff_inputs 
    147173 
     
    150176##--------------------------------------------------- 
    151177print_step 'Submit job' 
    152 cp ${TRUS_DIRE}/batch/${TRUS_JSPT} ${TRUS_SCRA} ## Copy the submitting script to testing folder 
    153 TRUS_JIDN=$( eval ${TRUS_JSUB} ) 
    154 [ $? -ne 0 ] && get_out 4 || printf "Success (job ID %s)\n" ${TRUS_JIDN} 
     178 
     179## Copy the submitting script to testing folder 
     180cp ${TRUST_JOB_SCRIPT} ${TRUST_DIR_SCRATCH} 
     181TRUST_JOB_ID=$( eval ${TRUST_JOB_SUBMIT} ) 
     182 
     183[ $? -ne 0 ] && get_out 4 || printf "Success (job ID %s)\n" ${TRUST_JOB_ID} 
     184 
    155185print_step 'Pending job' 
     186 
    156187job_pending 
     188 
    157189print_step 'Job finished' 
    158190 
     
    161193##--------------------------------------------------- 
    162194print_step 'Test job state' 
    163 [[ ! -e time.step || $( grep 'E R R O R' ocean.output ) ]] && get_out 5 || echo 'Success' ## Must be reviewed 
     195 
     196if [[ ! -e time.step || $( grep 'E R R O R' ocean.output ) ]]; then 
     197    get_out 5 
     198else 
     199    echo 'Success' ## Must be reviewed 
     200fi 
     201 
    164202print_step 'Get job performances' 
     203 
    165204get_time 
     205 
    166206get_memy 
    167207 
     
    169209## Check outputs 
    170210##--------------------------------------------------- 
    171 TRUS_RSLT='OK' ## 'OK' by default 
     211TRUST_FLAG_RESULT='OK' ## 'OK' by default 
     212 
    172213print_step 'Compare outputs' 
     214 
    173215diff_results 
     216 
    174217print_step 'Compare restarts' 
    175 diff_restart 
    176 [ $TRUS_RSLT == 'FAILED' ] && get_out 8 
    177  
    178  
    179 ## End, at least nothing has changed ;-) 
     218 
     219diff_restarts 
     220 
     221[ $TRUST_RESULT == 'FAILED' ] && get_out 8 
     222 
     223 
     224## End, at least nothing major has changed ;-) 
    180225##--------------------------------------------------- 
    181226get_out 0 
Note: See TracChangeset for help on using the changeset viewer.