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

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