Ignore:
Timestamp:
2015-06-04T20:09:56+02:00 (5 years ago)
Author:
nicolasmartin
Message:

dev_r5092_CNRS_SETTE Many improvments

File:
1 edited

Legend:

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

    r5292 r5355  
    99 
    1010# Set defaults 
     11#--------------------------------------------------- 
     12NEMO_TRUS=$( pwd $( dirname $0 ) ) 
    1113DEBUG=0; PUBLISH=0; status='OK' 
    1214 
    13 # Get options to replace some initials settings 
     15# Get options for replacing some initials settings 
     16#--------------------------------------------------- 
    1417while [ $# -ne 0 ]; do 
    1518    case $1 in 
    1619        -b|--branch ) NEMO_BRAN=$2         ; shift 2;; -d|--debug  ) set -vx; DEBUG=1     ; shift  ;; 
    1720   -e|--email  ) MAIL=$2              ; shift 2;; -j|--job    ) NPROC=$2             ; shift 2;; 
    18    -h|--help   ) cat trusting_help.txt; exit   ;; -m|--machine) CFG_ARCH=$2          ; shift 2;; 
    19    -n|--newconf) CONF_TEST=$2         ; shift 2;; -r|--refconf) CONF_REFE=$2         ; shift 2;; 
     21   -h|--help   ) cat trusting_help.txt; exit  1;; -m|--machine) CFG_ARCH=$2          ; shift 2;; 
     22   -n|--newconf) TEST_CONF=$2         ; shift 2;; -r|--refconf) REFE_CONF=$2         ; shift 2;; 
    2023   -t|--time   ) TIME_LIMI=$2         ; shift 2;; -p|--publish) PUBLISH=1            ; shift  ;; 
    2124        -u|--user   ) CFG_USER=$2          ; shift 2;; -v|--version) NEMO_REVI=$2         ; shift 2;; 
    22                    *) cat trusting_help.txt; exit   ;; 
     25                   *) cat trusting_help.txt; exit  1;; 
    2326    esac 
    2427done 
    2528 
    26 # Set super-computer & user environment 
    27 [[ ! -z "${CFG_ARCH}" && ! -z "${CFG_USER}" ]] && . trusting.env || { ./trusting.sh -h && exit; } 
    28 export DEBUG PUBLISH 
    29  
    30 # Initialization 
    31 #============================================= 
    32  
    33 echo ${DIR_TEST} 
    34 mkdir -p ${DIR_TEST} ${DIR_REFE} 
    35 cd ${DIR_TEST} 
    36 datestr1=$( LC_ALL=C date -d"$DATE_STR" +%Y-%m-%dT%H:%M ) 
    37 printf "Date\n%s\n"       $datestr1 > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt 
    38  
    39 printf "Status\nFAILED\n"           > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt # Only at end status will change to OK 
    40  
    41 . trusting_func.sh 
    42 #============================================= 
     29#export DEBUG PUBLISH 
    4330 
    4431 
    45 #  
    46 #============================================= 
     32# Initialization (super-computer & user environment) 
     33#--------------------------------------------------- 
     34if [[ ! -z "${CFG_ARCH}" && ! -z "${CFG_USER}" ]]; then 
     35 
     36    if   [ ! $( find ${NEMO_TRUS}/cfg -name ${CFG_USER}.cfg ) ]; then 
     37   echo 'No configuration file in '${NEMO_TRUS}'/cfg for '${CFG_USER}; exit 1 
     38    elif [ ! $( find ${NEMO_TRUS}/cfg -name ${CFG_ARCH}.cfg ) ]; then 
     39   echo 'No configuration file in '${NEMO_TRUS}'/cfg for '${CFG_ARCH}; exit 1 
     40    else 
     41   . ${NEMO_TRUS}/trusting.env 
     42    fi 
     43 
     44else 
     45    cat ${NEMO_TRUS}/trusting_help.txt; exit 1 
     46fi 
     47 
     48datestr1=$( LC_ALL=C date -d"${DATE_STR}" +%Y-%m-%dT%H:%M ) 
     49. ./trusting_func.sh 
     50 
     51mkdir -p ${TEST_DIR} ${REFE_DIR} 
     52echo ${TEST_DIR} && cd ${TEST_DIR} 
     53printf "Date\n%s\n"       $datestr1 > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt 
     54# Only at end status will change to OK 
     55printf "Status\nFAILED\n"           > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt 
     56 
     57 
     58# Check softwares versions 
     59#--------------------------------------------------- 
     60printf "Step......................\nGet softwares release\n"                     | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    4761for rel in $CDO $COMPILER $MPI $NETCDF; do 
    48     printf "Step......................\nGet $rel release\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    4962                             arch_rel=$( echo $LOADEDMODULES | sed "s#.*:$rel/\([^:]*\).*#\1#" ) 
    5063    [ -z "${arch_rel}"  ] && arch_rel=$( echo $PATH          | sed "s#.*$rel/\([^/]*\).*#\1#"  ) 
    51     [ $( echo $rel | grep "$CDO\|$COMPILER" ) ] && arch_rel=$( $rel --version | grep -m1 -o ' [0-9.]* ' ) 
     64#    [ $( echo $rel | grep $COMPILER ) ] && arch_rel=$( $rel --version | grep -m1 -o ' [0-9.]* ' >/dev/null ) 
    5265    echo $rel ${arch_rel} >> model.log 
    5366done 
    5467 
    55 sed -n 1p model.log | sed 'i\Fortran compiler' > mesg_04_compiler_${CFG_USER}_${CFG_ARCH}.txt 
    56 sed -n 2p model.log | sed 'i\MPI libraries   ' > mesg_05_mpi_${CFG_USER}_${CFG_ARCH}.txt 
    57 sed -n 3p model.log | sed 'i\NetCDF libraries' > mesg_06_netcdf_${CFG_USER}_${CFG_ARCH}.txt 
     68sed -n 2p model.log | sed 'i\Fortran compiler' > mesg_04_compiler_${CFG_USER}_${CFG_ARCH}.txt 
     69sed -n 3p model.log | sed 'i\MPI libraries   ' > mesg_05_mpi_${CFG_USER}_${CFG_ARCH}.txt 
     70sed -n 4p model.log | sed 'i\NetCDF libraries' > mesg_06_netcdf_${CFG_USER}_${CFG_ARCH}.txt 
    5871 
    5972 
    60 #--------------------------------------------- 
    61 printf "Step......................\nCheckout XIOS, FCM-make(/EXTERNAL/fcm), NEMO engines (/NEMO) & configuration (/CONFIG)\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     73# SVN action on XIOS & NEMO essentials directories 
     74#--------------------------------------------------- 
    6275svn_cmd='svn status' 
    63  
    6476# If -v|--version option has been set, modify svn command 
    6577[ $( echo ${NEMO_VERS} | grep  "up\|update"         ) ] && svn_cmd='svn update' 
    6678[ $( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) ] && svn_cmd='svn update -r '$( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) 
    6779 
     80printf "Step......................\nGet NEMO SVN revision with: ${svn_cmd}\n"    | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    6881rev=0 
     82 
    6983for dir in ${DIR_XIOS} ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_EFCM} ${NEMO_ENGI} ${NEMO_IPSL} ${NEMO_TRUS} ${NEMO_TCMP}; do 
     84    # For time being, just get revision number from XIOS 
    7085    [ $dir == ${DIR_XIOS} ] && echo 'XIOS '$( svn info $dir | awk '(NR == 9) {print $NF}' ) >> model.log && continue 
    7186    ${svn_cmd} $dir 
     
    7691 
    7792 
    78 #--------------------------------------------- 
    79 printf "Step......................\nCompilation NEMO configuration %s\n" ${CONF_REF} > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     93# NEMO config compiled from scratch 
     94#--------------------------------------------------- 
     95printf "Step......................\nCompiling ${CONF_REF} configuration\n"       | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    8096cd ${NEMO_CONF} 
    81 . ${ARCH_ENV}     # Sourcing architecture environment 
    82 #[ -d ${CONF_TEST} ] && ./makenemo -n ${CONF_TEST} clean 
    83 ./makenemo -n ${CONF_TEST} -r ${CONF_REFE} -m $ARCH -j $NPROC #> /dev/null 2>&1 
    84 [ ! -e ${CONF_TEST}/BLD/bin/nemo.exe ] && getout 
     97. ${ARCH_ENV} > /dev/null    # Sourcing architecture environment 
     98#[ -d ${TEST_CONF} ] && ./makenemo -n ${TEST_CONF} clean 
     99./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m $ARCH -j $NPROC > /dev/null 2>&1 
     100[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out 
    85101 
    86102 
    87 #--------------------------------------------- 
    88 printf "Step......................\nPreparing job\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    89 cd ${DIR_TEST} 
    90 find ${NEMO_CONF}/${CONF_TEST}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \; 
     103# Get namelists, xml & forced files for running 
     104#--------------------------------------------------- 
     105printf "Step......................\nPreparing job\n"                             | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     106cd ${TEST_DIR} 
     107find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \; 
    91108 
    92109if [ ! -z "${NEMO_FORC}" ]; then 
    93110    cp ${NEMO_FORC}/${FORC_TAR} . 
    94     tar -tvf ${FORC_TAR} > inputs_list.txt && tar -vxf ${FORC_TAR} 
    95     [ $? -ne 0 ] && getout 
     111    tar -tvf ${FORC_TAR} > inputs_list.txt && tar -vxf ${FORC_TAR} > /dev/null 
     112    [ $? -ne 0 ] && get_out 
    96113    gunzip *.gz 
    97114else 
     
    100117 
    101118 
    102 #--------------------------------------------- 
    103 printf "Step......................\nRunning\n"       > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    104 #${JOB_SUB} ${DIR_TEST}/../../batch.sh 
    105 job_num=$( ${JOB_SUB} ${DIR_TEST}/../../batch.sh | awk '{print $NF}') 
    106 [ $? -ne 0 ] && getout 
     119# Job submission & computing 
     120#--------------------------------------------------- 
     121printf "Step......................\nRunning\n"                                   | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt; echo ${JOB_SUBM} 
     122job_num=$( ${JOB_SUBM} | awk '{print $NF}' ) 
     123[ $? -ne 0 ] && get_out 
    107124 
    108 time_elapsed=0; time_increment=300 
     125time_elapsed=0; time_increment=30 
    109126sleep ${time_increment} 
    110 while [[ $( ${JOB_LIST} | grep $job_num ) && ${time_elapsed} -lt ${TIME_LIMI} ]] ; do 
     127while [[ $( ${JOB_LIST} | grep $job_num ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do 
    111128    printf "\n####################################################" >> computation.log 
    112129    ${JOB_VIEW} $job_num                                            >> computation.log 
     
    116133 
    117134 
    118 #--------------------------------------------- 
    119 printf "Step......................\nTest if ASCII output files exist\n"   > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    120 if      [ ! -f ${output_test} ]; then 
    121  
    122     getout 
    123 else if [  ] 
    124  
    125     grep 'E R R O R' ocean.output    >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
    126     sed 's/^/Time step :/' time.step >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
     135# Eventual crash during computing 
     136#--------------------------------------------------- 
     137printf "Step......................\nTest if ASCII output files exist\n"          | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     138if   [ ! -f ocean.output                  ]; then 
     139    printf "Step......................\nOpa crashed at initialization\n"         | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     140    status='FAILED' 
     141elif [ $( grep 'E R R O R' ocean.output ) ]; then 
     142    printf "Step......................\nOpa crashed\n"                           | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     143    grep 'E R R O R'       ocean.output >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
     144    sed 's/^/Time step :/' time.step    >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
     145    status='FAILED' 
    127146fi 
    128147 
    129148 
    130 #--------------------------------------------- 
    131 printf "Step......................\nTest ASCII output files difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     149# Inspect output text files 
     150#--------------------------------------------------- 
     151printf "Step......................\nTest ASCII output files difference\n"        | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    132152for file in ocean.output solver.stat tracer.stat; do 
    133     diff $file ${DIR_REFE}/$file 
     153    diff $file ${REFE_DIR}/$file 
    134154    [ $? -ne 0 ] && status='FAILED' 
    135155done 
    136156 
    137157 
    138 #--------------------------------------------- 
    139 printf "Step......................\nTest last restart files difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    140 diff_trusting 2>/dev/null 
     158# Inspect output NetCDF files 
     159#--------------------------------------------------- 
     160printf "Step......................\nTest last restart NetCDF files difference\n" | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     161diff_restart 2>/dev/null 
    141162[ $? -ne 0 ] && status='FAILED' 
    142163 
    143164 
    144 #--------------------------------------------- 
     165# Comments 
     166#--------------------------------------------------- 
    145167echo 'Comments'                    >  mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
    146168grep 'W A R N I N G:' ocean.output >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
    147169 
    148170 
    149 #--------------------------------------------- 
     171# Finals tests 
     172#--------------------------------------------------- 
    150173if [ $status != 'FAILED' ]; then 
    151     printf "Step......................\nGet Real CPU time\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    152     real_cpu_time=$( ${JOB_VIEW} $job_num | awk 'END{print $9}') 
     174    printf "Step......................\nGet real CPU time\n"                     | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     175    real_cpu_time=$( ${JOB_VIEW} $job_num | awk 'END{print $9}' ) 
    153176    printf "Real CPU time\n%s\n" ${real_cpu_time} > mesg_08_realcputime_${CFG_USER}_${CFG_ARCH}.txt 
    154177else 
    155     printf "Step......................\nTest InputFiles difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    156     diff inputs_list.txt ${DIR_REFE}/inputs_list.txt 
    157     [ $? -ne 0 ] && getout 
    158     [[ $? -ne 0 && printf "InputFiles\n%s\n" "Different" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt ]] || printf "InputFiles\n%s\n" "Same" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt 
     178    printf "Step......................\nTest input files difference\n"           | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     179    diff inputs_list.txt ${REFE_DIR}/inputs_list.txt 
     180 
     181    if [ $? -ne 0]; then 
     182   printf "Input files\nDifferent" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt 
     183    else 
     184   printf "Input files\nSame"      > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt 
     185    fi 
     186 
     187    get_out 
    159188fi 
    160189 
    161190 
    162 #--------------------------------------------- 
     191# So far, everything is good 
     192#--------------------------------------------------- 
    163193printf "Status\nOK\n" > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt 
    164 printf "Step......................\nCode is reliable\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
     194printf "Step......................\nCode is reliable\n"                          | tee mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt 
    165195 
    166 #--------------------------------------------- 
    167 getout 
     196 
     197# End 
     198#--------------------------------------------------- 
     199get_out 
Note: See TracChangeset for help on using the changeset viewer.