Changeset 5644


Ignore:
Timestamp:
2015-07-29T20:33:51+02:00 (5 years ago)
Author:
nicolasmartin
Message:

dev_r5092_CNRS_SETTE Wide modifications on trusting_func.sh for clearness & other significant changes on different names

Location:
branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST
Files:
2 added
8 edited
1 copied
1 moved

Legend:

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

    r5636 r5644  
    88 
    99# Job commands: LoadLeveler 
    10 JOB_SUBM="llsubmit ${NEMO_TRUS}/batch/${CFG_ARCH}.sh | grep -oe '\<[0-9]*\>'" 
     10JOB_SUBM="llsubmit ${NEMO_TRUS}/batch/${NEMO_HPCC}.sh | grep -oe '\<[0-9]*\>'" 
    1111JOB_LIST=llq 
    1212JOB_INFO='llq -x' 
     
    1919 
    2020# Architecture environment (be careful with compliance with XIOS) 
    21 ARCH_ENV=${DIR_XIOS}/arch/arch-${CFG_ARCH}.env 
     21ARCH_ENV=${DIR_XIOS}/arch/arch-${NEMO_HPCC}.env 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/X64_CURIE.cfg

    r5635 r5644  
    33# Available softwares: 
    44CDO='cdo' 
    5 COMPILER='intel' 
     5COMPILER='ifort' 
    66MPI='bullxmpi' 
    77NETCDF='netcdf' 
    88 
    99# Job commands: ccc_* 
    10 JOB_SUBM="ccc_msub ${NEMO_TRUS}/batch/${CFG_ARCH}.sh | grep -oe '\<[0-9]*\>'" 
     10JOB_SUBM="ccc_msub ${NEMO_TRUS}/batch/${NEMO_HPCC}.sh | grep -oe '\<[0-9]*\>'" 
    1111JOB_LIST=ccc_mpp 
    1212JOB_INFO=ccc_macct 
     
    1919 
    2020# Architecture environment (be careful with compliance with XIOS) 
    21 ARCH_ENV=${DIR_XIOS}/arch/arch-${CFG_ARCH}.env 
     21ARCH_ENV=${DIR_XIOS}/arch/arch-${NEMO_HPCC}.env 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/arch_template.cfg

    r5483 r5644  
    1 # Copy to ./${CFG_ARCH}.cfg, fill in according to your installation 
     1# Copy to ./${NEMO_HPCC}.cfg, fill in according to your installation 
    22 
    33# Super-computer configuration 
     
    1515# Job commands (works with job ID): 
    1616JOB_SUBM=''               # Submit a job && get his ID in return 
    17                                              # ex: "cmd ${NEMO_TRUS}/batch/${CFG_ARCH}.sh | awk '{print \$NF}'" 
     17                                             # ex: "cmd ${NEMO_TRUS}/batch/${NEMO_HPCC}.sh | awk '{print \$NF}'" 
    1818JOB_LIST=''                  # List all submitted jobs (to determine by `grep` if a job completed or not) 
    1919JOB_INFO=''               # Get job informations          with job ID as argument (filling a computation log) 
     
    2727 
    2828# Architecture environment (be careful with compliance with XIOS) 
    29 ARCH_ENV=''                               # ${DIR_WORK}/XIOS/arch/arch-${CFG_ARCH}.env 
     29ARCH_ENV=''                               # ${DIR_WORK}/XIOS/arch/arch-${NEMO_HPCC}.env 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/user_template.cfg

    r5627 r5644  
    77[ -z "${CONF_REFE}" ] && REFE_CONF=''        # ex: 'ORCA2_LIM_PISCES', 'GYRE', ... 
    88[ -z "${CONF_TEST}" ] && TEST_CONF=''        # ex: "${CONF_REFE}_trust", ... 
    9 [ -z "${FORC_TARF}" ] && FORC_TARF=''     # Archive name (ex: 'ORCA2_LIM_nemo_v3.6.tar', ...), let blank if not requested 
     9[ -z "${NEMO_TARF}" ] && NEMO_TARF=''     # Archive name (ex: 'ORCA2_LIM_nemo_v3.6.tar', ...), let blank if not requested 
    1010NEMO_HOME=''                              # NEMOGCM directory for computation (./ARCH, ./CONFIG, ...) 
    1111                                             # ex: ".../NEMO/${NEMO_BRAN}/NEMOGCM", ... 
     
    1717                                             # ex: ".../${CONF_REFE}/${NEMO_BRAN}" 
    1818TEST_DIR=''                  # Test       folder for computation 
    19                                              # ex: ".../${CONF_REFE}/${NEMO_BRAN}/trusting_${DATE_STR}" 
     19                                             # ex: ".../${CONF_REFE}/${NEMO_BRAN}/trusting_${DATE}" 
    2020 
    2121# External softs directories: 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/install_dir.sh

    r5542 r5644  
    33#settings 
    44/ccc/work/cont003/gen7451/martin/NEMO/ 
    5 branches/2015/nemo_v3_6_STABLE 
     5NEMO_BRAN=branches/2015/nemo_v3_6_STABLE 
    66 
    7 X64_CURIE_trust 
     7X64_CURIE_cron 
    88 
    99cd /ccc/work/cont003/gen7451/martin/NEMO 
    1010mkdir -p ${}/NEMOGCM 
    1111 
    12 for elmt in ARCH CONFIG NEMO EXTERNAL/IOIPSL EXTERNAL/fcm TOOLS ; do 
    13     svn co http://forge.ipsl.jussieu.fr/nemo/svn/${}/NEMOGCM/$elmt ${}/NEMOGCM/$elmt 
     12for elmt in 'ARCH' 'CONFIG' 'NEMO' 'EXTERNAL/IOIPSL' 'EXTERNAL/fcm' 'TOOLS' 'TRUST'; do 
     13    svn_bran=${NEMO_BRAN} 
     14    [ "$elmt" == 'TRUST' ] && svn_bran='branches/2015/dev_r5092_CNRS_SETTE' 
     15    svn co http://forge.ipsl.jussieu.fr/nemo/svn/${svn_bran}/NEMOGCM/$elmt ${}/NEMOGCM/$elmt 
     16 
    1417done 
    1518 
    1619cd NEMOGCM/TOOLS 
    17 cp -f ../../../trunk/NEMOGCM/ARCH/CNRS/arch-X64_CURIE_trust.fcm ../ARCH 
    18 ./maketools -m ${} -n REBUILD_NEMO > /dev/null 
    1920 
    2021for elmt in $( ls * ); do 
    2122    [ ! $( echo $elmt | grep "COMPILE\|maketools\|REBUILD_NEMO" ) ] && rm -rf $elmt 
    2223done 
     24 
     25if [ find ../ARCH -name  ] 
     26./maketools -m ${} -n REBUILD_NEMO > /dev/null 
     27 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env

    r5629 r5644  
    22 
    33 
    4 ## Time-stamp 
    5 date_test=$( date ) 
    6 export DATESTR=$( date -ud "${date_test}" +%Y%m%d%Z%H%M ) 
     4## Time-stamp & filename pattern 
     5dat=$( date ) 
     6export DATE=$( date -ud "$dat" +"%Y%m%d%Z%H%M" ) 
     7export PATTERNAME=${NEMO_USER}'_'${NEMO_HPCC} 
    78 
    89## Sourcing user configuration 
    910##-------------------------------------- 
    10 . ${NEMO_TRUS}/config/${CFG_USER}.cfg 
     11. ${NEMO_TRUS}/config/${NEMO_USER}.cfg 
    1112export NEMO_HOME NEMO_BRAN 
    1213export REFE_CONF TEST_CONF REFE_DIR TEST_DIR 
    1314export DIR_XIOS  #DIR_OASI 
    14 export NEMO_FORC FORC_TARF 
     15export NEMO_FORC NEMO_TARF 
    1516export EMAIL 
    1617 
     
    2526## Sourcing super-computer configuration 
    2627##-------------------------------------- 
    27 . ${NEMO_TRUS}/config/${CFG_ARCH}.cfg 
     28. ${NEMO_TRUS}/config/${NEMO_HPCC}.cfg 
    2829export CDO      COMPILER MPI      NETCDF 
    2930export JOB_SUBM JOB_LIST JOB_INFO JOB_TIME JOB_DELE 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh

    r5637 r5644  
    22 
    33 
     4cd $( dirname $0 ) 
     5 
    46## Set defaults 
    57##--------------------------------------------------- 
    6 NEMO_TRUS=$( pwd $( dirname $0 ) ) 
     8NEMO_TRUS=$( pwd ) 
    79DEBUG=0; PUBLISH=0 
    810I_MODULE=0      ## No 'module' command by default 
     
    1315while [ $# -ne 0 ]; do 
    1416    case $1 in 
    15    -a|--archive) FORC_TARF=$2         ; shift 2;; -b|--branch ) NEMO_BRAN=$2         ; shift 2;; 
     17   -a|--archive) NEMO_TARF=$2         ; shift 2;; -b|--branch ) NEMO_BRAN=$2         ; shift 2;; 
    1618   -d|--debug  ) set -vx; DEBUG=1     ; shift  ;; -e|--email  ) EMAIL=$2             ; shift 2;; 
    1719   -j|--job    ) NPROC=$2             ; shift 2;; -h|--help   ) cat trusting_help.txt; exit  1;; 
    18    -m|--machine) CFG_ARCH=$2          ; shift 2;; -n|--newconf) TEST_CONF=$2         ; shift 2;; 
     20   -m|--machine) NEMO_HPCC=$2         ; shift 2;; -n|--newconf) TEST_CONF=$2         ; shift 2;; 
    1921   -r|--refconf) REFE_CONF=$2         ; shift 2;; -t|--time   ) TIME_LIMI=$2         ; shift 2;; 
    20    -p|--publish) PUBLISH=1            ; shift  ;; -u|--user   ) CFG_USER=$2          ; shift 2;; 
     22   -p|--publish) PUBLISH=1            ; shift  ;; -u|--user   ) NEMO_USER=$2         ; shift 2;; 
    2123   -v|--version) NEMO_VERS=$2         ; shift 2;;            *) cat trusting_help.txt; exit  1;; 
    2224    esac 
     
    2527## Initialization (super-computer & user environment) 
    2628##--------------------------------------------------- 
    27 if [[ ! -z "${CFG_ARCH}" && ! -z "${CFG_USER}" ]]; then 
     29if [[ ! -z "${NEMO_HPCC}" && ! -z "${NEMO_USER}" ]]; then 
    2830 
    29     if   [ ! $( find ${NEMO_TRUS}/config -name ${CFG_USER}.cfg ) ]; then 
    30    echo 'No configuration file in '${NEMO_TRUS}'/config for '${CFG_USER}; exit 1 
    31     elif [ ! $( find ${NEMO_TRUS}/config -name ${CFG_ARCH}.cfg ) ]; then 
    32    echo 'No configuration file in '${NEMO_TRUS}'/config for '${CFG_ARCH}; exit 1 
     31    if   [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_USER}'.cfg' ) ]; then 
     32   echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_USER}; exit 1 
     33    elif [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_HPCC}'.cfg' ) ]; then 
     34   echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_HPCC}; exit 1 
    3335    else 
    3436   . ${NEMO_TRUS}/trusting.env 
     
    4143. ./trusting_func.sh 
    4244 
    43 ##  
     45## Summary of trusting test context 
    4446##--------------------------------------------------- 
     47printf "\ 
     48NEMO Trusting test:\n\ 
     49-------------------\n\ 
     50Testing ${TEST_CONF} based on ${REFE_CONF} from ${NEMO_BRAN}\n\ 
     51Configuration files: ${NEMO_USER}.cfg & ${NEMO_HPCC}.cfg\n" 
     52 
     53## Making timestamped directory with messenger files 
     54##--------------------------------------------------- 
     55print_step 'Time-stamp generation & testing directory creation' 
    4556mkdir -p ${TEST_DIR} ${REFE_DIR} 
    4657echo ${TEST_DIR} && cd ${TEST_DIR} 
    47 date_str=$( date -ud ${DATESTR} +"%F %R %Z" ) 
    48 printf "Date\n${date_str}\n" > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt 
     58init_files && get_date 
    4959 
    5060## SVN action on XIOS & NEMO essentials directories 
    5161##--------------------------------------------------- 
    52 print_step 'SVN actions on NEMO directories' 
     62print_step 'SVN command on NEMO directories:' 
    5363get_nemo_rev 
    5464 
    5565## Check softwares versions (source arch environment) 
    5666##--------------------------------------------------- 
    57 print_step 'Get softwares release' 
     67print_step 'Get softwares releases' 
    5868[ -e ${ARCH_ENV} ] && . ${ARCH_ENV} > /dev/null 
    59 [ $? -eq 0 ] && I_MODULE=1 
    60 export I_MODULE 
     69(( $? == 0  )) && export I_MODULE=1 
    6170get_soft_rel 
    6271cat model.log 
     
    6473## XIOS compiling 
    6574##--------------------------------------------------- 
    66 print_step 'Compiling XIOS' 
     75print_step 'Compile XIOS' 
    6776cd ${DIR_XIOS} 
    6877full=''; [ $DEBUG -eq 0 ] && full='--full' 
    69 ./make_xios $full --arch ${CFG_ARCH} --job $NPROC >& /dev/null 
     78./make_xios $full --arch ${NEMO_HPCC} --job $NPROC >& /dev/null 
    7079[ ! -e ${DIR_XIOS}/lib/libxios.a ] && get_out 1 
    7180 
    7281## NEMO config compiled from scratch 
    7382##--------------------------------------------------- 
    74 print_step "Compiling ${REFE_CONF} configuration" 
     83print_step "Compile ${REFE_CONF} configuration" 
    7584cd ${NEMO_CONF} 
    7685[[ -d ${TEST_CONF} && $DEBUG -eq 0 ]] && ./makenemo -n ${TEST_CONF} clean >  /dev/null 
    77 ./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m ${CFG_ARCH} -j $NPROC       >& /dev/null 
     86./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m ${NEMO_HPCC} -j $NPROC      >& /dev/null 
    7887[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out 2 
    7988 
    8089## Get namelists, xml & forcing files for running 
    8190##--------------------------------------------------- 
    82 print_step "Preparing job by copying ${REFE_CONF} input files" 
     91print_step 'Set job (copying & extracting input files)' 
    8392cd ${TEST_DIR} 
    8493find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \; 
    8594get_inputs 
    86 [ $? -ne 0 ] && get_out 3 
     95(( $? != 0 )) && get_out 3 
    8796[ $( find . -name '*.gz' -print -quit ) ] && gunzip *.gz 
    8897 
    8998## Check input files in all cases 
    9099##--------------------------------------------------- 
    91 print_step 'Difference with standard input files list' 
     100print_step 'Compare with standard input files list' 
    92101diff_inputs 
    93102 
    94103## Job submission & computing 
    95104##--------------------------------------------------- 
    96 print_step 'Submitting job' 
     105print_step 'Submit job' 
    97106JOB_ID=$( eval ${JOB_SUBM} ) 
    98 [ $? -ne 0 ] && get_out 4 
    99 print_step 'Holding/Running job' 
     107(( $? != 0 )) && get_out 4 
     108print_step 'Pending job' 
    100109job_pending 
    101110print_step 'Job finished' 
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh

    r5638 r5644  
    22 
    33 
    4 comments() { 
    5     state=$1; LAST_TIME_STEP=0 
    6  
    7     if [ "$state" == 'E R R O R' ]; then 
    8    [ -e time.step ] && LAST_TIME_STEP=$( cat time.step | tr -d ' ' ) 
    9    export LAST_TIME_STEP 
    10    [ -e ocean.output ] && line=$( grep -m1 -A4 "$state"   ocean.output | tr -d '\n' ) 
    11     else 
    12    [ -e ocean.output ] && line=$( grep -m1 -A2 "^ $state" ocean.output | tr -d '\n' ) 
    13     fi 
    14  
    15 #    if [[ -e ${REFE_DIR}/model.log && $( diff -q model.log ${REFE_DIR}/model.log ) ]]; then 
    16 #  line=$( diff model.log ${REFE_DIR}/model.log  | grep '>' | sed '{N;s/\n/<BR>/}' ) 
    17 #    fi 
    18  
    19     printf "Comments\n$line\n" | tee mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
    20 } 
    21  
    22  
    23 diff_inputs() { 
    24     mesg='Same' 
    25     for file in inputs_list.txt $( ls namelist_* ) $( ls *.xml ); do 
    26    diff -q $file ${REFE_DIR}/$file > /dev/null 
    27    [ $? -ne 0 ] && mesg='Different' 
    28     done 
    29  
    30     printf "Input files\n$mesg\n" | tee mesg_09_inputs_${CFG_USER}_${CFG_ARCH}.txt 
    31 } 
    32  
    33 diff_results() { 
    34     for file in ocean.output $( ls *.stat ); do 
    35    [ ! -e ${REFE_DIR}/$file ] && export ST='FAILED' && get_out 7 
    36    diff -q $file ${REFE_DIR}/$file 
    37    [ $? -ne 0 ] && export ST='FAILED' 
    38     done 
    39 } 
    40  
    41 diff_restart() { 
    42     [ ! -e  ${REFE_DIR}/time.step ] && export ST='FAILED' && get_out 9 
    43  
    44     export LAST_TIME_STEP=$( cat ${REFE_DIR}/time.step | tr -d [:space:] ) 
    45     echo 'Last time step of standard run: '${LAST_TIME_STEP} 
    46  
    47     if [ $( find -regex ".*_0+${LAST_TIME_STEP}_restart.*\.nc" -print -quit ) ]; then 
    48    base_name=$( find -regex ".*_0+${LAST_TIME_STEP}_restart.*\.nc" -print -quit | awk -F/ '{print $NF}' \ 
    49                 | sed "s/^\(.*\)$LAST_TIME_STEP\_restart.*/\1$LAST_TIME_STEP\_/"                         ) 
    50  
    51    for comp in restart restart_ice restart_trc; do 
    52        file=${base_name}${comp} && printf "$file.nc: " 
    53  
    54        nb_dom=$( find -name "${file}_[0-9]*.nc" | wc -l | awk '{print $1}' ) 
    55        if   [ ${nb_dom} -gt 1 ]; then 
    56       ${NEMO_TRBD}/rebuild_nemo -t $NPROC $file ${nb_dom} > /dev/null 
    57       [ $? -eq 0 ] && rm -f ${base_name}${comp}_[0-9]*.nc > /dev/null 
    58        elif [ ${nb_dom} -eq 0 ]; then 
    59       export ST='FAILED' && get_out 10 
    60        fi 
    61  
    62        if [ -e ${REFE_DIR}/$file.nc ]; then 
    63        ## UNIX `cmp` not suitable (filename & timestamp in .nc file) 
    64       nc_diff=$( $CDO diffn $file.nc ${REFE_DIR}/$file.nc 2> /dev/null \ 
    65                  | awk '/records/ {print $1}'                           ) 
    66  
    67       if [[ ! -z ${nc_diff} && ${nc_diff} -ne 0 ]]; then 
    68           export ST='FAILED' 
    69           printf "$CDO ${nc_diff}\n" 
    70       else 
    71           printf "identical\n" 
    72       fi 
    73  
    74        else 
    75       export ST='FAILED' && get_out 9 
    76        fi 
    77  
    78    done 
    79  
    80     else 
    81    export ST='FAILED' 
    82     fi 
    83  
    84 } 
    85  
    86 get_cpu_time() { 
    87     real_cpu_time=$( eval ${JOB_TIME} ) 
    88     printf "Real CPU time\n${real_cpu_time}\n" | tee mesg_10_cputime_${CFG_USER}_${CFG_ARCH}.txt 
    89 } 
    90  
    91 get_inputs() { 
    92     if [ ! -z "${FORC_TARF}" ]; then 
    93    cmd_iol="tar -tvf ${NEMO_FORC}/${FORC_TARF}"; cmd_iof="tar -vxf ${NEMO_FORC}/${FORC_TARF}" 
    94     else 
    95    cmd_iol="ls ${NEMO_FORC}/*"                 ; cmd_iof="\cp ${NEMO_FORC}/* ." 
    96     fi 
    97  
    98     ${cmd_iol} > inputs_list.txt && ${cmd_iof} > /dev/null 
    99 } 
    100  
    101 get_soft_rel() { 
    102     for soft in $CDO $COMPILER $MPI $NETCDF; do 
    103    soft_rel='' 
    104         ((   ${I_MODULE} == 1   )) && soft_rel=$( echo $LOADEDMODULES | sed "s/.*$soft\([0-9.a-z_]*\).*/\1/i" ) 
    105    [    -z "${soft_rel}"    ] && soft_rel=$( echo $PATH          | sed "s/.*$soft\([0-9.a-z_]*\).*/\1/i" ) 
    106    [ "$soft" == "$COMPILER" ] && soft_rel=$( $soft --version     | grep -m1 -oe '\<[0-9. ]*\>'           ) 
    107    # Cleaning characters string to display proper soft name 
    108    soft=$( echo $soft | sed 's#\\##; s#[/-]$##' ) 
    109    echo $soft ${soft_rel} >> model.log 
    110     done 
    111  
    112     sed -n 4p model.log | sed 'i\Fortran compiler' > mesg_06_compiler_${CFG_USER}_${CFG_ARCH}.txt 
    113     sed -n 5p model.log | sed 'i\MPI libs'         > mesg_07_mpi_${CFG_USER}_${CFG_ARCH}.txt 
    114     sed -n 6p model.log | sed 'i\NetCDF libs'      > mesg_08_netcdf_${CFG_USER}_${CFG_ARCH}.txt 
     4## Messenger filenames 
     5FILE_DATE=mesg_01_date_$PATTERNAME.txt    ; FILE_STAT=mesg_02_status_$PATTERNAME.txt 
     6FILE_RESU=mesg_03_result_$PATTERNAME.txt  ; FILE_NEMO=mesg_04_nemogcm_$PATTERNAME.txt 
     7FILE_XIOS=mesg_05_xios_$PATTERNAME.txt    ; FILE_COMP=mesg_06_compiler_$PATTERNAME.txt 
     8FILE_MPIN=mesg_07_mpi_$PATTERNAME.txt     ; FILE_NCDF=mesg_08_netcdf_$PATTERNAME.txt 
     9FILE_INPT=mesg_09_inputs_$PATTERNAME.txt  ; FILE_CPUT=mesg_10_cputime_$PATTERNAME.txt 
     10FILE_COMM=mesg_11_comments_$PATTERNAME.txt; 
     11 
     12##  
     13FILE_TRUS=trusting_${DATE}_$PATTERNAME.txt; FILE_ARCH=trusting_${DATE}_$PATTERNAME.tar.gz 
     14 
     15print_step() { printf "\nStep.....\n$1\n"; } 
     16 
     17init_files() { 
     18    echo 'Date'        > ${FILE_DATE}; echo 'Status'           > ${FILE_STAT} 
     19    echo 'Result'      > ${FILE_RESU}; echo 'NEMOGCM rev.'     > ${FILE_NEMO} 
     20    echo 'XIOS rev.'   > ${FILE_XIOS}; echo 'Fortran compiler' > ${FILE_COMP} 
     21    echo 'MPI libs'    > ${FILE_MPIN}; echo 'NetCDF libs'      > ${FILE_NCDF} 
     22    echo 'Input files' > ${FILE_INPT}; echo 'Real CPU time'    > ${FILE_CPUT} 
     23    echo 'Comments'    > ${FILE_COMM} 
     24} 
     25 
     26get_date() { 
     27    local dat=$( date -ud ${DATE} +"%F %R %Z" ) 
     28 
     29    echo $dat >> ${FILE_DATE} 
    11530} 
    11631 
    11732get_nemo_rev() { 
    118     svn_opt='status' 
     33    local rev_loc svn_cmd 
     34    local rev=0 svn_opt='status' 
    11935 
    12036    ## If -v|--version option has been set, modify svn command 
     
    12945    fi 
    13046 
    131     rev=0 
    13247    for dir in ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_ENGI} \ 
    13348               ${NEMO_EIOI} ${NEMO_EFCM}              \ 
     
    13853   if [ "$dir" == "${DIR_XIOS}" ]; then 
    13954       rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' ) 
    140        echo   'XIOS '${rev_loc} >> model.log 
    141        printf "XIOS rev.\n"     >  mesg_05_xios_${CFG_USER}_${CFG_ARCH}.txt 
    142        printf "<a href=\"https://forge.ipsl.jussieu.fr/ioserver/changeset/${rev_loc}\" target=\"_blank\">${rev_loc}</a>" \ 
    143                                 >> mesg_05_xios_${CFG_USER}_${CFG_ARCH}.txt 
     55       echo 'XIOS '${rev_loc} >> model.log 
     56       echo "<a href=\"https://forge.ipsl.jussieu.fr/ioserver/changeset/${rev_loc}\" target=\"_blank\">${rev_loc}</a>" \ 
     57      >> ${FILE_XIOS} 
    14458       continue 
    14559   fi 
    14660 
    147    echo ${svn_cmd} $dir': '$( ${svn_cmd} $dir ) 
     61   echo $dir 
     62   ${svn_cmd} $dir 
    14863   rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' ) 
    14964   (( ${rev_loc} >= $rev )) && rev=${rev_loc} 
    15065    done 
    15166 
    152     echo   'NEMOGCM '$rev   >> model.log 
    153     printf "NEMOGCM rev.\n" >  mesg_04_nemogcm_${CFG_USER}_${CFG_ARCH}.txt 
    154     printf "<a href=\"https://forge.ipsl.jussieu.fr/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" \ 
    155                        >> mesg_04_nemogcm_${CFG_USER}_${CFG_ARCH}.txt 
     67    echo 'NEMOGCM '$rev   >> model.log 
     68    echo "<a href=\"https://forge.ipsl.jussieu.fr/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" \ 
     69   >> ${FILE_NEMO} 
     70} 
     71 
     72get_soft_rel() { 
     73    local soft_rel 
     74 
     75    for soft in $CDO $COMPILER $MPI $NETCDF; do 
     76   soft_rel='' 
     77        ((   ${I_MODULE} == 1   )) && soft_rel=$( echo $LOADEDMODULES | sed "s/.*$soft\/\([0-9.a-z_]*\).*/\1/i" ) 
     78   [    -z "${soft_rel}"    ] && soft_rel=$( echo $PATH          | sed "s/.*$soft\([0-9.a-z_]*\).*/\1/i"   ) 
     79   [ "$soft" == "$COMPILER" ] && soft_rel=$( $soft --version     | grep -m1 -oe '\<[0-9. ]*\>'             ) 
     80   ## Cleaning characters string to display proper soft name 
     81   soft=$( echo $soft | sed 's#\\##g; s#[/-]$##' ) 
     82   echo $soft ${soft_rel} >> model.log 
     83    done 
     84 
     85    sed -n 4p model.log > ${FILE_COMP}; sed -n 5p model.log > ${FILE_MPIN}; sed -n 6p model.log > ${FILE_NCDF} 
     86} 
     87 
     88get_inputs() { 
     89    local cmd_iol="tar -tvf ${NEMO_FORC}/${NEMO_TARF}"; cmd_iof="tar -vxf ${NEMO_FORC}/${NEMO_TARF}" 
     90 
     91    [ -z "${NEMO_TARF}" ] && cmd_iol="ls ${NEMO_FORC}/*" && cmd_iof="\cp ${NEMO_FORC}/* ." 
     92    ${cmd_iol} > inputs_list.txt && ${cmd_iof} > /dev/null 
     93} 
     94 
     95diff_inputs() { 
     96    local dif 
     97    local mesg='Same' 
     98 
     99    for file in inputs_list.txt $( ls namelist_* ) $( ls *.xml ); do 
     100   dif='' 
     101   if [ -e ${REFE_DIR}/$file ]; then dif=$( diff -q $file ${REFE_DIR}/$file ); else dif=0; fi 
     102   if [ -n "$dif" ]; then mesg='Different'; [ "$dif" != '0' ] && echo $dif | tee -a ${FILE_COMM}; fi 
     103    done 
     104 
     105    echo $mesg | tee -a ${FILE_INPT} 
     106} 
     107 
     108job_pending() { 
     109    local time_elapsed=0; time_increment=30 
     110 
     111    sleep ${time_increment} 
     112 
     113    while [[ $( ${JOB_LIST} | grep ${JOB_ID} ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do 
     114   printf "\n####################################################\n" >> computation.log 
     115   ${JOB_INFO} ${JOB_ID}                                             >> computation.log 
     116   sleep ${time_increment} 
     117   time_elapsed=$(( ${time_elapsed} + ${time_increment} )) 
     118    done 
     119 
     120    sleep ${time_increment} 
     121 
     122    if [ ${time_elapsed} -eq ${TIME_LIMI} ]; then 
     123   ${JOB_DELE} ${JOB_ID} &> /dev/null 
     124   TIME_LIMIT=$(( ${TIME_LIMI} / 3600 )) 
     125#  export TIME_LIMIT 
     126   get_out 6 
     127    fi 
     128} 
     129 
     130diff_results() { 
     131    for file in ocean.output $( ls *.stat ); do 
     132   [ ! -e ${REFE_DIR}/$file ] && export ST='FAILED' && get_out 7 
     133   diff -q $file ${REFE_DIR}/$file | tee -a ${FILE_COMM} 
     134   (( $? != 0 )) && export ST='FAILED' 
     135    done 
     136} 
     137 
     138diff_restart() { 
     139    local base_name file nb_dom diff_rcd 
     140 
     141    [ ! -e  ${REFE_DIR}/time.step ] && export ST='FAILED' && get_out 9 
     142 
     143#    export LAST_TIME_STEP=$( cat ${REFE_DIR}/time.step | tr -d [:space:] ) 
     144    LAST_TIME_STEP=$( cat ${REFE_DIR}/time.step | tr -d [:space:] ) 
     145    echo 'Last time step of standard run: '${LAST_TIME_STEP} 
     146 
     147    if [ $( find -regex ".*_0+${LAST_TIME_STEP}_restart.*\.nc" -print -quit ) ]; then 
     148   base_name=$( find -regex ".*_0+${LAST_TIME_STEP}_restart.*\.nc" -print -quit | awk -F/ '{print $NF}' \ 
     149                | sed "s/^\(.*\)$LAST_TIME_STEP\_restart.*/\1$LAST_TIME_STEP\_/"                         ) 
     150 
     151   for comp in restart restart_ice restart_trc; do 
     152       file=${base_name}${comp} && printf "$file.nc: " 
     153 
     154       nb_dom=$( find -name "${file}_[0-9]*.nc" | wc -l | awk '{print $1}' ) 
     155       if   [ ${nb_dom} -gt 1 ]; then 
     156      ${NEMO_TRBD}/rebuild_nemo -t $NPROC $file ${nb_dom} > /dev/null 
     157      [ $? -eq 0 ] && rm -f ${base_name}${comp}_[0-9]*.nc > /dev/null 
     158       elif [ ${nb_dom} -eq 0 ]; then 
     159      export ST='FAILED' && get_out 10 
     160       fi 
     161 
     162       if [ -e ${REFE_DIR}/$file.nc ]; then 
     163       ## UNIX `cmp` not suitable (filename & timestamp in .nc file) 
     164#     diff_rcd=$( $CDO diffn $file.nc ${REFE_DIR}/$file.nc 2> /dev/null \ 
     165#                | awk '/records/ {print $1}'                           ) 
     166      diff_rcd=$( $CDO diffn $file.nc ${REFE_DIR}/$file.nc 2> /dev/null \ 
     167                 | awk '/records/ {print $0}'                           ) 
     168 
     169#     if [[ ! -z ${diff_rcd} && ${diff_rcd} -ne 0 ]]; then 
     170      if [[ ! -z ${diff_rcd} && $( echo ${diff_rcd} | awk '{print $1}') -ne 0 ]]; then 
     171          export ST='FAILED' 
     172          echo $CDO $( echo ${diff_rcd} | sed 's/differ$/differ,/' | tr -d '\n' ) 
     173#         printf "$CDO ${diff_rcd}\n" 
     174      else 
     175          echo 'identical' 
     176#         printf "identical\n" 
     177      fi 
     178 
     179       else 
     180      export ST='FAILED' && get_out 9 
     181       fi 
     182 
     183   done 
     184 
     185    else 
     186   export ST='FAILED' 
     187    fi 
     188 
     189} 
     190 
     191get_cpu_time() { 
     192    local real_cpu_time=$( eval ${JOB_TIME} ) 
     193 
     194    echo ${real_cpu_time} | tee -a ${FILE_CPUT} 
     195} 
     196 
     197comments() { 
     198    local state=$1 
     199 
     200    if [ "$state" == 'E R R O R' ]; then 
     201   [ -e time.step ] && LAST_TIME_STEP=$( cat time.step | tr -d ' ' ) 
     202#  export LAST_TIME_STEP 
     203   [ -e ocean.output ] && line=$( grep -m1 -A4 "$state"   ocean.output | tr -d '\n' ) 
     204   echo $line >> ${FILE_COMM} 
     205    else 
     206   [ -e ocean.output ] && line=$( grep -m1 -A2 "^ $state" ocean.output | tr -d '\n' ) 
     207    fi 
     208 
     209    echo $line 
    156210} 
    157211 
    158212mesg_make() { 
    159     paste -d ';' mesg_*_${CFG_USER}_${CFG_ARCH}.txt > trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.txt 
    160     cat                                               trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.txt 
     213    paste -d ';' mesg_*.txt > ${FILE_TRUS} 
     214    cat                       ${FILE_TRUS} 
    161215} 
    162216 
    163217mesg_publish() { 
    164    
    165 if [ $PUBLISH -eq 1 ]; then 
    166  
    167   if [ -f ${REFE_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt ]; then cmd='tail -1'; else cmd='cat'; fi 
    168  
    169   $cmd trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.txt >> ${REFE_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt 
     218    local cmd 
     219 
     220    if [ $PUBLISH -eq 1 ]; then 
     221 
     222   if [ -f ${REFE_DIR}/trusting_$PATTERNAME.txt ]; then cmd='tail -1'; else cmd='cat'; fi 
     223 
     224   $cmd ${FILE_TRUS} >> ${REFE_DIR}/trusting_$PATTERNAME.txt 
    170225 
    171226  ## Send mail only when FAILED 
    172   if [[ ! -z $EMAIL && "$ST" == 'FAILED' ]]; then 
    173       cat << END_MAIL > trusting.mail 
     227   if [[ ! -z $EMAIL && "$ST" == 'FAILED' ]]; then 
     228       cat << END_MAIL > trusting.mail 
    174229XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
    175230 
     
    178233The trusting sequence for ${REFE_CONF} has failed. 
    179234Directory: ${TEST_DIR} 
    180 Archive created: trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.tar.gz 
     235Archive created: ${FILE_ARCH} in ${REFE_DIR} 
    181236 
    182237XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
    183238 
    184239END_MAIL 
    185  
    186       if [ -e ${TEST_DIR}/trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.txt ]; then 
    187      cat ${TEST_DIR}/trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.txt  >> trusting.mail 
    188       fi 
    189       mail -s "[trusting ${REFE_CONF} $BRANCH] $ST $ERR" $EMAIL  <  trusting.mail 
    190   fi 
    191  
    192 fi 
    193 } 
    194  
    195 print_step() { printf "Step.....\n$1\n"; } 
     240       [ -e ${TEST_DIR}/${FILE_TRUS} ] && cat ${TEST_DIR}/${FILE_TRUS} >> trusting.mail 
     241       mail -s "[trusting ${REFE_CONF} $BRANCH] $ST $ERR" $EMAIL       <  trusting.mail 
     242   fi 
     243 
     244    fi 
     245} 
    196246 
    197247get_out() { 
     
    199249 
    200250    cd ${TEST_DIR} 
    201     printf "Status\n$ST\n"  > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt 
     251    echo $ST >> ${FILE_STAT} 
    202252 
    203253    if [ "$ST" == 'FAILED' ]; then 
    204    file=mesg_09_inputs_${CFG_USER}_${CFG_ARCH}.txt 
    205    [ ! -e $file ] && printf "Input files\n\n"   > $file 
    206    file=mesg_10_cputime_${CFG_USER}_${CFG_ARCH}.txt 
    207    [ ! -e $file ] && printf "Real CPU time\n\n" > $file 
    208    file=mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt 
    209    [ ! -e $file ] && printf "Comments\n\n"      > $file 
    210254 
    211255        ## Error identification 
     
    227271    fi 
    228272 
    229     printf "Result\n$ERR\n" > mesg_03_result_${CFG_USER}_${CFG_ARCH}.txt 
     273    echo $ERR >> ${FILE_RESU} 
    230274 
    231275    ## Save tested configuration if trusting failed 
    232276    if [[ "$ST" == 'FAILED' && $DEBUG -eq 0 ]]; then 
    233    echo 'Creating archive 'trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.tar.gz' under '${REFE_DIR} 
    234    tar -czf ${REFE_DIR}/trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.tar.gz * 
     277   echo 'Creating archive '${FILE_ARCH}' under '${REFE_DIR} 
     278   tar -czf ${REFE_DIR}/${FILE_ARCH} ../* 
    235279    fi 
    236280 
     
    240284    exit 0 
    241285} 
    242  
    243 job_pending() { 
    244     time_elapsed=0; time_increment=30 
    245  
    246     sleep ${time_increment} 
    247     while [[ $( ${JOB_LIST} | grep ${JOB_ID} ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do 
    248    printf "\n####################################################\n" >> computation.log 
    249    ${JOB_INFO} ${JOB_ID}                                             >> computation.log 
    250    sleep ${time_increment} 
    251    time_elapsed=$(( ${time_elapsed} + ${time_increment} )) 
    252     done 
    253     sleep ${time_increment} 
    254  
    255     if [ ${time_elapsed} -eq ${TIME_LIMI} ]; then 
    256    ${JOB_DELE} ${JOB_ID} &> /dev/null 
    257    TIME_LIMIT=$(( ${TIME_LIMI} / 3600 )) 
    258    export ${TIME_LIMIT} 
    259    get_out $ST ERR=6 
    260     fi 
    261 } 
Note: See TracChangeset for help on using the changeset viewer.