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

Ignore:
Timestamp:
2015-10-12T20:28:35+02:00 (9 years ago)
Author:
nicolasmartin
Message:

dev_r5092_CNRS18_TRUST Several enhancements (global variables rename, notification mail object, add job performances, templates description, script to install new minimal branch to test) to improve accessibility for NEMO users & bugfixes (tar creation, modulefiles)

File:
1 edited

Legend:

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

    r5761 r5788  
    66## Set defaults 
    77##--------------------------------------------------- 
    8 NEMO_TRUS=$PWD 
    9 DEBUG=0; PUBLISH=0 
    10 IMOD=0; ST='FAILED'  ## No modules system & 'FAILED' status 
    11 SVN_CMD='svn status' ## No update on directories 
    12 trus_help='trusting_help.txt' 
     8DBG=0; PROD=0; HELP=0 
     9TRUS_DIR=$PWD; TRUS_RSLT='FAILED'; SVN_CMD='svn status' # ('FAILED' result & no update on directories) 
     10xios_mode='--full'; stdout_redir='>&' 
     11revi=$( svn info | awk '(NR == 9) {print $NF}' ) 
    1312 
    1413 
     
    1615##--------------------------------------------------- 
    1716while [ $# -ne 0 ]; do 
    18  
    1917    case $1 in 
    20    '-a'|'--archive') NEMO_TARF=$2    ; shift 2;; '-b'|'--branch ') NEMO_BRAN=$2    ; shift 2;; 
    21    '-d'|'--debug  ') set -vx; DEBUG=1; shift  ;; '-e'|'--email  ') EMAIL=$2        ; shift 2;; 
    22    '-j'|'--job    ') NPROC=$2        ; shift 2;; '-h'|'--help   ') cat ${help_file}; exit  1;; 
    23    '-m'|'--machine') NEMO_HPCC=$2    ; shift 2;; '-n'|'--newconf') TEST_CONF=$2    ; shift 2;; 
    24    '-r'|'--refconf') REFE_CONF=$2    ; shift 2;; '-t'|'--time   ') TIME_LIMI=$2    ; shift 2;; 
    25    '-p'|'--publish') PUBLISH=1       ; shift  ;; '-u'|'--user   ') NEMO_USER=$2    ; shift 2;; 
    26    '-v'|'--version') NEMO_VERS=$2    ; shift 2;; "*"             ) cat ${help_file}; exit  1;; 
     18   '-a'|'--archive') TRUS_TARF=$2  ; shift 2;; '-b'|'--branch' ) TRUS_WKCY=$2; shift 2;; 
     19   '-d'|'--debug'  ) set -vx; DBG=1; shift  ;; '-e'|'--email'  ) TRUS_MAIL=$2; shift 2;; 
     20   '-j'|'--job'    ) TRUS_NPRO=$2  ; shift 2;; '-h'|'--help'   ) HELP=1      ; shift  ;; 
     21   '-m'|'--machine') TRUS_HPCC=$2  ; shift 2;; '-n'|'--newconf') TRUS_TEST=$2; shift 2;; 
     22   '-r'|'--refconf') TRUS_REFE=$2  ; shift 2;; '-t'|'--time'   ) TIMEOUT=$2  ; shift 2;; 
     23   '-p'|'--prod'   ) PROD=1        ; shift  ;; '-u'|'--user'   ) TRUS_USER=$2; shift 2;; 
     24   '-v'|'--version') TRUS_VERS=$2  ; shift 2;; "*"             ) HELP=1      ; shift  ;; 
    2725    esac 
    28  
    2926done 
    3027 
    31 ## DEBUG options to speed up & expand verbosity of compilation 
    32 xios_full='--full'; stderr_redir='>&' 
    33 [ $DEBUG -eq 1 ] && { xios_full=''; stderr_redir='>'; } 
    3428 
    35 ## If -v|--version option has been set, modify default SVN action on directories 
    36 if   [ $( echo ${NEMO_VERS} | grep  "HEAD\|up\|update"                     ) ]; then 
    37     SVN_CMD='svn update -r HEAD' 
    38 elif [ $( echo ${NEMO_VERS} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then 
    39     SVN_CMD='svn update -r '$( echo ${NEMO_VERS} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) 
    40 elif [ $( echo ${NEMO_VERS} | grep -o '[0-9]*'                             ) ]; then 
    41     SVN_CMD='svn update -r '$( echo ${NEMO_VERS} | grep -o '[0-9]*'                             ) 
    42 fi 
     29## Initialization (HPC & user environment) 
     30##--------------------------------------------------- 
     31if [[ ! $( find config -name ${TRUS_USER}'.cfg' && find config -name ${TRUS_HPCC}'.cfg' ) || $HELP -eq 1 ]]; then 
     32    cat trusting_help.txt 
    4333 
    44  
    45 ## Initialization (super-computer & user environment) 
    46 ##--------------------------------------------------- 
    47 if [[ ! -z "${NEMO_HPCC}" && ! -z "${NEMO_USER}" ]]; then 
    48  
    49     if   [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_USER}'.cfg' ) ]; then 
    50    echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_USER} 
    51    exit 1 
    52     elif [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_HPCC}'.cfg' ) ]; then 
    53    echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_HPCC} 
    54    exit 1 
    55     else 
    56    . ${NEMO_TRUS}/trusting.env 
     34    if [ $HELP -eq 0 ]; then 
     35   printf "\n\nAt least one configuration file is missing or misspelled: %s.cfg %s.cfg" \ 
     36       ${TRUS_USER} ${TRUS_HPCC} 
    5737    fi 
    5838 
     39    printf "\n\nContent of config folder:" 
     40    find config -name *.cfg | cut -d/ -f2 | xargs -n 3 printf "%-30s\t%-30s\t%-30s\n" 
     41    exit 1 
    5942else 
    60     cat ${NEMO_TRUS}/${trus_help} 
    61     exit 1 
     43    . trusting.env && . trusting_func.sh 
     44 
     45    ## DEBUG options to speed up & expand verbosity of compilation 
     46    [ $DBG -eq 1 ] && { xios_mode=''; stdout_redir='>'; } 
     47 
     48    ## If -v|--version option has been set, modify default SVN action on directories 
     49    if   [ $( echo ${TRUS_VERS} | grep  "HEAD\|up\|update"                     ) ]; then 
     50   SVN_CMD='svn update -r HEAD' 
     51    elif [ $( echo ${TRUS_VERS} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then 
     52   SVN_CMD='svn update -r '$( echo ${TRUS_VERS} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) 
     53    elif [ $( echo ${TRUS_VERS} | grep -o '[0-9]*'                             ) ]; then 
     54   SVN_CMD='svn update -r '$( echo ${TRUS_VERS} | grep -o '[0-9]*'                             ) 
     55    fi 
     56 
    6257fi 
    63  
    64 . ./trusting_func.sh 
    6558 
    6659 
    6760## Display contextual summary of trusting test 
    6861##--------------------------------------------------- 
    69 echo 'NEMO Trusting test:' 
    70 echo '-------------------' 
    71 echo 'Testing '${TEST_CONF}' based on '${REFE_CONF}' from '${NEMO_BRAN} 
    72 echo 'NEMO installation: '${NEMO_USER} 
    73 echo 'Computing architecture: '${NEMO_HPCC} 
    74 echo 'Trusting SVN version: '$( svn info | awk '(NR == 9) {print $NF}' ) 
     62echo 
     63cat banner.txt 
     64echo 
     65echo '****************************************************************************************************' 
     66echo '*                                                                                                  *' 
     67echo '*                           NEMO Trusting (Continuous Integration Tool)                            *' 
     68echo "*                                             ver.$revi                                             *" 
     69echo '*                                                                                                  *' 
     70echo '****************************************************************************************************' 
     71echo 
     72echo '  - Testing configuration   '${TRUS_TEST}' based on '${TRUS_REFE} 
     73echo '  - Working copy            '${TRUS_WKCY} 
     74echo '  - Benchmark folder        '${TRUS_BHMK} 
     75echo '  - (Super)Computer         '${TRUS_HPCC} 
     76echo '  - User installation       '${TRUS_USER} 
     77echo 
    7578 
    7679 
     
    7881##--------------------------------------------------- 
    7982print_step 'Timestamped testing directory' 
    80 mkdir -p ${TEST_DIR} ${REFE_DIR} 
     83mkdir -p ${TEST_DIR} ${TRUS_BHMK} 
    8184cd ${TEST_DIR} && echo ${TEST_DIR} 
    8285init_files 
     
    9295## Check softwares versions (after sourced arch environment) 
    9396##--------------------------------------------------- 
    94 print_step 'Get softwares releases' 
    95 [ -e ${ARCH_ENV} ] && . ${ARCH_ENV} > /dev/null 
    96 [ $? -eq 0 ] && export IMOD=1 
     97print_step 'Get testing environement' 
    9798get_soft_rel 
    9899cat model.log 
     100env | sort > env.log 
    99101 
    100102 
     
    103105print_step 'Compile XIOS' 
    104106cd ${DIR_XIOS} 
    105 eval ./make_xios ${xios_full} --arch ${NEMO_HPCC} --job $NPROC \ 
    106     ${stderr_redir} /dev/null 
     107eval ./make_xios ${xios_mode} --arch ${TRUS_HPCC} --job ${TRUS_NPRO} \ 
     108    ${stdout_redir} /dev/null 
    107109[ ! -e lib/libxios.a ] && get_out 1 || echo 'Success' 
    108110 
     
    110112## NEMO compilation from scratch 
    111113##--------------------------------------------------- 
    112 print_step "Compile ${REFE_CONF} configuration" 
    113 cd ${NEMO_CONF} 
    114 [[ -d ${TEST_CONF} && $DEBUG -eq 0 ]] && ./makenemo -n ${TEST_CONF} clean_config \ 
     114print_step "Compile ${TRUS_REFE} configuration" 
     115cd ${TRUS_WKCY}/CONFIG 
     116[[ -d ${TRUS_TEST} && $DBG -eq 0 ]] && ./makenemo -n ${TRUS_TEST} clean_config \ 
    115117    > /dev/null <<EOF 
    116118y 
    117119EOF 
    118120 
    119 eval ./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m ${NEMO_HPCC} -j $NPROC \ 
    120                    ${KEYS_ADD} ${KEYS_DEL}                                \ 
    121     ${stderr_redir} /dev/null 
    122 [ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out 2 || echo 'Success' 
     121eval ./makenemo -n ${TRUS_TEST} -r ${TRUS_REFE} -m ${TRUS_HPCC} -j ${TRUS_NPRO} \ 
     122                   ${KEYS_ADD} ${KEYS_DEL}                                      \ 
     123    ${stdout_redir} /dev/null 
     124[ ! -e ${TRUS_TEST}/BLD/bin/nemo.exe ] && get_out 2 || echo 'Success' 
    123125 
    124126 
     
    127129print_step 'Set job (copying or extracting inputs)' 
    128130cd ${TEST_DIR} 
    129 cp ${NEMO_CONF}/${TEST_CONF}/cpp_* . 
    130 find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)' \ 
    131                                      -exec  cp {} . \; 
     131cp   ${TRUS_WKCY}/CONFIG/${TRUS_TEST}/cpp_* . 
     132find ${TRUS_WKCY}/CONFIG/${TRUS_TEST}/EXP00 -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)' \ 
     133                                            -exec  cp {} . \; 
    132134get_inputs 
    133135[ $? -ne 0 ] && get_out 3 || echo 'Success' 
     
    137139## Check inputs 
    138140##--------------------------------------------------- 
    139 print_step 'Compare inputs to benchmark files' 
     141print_step 'Compare inputs' 
    140142diff_inputs 
    141143 
     
    151153 
    152154 
    153 ## Check job state & get computing time if succeeded 
     155## Check job state & get computation performances if succeeded 
    154156##--------------------------------------------------- 
    155157print_step 'Test job state' 
    156158[[ ! -e time.step || $( grep 'E R R O R' ocean.output ) ]] && get_out 5 || echo 'Success' 
    157 print_step 'Get real CPU time' 
    158 get_cpu_time 
     159print_step 'Get job performances' 
     160get_time 
     161get_memy 
    159162 
    160163 
    161164## Check outputs 
    162165##--------------------------------------------------- 
    163 ST='OK' ## 'OK' by default 
    164 print_step 'Compare new outputs to benchmark files' 
     166TRUS_RSLT='OK' ## 'OK' by default 
     167print_step 'Compare outputs' 
    165168diff_results 
    166 print_step 'Compare new restarts to benchmark files' 
     169print_step 'Compare restarts' 
    167170diff_restart 
    168 [ $ST == 'FAILED' ] && get_out 8 
     171[ $TRUS_RSLT == 'FAILED' ] && get_out 8 
    169172 
    170173 
Note: See TracChangeset for help on using the changeset viewer.