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 8818 for branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh – NEMO

Ignore:
Timestamp:
2017-11-27T14:10:49+01:00 (6 years ago)
Author:
nicolasmartin
Message:

Continuation of global refactoring of the tool, set cfg files mime property and modify trusting.env trying to handle default settings

File:
1 edited

Legend:

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

    r8808 r8818  
    5353 
    5454    ## Loop on essential NEMO directories 
    55     for dir in ${TRUST_SVN_CO} ${TRUST_DIR_XIOS}; do 
     55    for dir in ${TRUST_SVN_CO} ${TRUST_IO_XIOS}; do 
    5656 
    5757   ## For time being, just get revision from XIOS with no action on directory 
    58    if [ $dir == ${TRUST_DIR_XIOS} ]; then 
     58   if [ $dir == ${TRUST_IO_XIOS} ]; then 
    5959       rev_loc=$( svn info $dir | awk '/Last Changed Rev/ {print $NF}' ) 
    6060       echo 'XIOS '${rev_loc} \ 
    6161      >> model.log 
    62        echo "<a href=\"https://forge.ipsl.jussieu.fr/ioserver/changeset/${rev_loc}\" target=\"_blank\"> \ 
    63         ${rev_loc}                                                                                 \ 
    64         </a>"                                                                                      \ 
     62       echo "<a href=\"https://forge.ipsl.jussieu.fr/ioserver/changeset/${rev_loc}\" target=\"_blank\">${rev_loc}</a>" 
    6563      >> ${file_xios} 
    6664       continue 
     
    7775    echo 'NEMOGCM '$rev \ 
    7876   >> model.log 
    79     echo "<a href=\"https://forge.ipsl.jussieu.fr/nemo/changeset/$rev\" target=\"_blank\"> \ 
    80      $rev                                                                             \ 
    81      </a> "                                                                           \ 
     77    echo "<a href=\"https://forge.ipsl.jussieu.fr/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" 
    8278   >> ${file_nemo} 
    8379} 
     
    9187    for str in ${TRUST_COMPILE_FORTRAN}                         \ 
    9288          ${TRUST_COMPILE_MPI}     ${TRUST_COMPILE_NETCDF} \ 
    93           ${TRUST_CDO}                                      ; do 
     89          ${TRUST_IO_CDO}                                    ; do 
    9490   [ -z "$str" ] && continue 
    9591   ver='' 
     
    9995 
    10096   ## option --version would work for main Fortran compilers and CDO 
    101    if [[ $str =~ ${TRUST_COMPILE_FORTRAN}|${TRUST_CDO} ]]; then 
     97   if [[ $str =~ ${TRUST_COMPILE_FORTRAN}|${TRUST_IO_CDO} ]]; then 
    10298       ver=$( $str --version 2>&1 | grep -m1 -oe '\<[0-9. ]*\>' \ 
    10399         | xargs echo $str                                   ) 
     
    121117 
    122118get_inputs() { 
    123     # List archive content & extract it by default 
     119     # List archive content & extract it by default 
    124120    local inputs_list=$( eval " 
    125    for archive in ${TRUST_CFG_FORC}; do 
    126        tar -tvf ${TRUST_DIR_FORC}/\$archive >> inputs_list.txt; 
    127    done 
    128    " ) 
     121        for archive in ${TRUST_IO_FORC_TAR}; do 
     122            tar -tvf ${TRUST_IO_FORC_PATH}/\$archive >> inputs_list.txt; 
     123         done 
     124         " ) 
    129125    local inputs_get=$( eval " 
    130    for archive in ${TRUST_CFG_FORC}; do 
    131        tar -vxf ${TRUST_DIR_FORC}/\$archive  >       /dev/null; 
    132    done 
    133    " ) 
    134  
     126        for archive in ${TRUST_IO_FORC_TAR}; do 
     127            tar -vxf ${TRUST_IO_FORC_PATH}/\$archive  >       /dev/null; 
     128         done 
     129         " ) 
     130  
    135131    ## List & copy files without archive 
    136     if [ -z "${TRUST_CFG_FORC}" ]; then 
    137    inputs_list=" ls -lh ${TRUST_DIR_FORC}/* >> inputs_list.txt" 
    138    inputs_get=" \cp     ${TRUST_DIR_FORC}/* .                 " 
     132    if [ -z "${TRUST_IO_FORC_TAR}" ]; then 
     133        inputs_list=" ls -lh ${TRUST_IO_FORC_PATH}/* >> inputs_list.txt" 
     134        inputs_get=" \cp     ${TRUST_IO_FORC_PATH}/* .                 " 
    139135    fi 
    140136 
    141137    ${inputs_list}; ${inputs_get} 
     138 
     139#    for entry in ${TRUST_IO_FORC_PATH}; do 
     140# 
     141   # If path to file (assuming it is an archive) 
     142#  if   [ -e $entry ]; then 
     143#      tar -tvf $entry >> inputs_list.txt; 
     144#      tar -vxf $entry  >       /dev/null; 
     145   # If path to directory 
     146#  elif [ -d $entry ]; then 
     147#      inputs_list=" ls -lh ${TRUST_IO_FORC_PATH}/* >> inputs_list.txt" 
     148#      inputs_get=" \cp     ${TRUST_IO_FORC_PATH}/* .                 " 
     149#  fi     
     150 
     151#    done 
    142152 
    143153    if [ $( find -name '*.gz' -print -quit ) ]; then 
     
    150160    local files_list='' mesg='Same'  
    151161 
     162    ################################### 
     163    ## Think of copying initial test ## 
     164    ################################### 
     165 
    152166    ## Simple diff 
    153     for file in 'inputs_list.txt' *namelist_* *.xml cpp_*; do 
     167    for file in cpp_* 'inputs_list.txt' *namelist_* *.xml; do 
    154168   dif='' 
    155169 
    156170   ## Continue even if input file is not in here (see after) 
    157    if [ -e ${TRUST_DIR_STORE}/$file ]; then 
    158        dif=$( diff -q $file ${TRUST_DIR_STORE}/$file ) 
     171   if [ -e ${TRUST_TEST_BENCHMARK}/$file ]; then 
     172       dif=$( diff -q $file ${TRUST_TEST_BENCHMARK}/$file ) 
    159173   else  
    160174       dif=0 
     
    209223    local files_list='' mesg='Same' 
    210224 
     225    ################################### 
     226    ## Think of copying initial test ## 
     227    ################################### 
     228 
    211229    ## Simple diff 
    212230    for file in 'ocean.output' *.stat; do 
    213231   ## Stop if no minimal benchmark files (ocean.output, eventual stat files) 
    214    if [ ! -e ${TRUST_DIR_STORE}/$file ]; then 
    215        TRUST_FLAG_RESULT='FAILED' 
    216        get_out 7 
    217    fi 
    218  
    219    diff -q $file ${TRUST_DIR_STORE}/$file 
     232   [ ! -e ${TRUST_TEST_BENCHMARK}/$file ] && get_out 7 
     233 
     234   diff -q $file ${TRUST_TEST_BENCHMARK}/$file 
    220235 
    221236   ## Continue even if it differs 
    222    if [ $? -ne 0 ]; then 
    223        TRUST_FLAG_RESULT='FAILED' 
    224        mesg='Different' 
    225        files_list+=$file' ' 
    226    fi 
     237   if [ $? -ne 0 ]; then mesg='Different'; files_list+=$file' '; fi 
    227238 
    228239    done 
     
    241252    ## Find all restart files to rebuild 
    242253    if [ $( find -regex ".*_restart.*[0-9]\.nc" -print -quit ) ]; then 
    243         ################################################################ 
    244    ## Think to set the confgiguration name in the 'namelist_cfg' ## 
    245    ################################################################ 
     254        ############################################################### 
     255   ## Think to set the configuration name in the 'namelist_cfg' ## 
     256   ############################################################### 
    246257   filebases=$( find -regextype sed -regex ".*${TRUST_CFG_NEW}.*_[0-9]\{4\}\.nc" \ 
    247258                | sed 's/\(.*\)_.*/\1/' | sort -u                                  ) 
     
    252263             | wc -l | awk '{print $1}'              ) 
    253264 
    254        [ $ndomain -eq 0 ] && TRUST_FLAG_RESULT='FAILED' && get_out 8 
     265       [ $ndomain -eq 0 ] && get_out X 
     266 
     267            ##################################################### 
     268            ## Handle 2 possibilities of 'rebuild_nemo' origin ## 
     269            ##################################################### 
    255270 
    256271       ${TRUST_DIR_NEMOGCM}/TOOLS/REBUILD_NEMO/rebuild_nemo \ 
     
    259274 
    260275       ## Possibility of remaining decomposed restarts (even after rebuild) 
    261        [ $? -eq 0 ] && rm -f ${filebase}_[0-9]*.nc \ 
    262                 > /dev/null 
     276       if [ $? -eq 0 ]; then 
     277      rm -f ${filebase}_[0-9]*.nc \ 
     278                    > /dev/null 
     279       else 
     280      get_out X 
     281       fi 
    263282 
    264283            ## Stop if no benchmark files (restart file) 
    265        if [ -e ${TRUST_DIR_STORE}/$filebase.nc ]; then 
     284       if [ -e ${TRUST_TEST_BENCHMARK}/$filebase.nc ]; then 
    266285 
    267286      #bcmk='true' 
    268       cdo diffn $filebase.nc ${TRUST_DIR_STORE}/$filebase.nc \ 
     287      cdo diffn $filebase.nc ${TRUST_TEST_BENCHMARK}/$filebase.nc \ 
    269288          > cdo_diff.out 2> /dev/null 
    270289 
     
    275294 
    276295      if [ -n "$dif" ]; then 
    277           export TRUST_FLAG_RESULT='FAILED' 
    278296          files_list+=$filebase' ' && echo $filebase'.nc: '$dif 
    279297          let dif_sum+=$( echo $dif | sed '|^\([0-9]*\).*|\1|' ) 
     
    283301 
    284302   done 
    285  
    286         ## No benchmark files 
    287    #if   [ $bcmk == 'false' ]; then 
    288    #    TRUST_FLAG_RESULT='FAILED' 
    289    #    get_out 7 
    290    #fi 
    291303 
    292304        ## List modified restart(s) for web comment with sum of differences 
     
    384396 
    385397For more details, look into the testing folder at: 
    386 ${TRUST_DIR_SCRATCH} 
     398${TRUST_TEST_DIR} 
    387399An archive is also available to share the questionable configuration: 
    388 ${TRUST_DIR_STORE}/${TRUST_TEST_BACKUP} 
     400${TRUST_TEST_BENCHMARK}/${TRUST_TEST_BACKUP} 
    389401 
    390402END_MAIL 
     
    392404       ## Send with detailed subject 
    393405       mail -s "[NEMO Trusting][${TRUST_CFG_REF}][${TRUST_SVN_BRANCH}] \ 
    394            ${TRUST_FLAG_RESULT} ${TRUST_FLAG_ERROR}"               \ 
    395        ${TRUST_TEST_MAILING}                                \ 
     406           ${TRUST_FLAG_RESULT} ${TRUST_FLAG_ERROR}"              \ 
     407       ${TRUST_TEST_MAILING}                                      \ 
    396408      <  trusting.mail 
    397409   fi 
     
    408420 
    409421    ## In case of compilation error 
    410     cd ${TRUST_DIR_SCRATCH} 
     422    cd ${TRUST_TEST_DIR} 
    411423 
    412424    if [ ${TRUST_FLAG_RESULT} == 'FAILED' ]; then 
     
    455467    ## Save tested configuration if trusting failed in production mode (-p|--prod) 
    456468    if [[ ${TRUST_FLAG_RESULT} == 'FAILED' && ${TRUST_FLAG_PROD} -eq 1 ]]; then 
    457    echo 'Creating archive '${TRUST_TEST_BACKUP}' under '${TRUST_DIR_STORE} 
    458    tar -czf ${TRUST_DIR_STORE}/${TRUST_TEST_BACKUP}                 * \ 
     469   echo 'Creating archive '${TRUST_TEST_BACKUP}' under '${TRUST_TEST_BENCHMARK} 
     470   tar -czf ${TRUST_TEST_BENCHMARK}/${TRUST_TEST_BACKUP}                 * \ 
    459471       -C   ${TRUST_DIR_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/MY_SRC . \ 
    460472       -C   ${TRUST_DIR_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}          \ 
Note: See TracChangeset for help on using the changeset viewer.