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

Ignore:
Timestamp:
2015-06-18T23:02:31+02:00 (9 years ago)
Author:
nicolasmartin
Message:

dev_r5092_CNRS_SETTE Increase trusting main script clarity with new functions

File:
1 edited

Legend:

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

    r5432 r5438  
    1111#--------------------------------------------------- 
    1212NEMO_TRUS=$( pwd $( dirname $0 ) ) 
    13 SVN_CMD='svn status' 
     13SVN_OPT='status' 
    1414DEBUG=0; PUBLISH=0; status='OK' 
    1515 
     
    2727    esac 
    2828done 
    29  
    30 #export DEBUG PUBLISH 
    31  
    3229 
    3330# Initialization (super-computer & user environment) 
     
    4744fi 
    4845 
    49 # If -v|--version option has been set, modify svn command 
    50 [ $( echo ${NEMO_VERS} | grep  "up\|update"         ) ] && SVN_CMD='svn update' 
    51 [ $( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) ] && SVN_CMD='svn update -r '$( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) 
    52  
    5346. ./trusting_func.sh 
    54  
    5547 
    5648#  
     
    5951echo ${TEST_DIR} && cd ${TEST_DIR} 
    6052datestr1=$( LC_ALL=C date -d"${DATE_STR}" +%Y-%m-%dT%H:%M ) 
    61 printf "Date\n%s\n"       $datestr1 > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt 
     53printf "Date\n$datestr1\n" > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt 
    6254# Only at end status will change to OK 
    63 printf "Status\nFAILED\n"           > mesg_03_status_${CFG_USER}_${CFG_ARCH}.txt 
     55status='FAILED' 
    6456 
    65  
    66 # Check softwares versions 
     57# Check softwares versions (source arch environment) 
    6758#--------------------------------------------------- 
    68 printf "Step......................\nGet softwares release\n"                     | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    69 . ${ARCH_ENV} > /dev/null    # Sourcing architecture environment 
     59pstep 'Get softwares release' 
     60. ${ARCH_ENV} > /dev/null 
    7061get_soft_rel 
    71 sed -n 2p model.log | sed 'i\Fortran compiler' | tee mesg_05_compiler_${CFG_USER}_${CFG_ARCH}.txt 
    72 sed -n 3p model.log | sed 'i\MPI libraries   ' | tee mesg_06_mpi_${CFG_USER}_${CFG_ARCH}.txt 
    73 sed -n 4p model.log | sed 'i\NetCDF libraries' | tee mesg_07_netcdf_${CFG_USER}_${CFG_ARCH}.txt 
    74  
    7562 
    7663# SVN action on XIOS & NEMO essentials directories 
    7764#--------------------------------------------------- 
    78 printf "Step......................\nGet NEMO SVN revision with: ${SVN_CMD}\n"    | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
     65pstep "Get NEMO SVN state with: ${SVN_OPT}" 
    7966get_nemo_rev 
    80 sed -n 6p model.log | sed 'i\NEMO revision'    | tee  mesg_02_nemo_${CFG_USER}_${CFG_ARCH}.txt 
    81  
    82  
     67exit 0 
    8368# NEMO config compiled from scratch 
    8469#--------------------------------------------------- 
    85 printf "Step......................\nCompiling ${CONF_REF} configuration\n"       | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
     70pstep "Compiling ${CONF_REF} configuration" 
    8671cd ${NEMO_CONF} 
    8772#[ -d ${TEST_CONF} ] && ./makenemo -n ${TEST_CONF} clean 
    8873./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m $ARCH -j $NPROC >& /dev/null 
    89 [ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out 
    90  
     74[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out $step $status 
    9175 
    9276# Get namelists, xml & forced files for running 
    9377#--------------------------------------------------- 
    94 cd ${TEST_DIR} 
    95 printf "Step......................\nPreparing job\n"                             | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
     78pstep 'Preparing job' 
    9679find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \; 
    9780 
     
    10386 
    10487${cmd_iol} > inputs_list.txt && ${cmd_iof} > /dev/null 
    105 [ $? -ne 0 ] && get_out 
     88[ $? -ne 0 ] && get_out $step $status 
    10689[ $( find . -name '*.gz' -print -quit ) ] && gunzip *.gz 
    107 exit 0 
     90 
     91# Check input files in all cases 
     92#--------------------------------------------------- 
     93pstep 'Test input files difference' 
     94diff_inputs 
    10895 
    10996# Job submission & computing 
    11097#--------------------------------------------------- 
    111 printf "Step......................\nRunning\n"                                   | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt; echo ${JOB_SUBM} 
     98pstep 'Running' 
    11299job_num=$( ${JOB_SUBM} | awk '{print $NF}' ) 
    113 [ $? -ne 0 ] && get_out 
     100[ $? -ne 0 ] && get_out $step $status 
    114101 
    115102time_elapsed=0; time_increment=30 
     
    125112# Eventual crash during computing 
    126113#--------------------------------------------------- 
    127 printf "Step......................\nTest if ASCII output files exist\n"          | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    128 if   [ ! -f ocean.output                  ]; then 
    129     printf "Step......................\nOpa crashed at initialization\n"         | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
     114pstep 'Test if ASCII output files exist' 
     115if   [[ ! -f ocean.output || $( grep 'E R R O R' ocean.output ) ]]; then 
     116    ${JOB_DELE} ${job_num} &> /dev/null 
     117    [ ! -f ocean.output                  ] && step='nemo.exe crashed at initialization' 
     118    [ $( grep 'E R R O R' ocean.output ) ] && step='nemo.exe crashed' 
     119    comments('E R R O R') 
    130120    ${JOB_DELE} ${job_num} >/dev/null 2>&1 
    131121    status='FAILED' 
    132 elif [ $( grep 'E R R O R' ocean.output ) ]; then 
    133     printf "Step......................\nOpa crashed\n"                           | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    134     grep 'E R R O R'       ocean.output | tee    mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt 
    135     sed 's/^/Time step :/' time.step    | tee -a mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt 
    136     ${JOB_DELE} ${job_num} >/dev/null 2>&1 
    137     status='FAILED' 
     122    get_out $step $status 
     123else 
     124    status='OK' 
     125 
     126    # Inspect output text files 
     127    #--------------------------------------------------- 
     128    pstep 'Test ASCII output files diff' 
     129    for file in ocean.output solver.stat tracer.stat; do 
     130   diff $file ${REFE_DIR}/$file 
     131   [ $? -ne 0 ] && status='FAILED' 
     132    done 
     133 
     134    # Inspect output NetCDF files 
     135    #--------------------------------------------------- 
     136    pstep 'Test last restart NetCDF files diff' 
     137    diff_restart #2> /dev/null 
     138    [ $? -ne 0 ] && status='FAILED' 
     139 
     140    # Get computation duration 
     141    #--------------------------------------------------- 
     142    pstep 'Get real CPU time' 
     143    get_cpu_time 
     144 
     145    comments('W A R N I N G') 
    138146fi 
    139  
    140  
    141 # Inspect output text files 
    142 #--------------------------------------------------- 
    143 printf "Step......................\nTest ASCII output files difference\n"        | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    144 for file in ocean.output solver.stat tracer.stat; do 
    145     diff $file ${REFE_DIR}/$file 
    146     [ $? -ne 0 ] && status='FAILED' 
    147 done 
    148  
    149  
    150 # Inspect output NetCDF files 
    151 #--------------------------------------------------- 
    152 printf "Step......................\nTest last restart NetCDF files difference\n" | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    153 diff_restart 2>/dev/null 
    154 [ $? -ne 0 ] && status='FAILED' 
    155  
    156  
    157 # Finals tests 
    158 #--------------------------------------------------- 
    159 if [ $status != 'FAILED' ]; then 
    160  
    161     # Comments 
    162     #--------------------------------------------------- 
    163     echo 'Comments'                    | tee    mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt 
    164     grep 'W A R N I N G:' ocean.output | tee -a mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt 
    165  
    166     # Portability ! 
    167     printf "Step......................\nGet real CPU time\n"                     | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    168     real_cpu_time=$( ${JOB_VIEW} ${job_num} | awk 'END{print $9}' ) 
    169     printf "Real CPU time\n%s\n" ${real_cpu_time} | tee mesg_08_realcputime_${CFG_USER}_${CFG_ARCH}.txt 
    170     printf "Input files\nNA"                      | tee mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt 
    171 else 
    172     printf "Step......................\nTest input files difference\n"           | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    173     diff_inputs 
    174     get_out 
    175 fi 
    176  
    177  
    178 # So far, everything is good 
    179 #--------------------------------------------------- 
    180 printf "Status\nOK\n" > mesg_03_status_${CFG_USER}_${CFG_ARCH}.txt 
    181 printf "Step......................\nCode is reliable\n"                          | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt 
    182  
    183147 
    184148# End 
    185149#--------------------------------------------------- 
    186 get_out 
     150if [ $status == 'FAILED' ]; then step='Test outputs difference'; else step='Code is reliable'; fi 
     151get_out $step $status 
Note: See TracChangeset for help on using the changeset viewer.