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 @ 5455

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