source: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh @ 5453

Last change on this file since 5453 was 5453, checked in by nicolasmartin, 5 years ago

dev_r5092_CNRS_SETTE Ping pong updates between Curie & Ada to finalize

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 5.4 KB
RevLine 
[5268]1#!/bin/bash
[5286]2#
3# Author: Patrick Brockmann
4# Contact: Patrick.Brockmann@cea.fr
5# History:
6# Modification: Nicolas-thierry.Martin@locean-ipsl.upmc.fr
7#
[5268]8
9
[5276]10# Set defaults
[5355]11#---------------------------------------------------
12NEMO_TRUS=$( pwd $( dirname $0 ) )
[5444]13DEBUG=0; PUBLISH=0; STATUS='OK'
[5268]14
[5355]15# Get options for replacing some initials settings
16#---------------------------------------------------
[5268]17while [ $# -ne 0 ]; do
18    case $1 in
[5286]19        -b|--branch ) NEMO_BRAN=$2         ; shift 2;; -d|--debug  ) set -vx; DEBUG=1     ; shift  ;;
20   -e|--email  ) MAIL=$2              ; shift 2;; -j|--job    ) NPROC=$2             ; shift 2;;
[5355]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;;
[5286]23   -t|--time   ) TIME_LIMI=$2         ; shift 2;; -p|--publish) PUBLISH=1            ; shift  ;;
[5383]24        -u|--user   ) CFG_USER=$2          ; shift 2;; -v|--version) NEMO_VERS=$2         ; shift 2;;
[5355]25                   *) cat trusting_help.txt; exit  1;;
[5268]26    esac
27done
[5276]28
[5355]29# Initialization (super-computer & user environment)
30#---------------------------------------------------
31if [[ ! -z "${CFG_ARCH}" && ! -z "${CFG_USER}" ]]; then
[5268]32
[5453]33    if   [ ! $( find ${NEMO_TRUS}/config -name ${CFG_USER}.cfg ) ]; then
34   echo 'No configuration file in '${NEMO_TRUS}'/config for '${CFG_USER}; exit 1
35    elif [ ! $( find ${NEMO_TRUS}/config -name ${CFG_ARCH}.cfg ) ]; then
36   echo 'No configuration file in '${NEMO_TRUS}'/config for '${CFG_ARCH}; exit 1
[5355]37    else
38   . ${NEMO_TRUS}/trusting.env
39    fi
[5268]40
[5355]41else
42    cat ${NEMO_TRUS}/trusting_help.txt; exit 1
43fi
[5268]44
[5355]45. ./trusting_func.sh
[5268]46
[5424]47#
48#---------------------------------------------------
[5355]49mkdir -p ${TEST_DIR} ${REFE_DIR}
50echo ${TEST_DIR} && cd ${TEST_DIR}
[5424]51datestr1=$( LC_ALL=C date -d"${DATE_STR}" +%Y-%m-%dT%H:%M )
[5438]52printf "Date\n$datestr1\n" > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt
[5355]53# Only at end status will change to OK
[5453]54STATUS='FAILED'; STEP=''
[5355]55
[5444]56# SVN action on XIOS & NEMO essentials directories
57#---------------------------------------------------
[5452]58print_step "Get NEMO SVN state with: ${SVN_OPT}"
[5444]59get_nemo_rev
60
[5438]61# Check softwares versions (source arch environment)
[5355]62#---------------------------------------------------
[5452]63print_step 'Get softwares release'
[5438]64. ${ARCH_ENV} > /dev/null
[5424]65get_soft_rel
[5453]66cat env.log
[5268]67
[5444]68# XIOS compiling
[5355]69#---------------------------------------------------
[5452]70print_step 'Compiling XIOS'
[5444]71cd ${DIR_XIOS}
72#./make_xios --arch $ARCH -job $NPROC >& /dev/null
73
[5355]74# NEMO config compiled from scratch
75#---------------------------------------------------
[5452]76print_step "Compiling ${CONF_REF} configuration"
[5276]77cd ${NEMO_CONF}
[5355]78#[ -d ${TEST_CONF} ] && ./makenemo -n ${TEST_CONF} clean
[5424]79./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m $ARCH -j $NPROC >& /dev/null
[5453]80[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out $STATUS $STEP
[5268]81
[5355]82# Get namelists, xml & forced files for running
83#---------------------------------------------------
[5452]84print_step 'Preparing job'
[5444]85cd ${TEST_DIR}
[5355]86find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
[5268]87
[5402]88if [ ! -z "${FORC_TAR}" ]; then
89    cmd_iol="tar -tvf ${NEMO_FORC}/${FORC_TAR}"; cmd_iof="tar -vxf ${NEMO_FORC}/${FORC_TAR}"
[5286]90else
[5402]91    cmd_iol="ls ${NEMO_FORC}/*"                ; cmd_iof="\cp ${NEMO_FORC}/* ."
[5286]92fi
[5268]93
[5402]94${cmd_iol} > inputs_list.txt && ${cmd_iof} > /dev/null
[5453]95[ $? -ne 0 ] && get_out $STATUS $STEP
[5402]96[ $( find . -name '*.gz' -print -quit ) ] && gunzip *.gz
[5286]97
[5438]98# Check input files in all cases
99#---------------------------------------------------
[5452]100print_step 'Test input files difference'
[5438]101diff_inputs
[5452]102
[5355]103# Job submission & computing
104#---------------------------------------------------
[5452]105print_step 'Running'
[5453]106JOB_ID=$( ${JOB_SUBM} | awk '{print $NF}' )
107export JOB_ID
108[ $? -ne 0 ] && get_out $STATUS $STEP
[5268]109
[5355]110time_elapsed=0; time_increment=30
[5268]111sleep ${time_increment}
[5452]112while [[ $( ${JOB_LIST} | grep ${JOB_ID} ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do
[5286]113    printf "\n####################################################" >> computation.log
[5453]114    ${JOB_VIEW} ${JOB_ID}                                           >> computation.log
[5268]115    sleep ${time_increment}
[5286]116    let time_elapsed+=${time_increment}
[5268]117done
[5402]118sleep ${time_increment}
[5268]119
[5355]120# Eventual crash during computing
121#---------------------------------------------------
[5452]122print_step 'Test if ASCII output files exist'
123if   [[ ! -e ocean.output || $( grep 'E R R O R' ocean.output ) ]]; then
124    ${JOB_DELE} ${JOB_ID} &> /dev/null
[5453]125    [ ! -e ocean.output                  ] && STEP='nemo.exe crashed at initialization'
126    [ $( grep 'E R R O R' ocean.output ) ] && STEP='nemo.exe crashed'
127    comments 'E R R O R'
[5452]128    ${JOB_DELE} ${JOB_ID} >/dev/null 2>&1
[5453]129    get_out $STATUS $STEP
[5438]130else
[5444]131    STATUS='OK'
[5286]132
[5438]133    # Inspect output text files
134    #---------------------------------------------------
[5452]135    print_step 'Test ASCII output files diff'
[5438]136    for file in ocean.output solver.stat tracer.stat; do
137   diff $file ${REFE_DIR}/$file
[5453]138   [ $? -ne 0 ] && STATUS='FAILED' && STEP='ASCII output file differ'
[5438]139    done
[5286]140
[5438]141    # Inspect output NetCDF files
142    #---------------------------------------------------
[5452]143    print_step 'Test last restart NetCDF files diff'
[5438]144    diff_restart #2> /dev/null
[5453]145    [ $? -ne 0 ] && STATUS='FAILED'
[5268]146
[5438]147    # Get computation duration
[5402]148    #---------------------------------------------------
[5452]149    print_step 'Get real CPU time'
[5438]150    get_cpu_time
[5268]151
[5453]152    comments 'W A R N I N G'
[5268]153fi
154
[5355]155# End
156#---------------------------------------------------
[5452]157[ $STATUS == 'OK' ] && STEP='Code is reliable'
[5453]158get_out $STATUS $STEP
Note: See TracBrowser for help on using the repository browser.