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 5355 – NEMO

Changeset 5355


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

dev_r5092_CNRS_SETTE Many improvments

Location:
branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/cfg/X64_CURIE.cfg

    r5292 r5355  
    33# Available softwares: 
    44CDO=cdo  
    5 COMPILER=ifort 
     5COMPILER=intel 
    66MPI=bullxmpi 
    77NETCDF=netcdf 
     
    1313JOB_DELE=ccc_mdel                           
    1414 
    15 # 
    16 [ -z "$NPROC"     ] && NPROC=1 
    17 [ -z "$TIME_LIMI" ] && TIME_LIMI=10800 # 3h 
     15# Compiling & computing settings 
     16[ -z "$NPROC"       ] && NPROC=16 
     17[ -z "${TIME_LIMI}" ] && TIME_LIMI=10800 # 3h 
    1818 
    1919# Architecture environment (be careful with compliance with XIOS) 
    20 ARCH_ENV=${DIR_XIOS}/arch/arch-${ARCH}.env 
     20ARCH_ENV=${DIR_XIOS}/arch/arch-${CFG_ARCH}.env 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/cfg/arch_template.cfg

    r5293 r5355  
    44 
    55# Available softwares: 
    6 CDO=''                  # CDO (Climate Data Operators)     (to get application version with `$CDO      --version`) 
    7 COMPILER=''             # ifort/gfortran/pgfortran/$FC/... ("" " " compiler      " "    ""  `$COMPILER --version`) 
    8 MPI=''                  # MPI    libraries                 (root directory name in $LOADEDMODULES or $PATH variable) 
    9 NETCDF=''               # NetCDF    " "                    ( ""     " "     ""  ""       ""       ""  " "     ""  ) 
     6CDO=''                    # CDO (Climate Data Operators) (root directory name in $LOADEDMODULES or $PATH) 
     7COMPILER=''               # ifort/gfortran/pgfortran/... ( ""     " "     ""  ""       ""       ""  " " ) 
     8MPI=''                    # MPI    libraries             ( ""     " "     ""  ""       ""       ""  " " ) 
     9NETCDF=''                 # NetCDF    " "                ( ""     " "     ""  ""       ""       ""  " " ) 
    1010 
    1111# Job commands: 
    12 JOB_SUBM=''             # Command to submit a job && get his ID in return 
    13 JOB_LIST=''                #   " "   to list submitted jobs  (to know if the job is in progress with his ID) 
    14 JOB_VIEW=''             #   " "   to get job informations (to increment a log during computing from job ID) 
    15 JOB_DELE=''             #   " "   to stop a job           (not used currently) 
     12JOB_SUBM=''               # Submit a job && get his ID in return 
     13JOB_LIST=''                  # List submitted jobs  (to know if the job is in progress with his ID) 
     14JOB_VIEW=''               # Get job informations (to increment a log during computing from job ID) 
     15JOB_DELE=''               # Stop a job           (not used currently) 
    1616 
    17 #  
    18 [ -z "$NPROC"     ] && NPROC=1          # Number of processing units for compilation 
    19 [ -z "$TIME_LIMI" ] && TIME_LIMI=''     # Timeout in s for computation (pending & running) 
     17# Compiling & computing settings 
     18[ -z "$NPROC"       ] && NPROC=1          # Number of processing units 
     19[ -z "${TIME_LIMI}" ] && TIME_LIMI=''     # Timeout in s (pending & running) 
    2020 
    2121# Architecture environment (be careful with compliance with XIOS) 
    22 ARCH_ENV=''                             # ${DIR_WORK}/XIOS/arch/arch-${ARCH}.env 
     22ARCH_ENV=''                               # ${DIR_WORK}/XIOS/arch/arch-${CFG_ARCH}.env 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/cfg/user_template.cfg

    r5292 r5355  
    1111# NEMO overall configuration: 
    1212[ -z "${NEMO_BRAN}" ] && NEMO_BRAN=''     # trunk, dev_v3_4_STABLE_2012, ... 
    13 [ -z "${CONF_REFE}" ] && CONF_REFE=''     # ORCA2_LIM_PISCES, GYRE, ... 
    14 [ -z "${CONF_TEST}" ] && CONF_TEST=''     # ${CONF_REFE}_trust, ... 
     13[ -z "${CONF_REFE}" ] && REFE_CONF=''     # ORCA2_LIM_PISCES, GYRE, ... 
     14[ -z "${CONF_TEST}" ] && TEST_CONF=''     # ${CONF_REFE}_trust, ... 
    1515NEMO_HOME=''                              # NEMOGCM equivalent root directory to find ./ARCH,./CONFIG, ... 
    1616                                          # (${DIR_WORK}/NEMO/${NEMO_BRAN}/NEMOGCM, ...) 
    1717 
    1818# Comparatives directories localization: 
    19 DIR_REFE=''                  # ${DIR_STOR}/${CONF_REFE}/${NEMO_BRAN} 
    20 DIR_TEST=''                  # ${DIR_SCRA}/${CONF_REFE}/${NEMO_BRAN}/trusting_${DATE_STR} 
     19REFE_DIR=''                  # ${DIR_STOR}/${CONF_REFE}/${NEMO_BRAN} 
     20TEST_DIR=''                  # ${DIR_SCRA}/${CONF_REFE}/${NEMO_BRAN}/trusting_${DATE_STR} 
    2121 
    2222# External softs directories: 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env

    r5292 r5355  
    77 
    88# Sourcing user configuration 
    9 [ ! find ./cfg        -name ${CFG_USER}.cfg ] && { echo 'No configuration file in ./cfg for '${CFG_USER}; exit; } 
    10 . cfg/${CFG_USER}.cfg 
     9#-------------------------------------- 
     10. ${NEMO_TRUS}/cfg/${CFG_USER}.cfg 
    1111export DIR_WORK  DIR_SCRA  DIR_STOR 
    12 export NEMO_HOME NEMO_BRAN CONF_REFE CONF_TEST 
    13 export DIR_REFE  DIR_TEST 
     12export NEMO_HOME NEMO_BRAN 
     13export REFE_CONF TEST_CONF REFE_DIR TEST_DIR 
    1414export DIR_XIOS  DIR_OASI 
    1515export NEMO_FORC FORC_TARF 
    1616 
    17 NEMO_ARCH=${NEMO_HOME}/ARCH         ; NEMO_CONF=${NEMO_HOME}/CONFIG         ; NEMO_ENGI=${NEMO_HOME}/NEMO 
    18 NEMO_EFCM=${NEMO_HOME}/EXTERNAL/fcm ; NEMO_IPSL=${NEMO_HOME}/EXTERNAL/IOIPSL; NEMO_TRUS=${NEMO_HOME}/SETTE 
    19 NEMO_TCMP=${NEMO_HOME}/TOOLS/COMPILE 
     17# Only interest for essential NEMO directories 
     18NEMO_ARCH=${NEMO_HOME}/ARCH        ; NEMO_CONF=${NEMO_HOME}/CONFIG         ; NEMO_ENGI=${NEMO_HOME}/NEMO 
     19NEMO_EFCM=${NEMO_HOME}/EXTERNAL/fcm; NEMO_IPSL=${NEMO_HOME}/EXTERNAL/IOIPSL; NEMO_TCMP=${NEMO_HOME}/TOOLS/COMPILE 
    2020export NEMO_ARCH NEMO_CONF NEMO_EFCM 
    21 export NEMO_ENGI NEMO_IPSL NEMO_TRUS 
    22 export NEMO_TCMP 
     21export NEMO_ENGI NEMO_IPSL NEMO_TCMP 
    2322 
    2423# Sourcing super-computer configuration 
    25 [ ! find ./cfg        -name ${CFG_ARCH}.cfg ] && { echo 'No configuration file in ./cfg for '${CFG_ARCH}; exit; } 
    26 . cfg/${CFG_ARCH}.cfg 
     24#-------------------------------------- 
     25. ${NEMO_TRUS}/cfg/${CFG_ARCH}.cfg 
    2726export CDO      COMPILER  MPI      NETCDF 
    2827export JOB_SUBM JOB_LIST  JOB_VIEW JOB_DELE 
    2928export NPROC    TIME_LIMI 
    3029export ARCH_ENV 
    31  
    32 [ ! find ${NEMO_ARCH} -name arch-$ARCH.fcm  ] && { echo 'No fcm file in '${NEMO_ARCH}' for '$ARCH       ; exit; } 
  • 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 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh

    r5292 r5355  
    11#!/bin/bash 
    22 
    3 function mesg_make {  
     3function mesg_make { 
    44    paste -d ';' mesg_*_${CFG_USER}_${CFG_ARCH}.txt > trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt 
    55    cat trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt 
     
    77 
    88#============================================= 
    9 function mesg_publish {  
     9function mesg_publish { 
    1010   
    1111if [ $PUBLISH -eq 1 ]; then 
    1212 
    13   if [ -f ${DIR_TEST}/trusting_${CFG_USER}_${CFG_ARCH}.txt ] ; then 
    14       tail -1 trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt >> ${DIR_TEST}/trusting_${CFG_USER}_${CFG_ARCH}.txt 
     13  if [ -f ${TEST_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt ] ; then 
     14      tail -1 trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt >> ${TEST_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt 
    1515  else 
    16       cp      trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt    ${DIR_TEST}/trusting_${CFG_USER}_${CFG_ARCH}.txt 
     16      cp      trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt    ${TEST_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt 
    1717  fi 
    1818 
    19   cp trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt ${DIR_TEST} 
    20 #  chmod o+r ${DIR_TEST}/trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt 
     19  cp trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt ${TEST_DIR} 
     20#  chmod o+r ${TEST_DIR}/trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt 
    2121   
    2222#  rm -rf              ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF} 
    23 #  cp -alf ${DIR_TEST} ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF} 
     23#  cp -alf ${TEST_DIR} ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF} 
    2424#  chmod o+rX          ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF} 
    2525   
    2626  # Send mail only when FAILED 
    27   if [[ grep 'FAILED' mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt && ! -z $MAIL ]]; then 
    28       cat << END_MAIL > ${DIR_TEST}/trusting.mail 
     27  if [[ $( grep 'FAILED' mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt ) && ! -z $MAIL ]]; then 
     28      cat << END_MAIL > ${TEST_DIR}/trusting.mail 
    2929XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
    3030Dear $USER, 
     
    3434 
    3535Failed at step: `tail -n 1 mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt` 
    36 Directory : ${DIR_TEST} 
     36Directory : ${TEST_DIR} 
    3737 
    3838XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
    3939 
    4040END_MAIL 
    41       mail -s "[trusting ${CONF_REF}] FAILED" $MAIL < ${DIR_TEST}/trusting.mail 
     41      mail -s "[trusting ${CONF_REF}] FAILED" $MAIL < ${TEST_DIR}/trusting.mail 
    4242  fi 
    4343 
     
    4747 
    4848#============================================= 
    49 function getout {  
    50    cd ${DIR_TEST} 
     49function get_out { 
     50   cd ${TEST_DIR} 
    5151        mesg_make; mesg_publish 
    5252 
     
    6060 
    6161#============================================= 
    62 function diffnc { 
     62function diff_nc { 
    6363    stat=100; file1=$1; file2=$2 
    6464 
    6565    cdo diffv $file1 $file2 > out_tmp 
    66     ( [ $? -ne 0 ] && stat=100 ) || stat=$( grep -m 1 "records differ" out_tmp | awk '-Fof' '{print $1}' ) 
     66    ( [ $? -ne 0 ] && stat=100 ) || stat=$( grep -m 1 'records differ' out_tmp | awk -Fof '{print $1}' ) 
    6767    [ -f out_tmp ] && rm out_tmp 
    6868 
     
    7171 
    7272#--------------------------------------------- 
    73 function diff_trusting { 
    74  
    75     name_first=${JOB_NAME} 
    76     name_second=EXP00C 
    77     rep_ref=EXP00C_REFE 
    78     experiment_name=trusting 
    79     tagname=TEST 
    80     #listcomp="ATM SBG SRF CPL ICE MBG OCE" 
    81     listcomp="ATM SRF CPL ICE MBG OCE" 
     73function diff_restart { 
     74    last_time_step=$( cat ${REFE_DIR}/time.step ) 
    8275    result_final=0 
    8376 
    84 # Output   
    85     cd ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${experiment_name}/${name_first} 
    86     for comp in ${listcomp}; do 
    87    echo ${comp} 
    88    cd ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${experiment_name}/${name_first}/${comp}/Output 
    89    listfreq=$(ls -d MO/ DA/) 
    90    for freq in ${listfreq}; do 
    91             echo ${freq} 
    92             cd ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${experiment_name}/${name_first}/${comp}/Output/${freq} 
    93             listfile=$( ls *.nc ) 
    94             for file in ${listfile}; do 
    95       var=$( echo $file | sed -e "s/^${name_first}//" ) 
    96       result=$( diffnc ${name_first}${var} ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/${tagname}/${CONFIG_WORK}/${rep_ref}/${comp}/Output/${freq}${name_second}${var} ) 
    97       result=$? 
    98       echo 'diffnc '${name_first}${var} ${DIR_SCRA}/IGCM_OUT/${CONFIG_WORK}/TEST/${CONFIG_WORK}/${rep_ref}/${comp}/Output/${freq}${name_second}${var} 
    99       echo $result 
    100       (( result_final = result_final + result )) 
    101             done 
     77    echo 'Last time step: '${last_time_step} 
     78 
     79    if [ $( find ${REFE_DIR} -name *restart*_${last_time_step}.nc ) ]; then 
     80 
     81   for file in find ${REFE_DIR} -name *restart*_${last_time_step}.nc; do 
     82       echo ${TEST_DIR}'/*'${file}'_'${last_time_step}'.nc: ' 
     83       result=$( diff_nc $file ) 
     84       printf "diffnc $result\n" 
     85       (( result_final = result_final + result )) 
    10286   done 
    103     done 
    104     return $result_final 
    10587 
     88    else 
     89   echo 'No restart files found for comparison' 
     90    fi 
     91 
     92    return ${result_final} 
    10693} 
Note: See TracChangeset for help on using the changeset viewer.