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

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

Last change on this file since 5444 was 5444, checked in by nicolasmartin, 9 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
[5355]33    if   [ ! $( find ${NEMO_TRUS}/cfg -name ${CFG_USER}.cfg ) ]; then
34   echo 'No configuration file in '${NEMO_TRUS}'/cfg for '${CFG_USER}; exit 1
35    elif [ ! $( find ${NEMO_TRUS}/cfg -name ${CFG_ARCH}.cfg ) ]; then
36   echo 'No configuration file in '${NEMO_TRUS}'/cfg for '${CFG_ARCH}; exit 1
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
[5444]54STATUS='FAILED'
[5355]55
[5444]56# SVN action on XIOS & NEMO essentials directories
57#---------------------------------------------------
58pstep "Get NEMO SVN state with: ${SVN_OPT}"
59get_nemo_rev
60
[5438]61# Check softwares versions (source arch environment)
[5355]62#---------------------------------------------------
[5438]63pstep 'Get softwares release'
64. ${ARCH_ENV} > /dev/null
[5424]65get_soft_rel
[5444]66cat model.log
[5268]67
[5444]68# XIOS compiling
[5355]69#---------------------------------------------------
[5444]70pstep 'Compiling XIOS'
71cd ${DIR_XIOS}
72#./make_xios --arch $ARCH -job $NPROC >& /dev/null
73
[5355]74# NEMO config compiled from scratch
75#---------------------------------------------------
[5438]76pstep "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
[5444]80[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out $STEP $STATUS
[5268]81
[5355]82# Get namelists, xml & forced files for running
83#---------------------------------------------------
[5438]84pstep '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
[5444]95[ $? -ne 0 ] && get_out $STEP $STATUS
[5402]96[ $( find . -name '*.gz' -print -quit ) ] && gunzip *.gz
[5286]97
[5438]98# Check input files in all cases
99#---------------------------------------------------
100pstep 'Test input files difference'
101diff_inputs
[5444]102get_out $STEP $STATUS
[5355]103# Job submission & computing
104#---------------------------------------------------
[5438]105pstep 'Running'
[5355]106job_num=$( ${JOB_SUBM} | awk '{print $NF}' )
[5444]107[ $? -ne 0 ] && get_out $STEP $STATUS
[5268]108
[5355]109time_elapsed=0; time_increment=30
[5268]110sleep ${time_increment}
[5402]111while [[ $( ${JOB_LIST} | grep ${job_num} ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do
[5286]112    printf "\n####################################################" >> computation.log
[5402]113    ${JOB_VIEW} ${job_num}                                          >> computation.log
[5268]114    sleep ${time_increment}
[5286]115    let time_elapsed+=${time_increment}
[5268]116done
[5402]117sleep ${time_increment}
[5268]118
[5355]119# Eventual crash during computing
120#---------------------------------------------------
[5438]121pstep 'Test if ASCII output files exist'
122if   [[ ! -f ocean.output || $( grep 'E R R O R' ocean.output ) ]]; then
123    ${JOB_DELE} ${job_num} &> /dev/null
[5444]124    [ ! -f ocean.output                  ] && STEP='nemo.exe crashed at initialization'
125    [ $( grep 'E R R O R' ocean.output ) ] && STEP='nemo.exe crashed'
[5438]126    comments('E R R O R')
[5402]127    ${JOB_DELE} ${job_num} >/dev/null 2>&1
[5444]128    STATUS='FAILED'
129    get_out $STEP $STATUS
[5438]130else
[5444]131    STATUS='OK'
[5286]132
[5438]133    # Inspect output text files
134    #---------------------------------------------------
135    pstep 'Test ASCII output files diff'
136    for file in ocean.output solver.stat tracer.stat; do
137   diff $file ${REFE_DIR}/$file
[5444]138   [ $? -ne 0 ] && STATUS='FAILED'
[5438]139    done
[5286]140
[5438]141    # Inspect output NetCDF files
142    #---------------------------------------------------
143    pstep 'Test last restart NetCDF files diff'
144    diff_restart #2> /dev/null
[5444]145    [ $? -ne 0 ] && STATUS='FAILED'
[5268]146
[5438]147    # Get computation duration
[5402]148    #---------------------------------------------------
[5438]149    pstep 'Get real CPU time'
150    get_cpu_time
[5268]151
[5438]152    comments('W A R N I N G')
[5268]153fi
154
[5355]155# End
156#---------------------------------------------------
[5444]157if [ $STATUS == 'FAILED' ]; then STEP='Test outputs difference'; else STEP='Code is reliable'; fi
158get_out $STEP $STATUS
Note: See TracBrowser for help on using the repository browser.