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

Last change on this file since 5683 was 5683, checked in by nicolasmartin, 9 years ago

dev_r5092_CNRS_SETTE Modifications for AGRIF Agulhas, bugfixes & more readability

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 5.2 KB
Line 
1#!/bin/bash
2
3
4cd $( dirname $0 )
5
6## Set defaults
7##---------------------------------------------------
8NEMO_TRUS=$PWD
9DEBUG=0; PUBLISH=0; TIME_STEP=0
10I_MODULE=0; ST='FAILED' ## No 'module' command & 'FAILED' status
11xios_full='--full'; stderr_redir='>&' ## DEBUG options
12
13
14## Get options for replacing some initials settings
15##---------------------------------------------------
16while [ $# -ne 0 ]; do
17
18    case $1 in
19   '-a'|'--archive') NEMO_TARF=$2    ; shift 2;; '-b'|'--branch ') NEMO_BRAN=$2         ; shift 2;;
20   '-d'|'--debug  ') set -vx; DEBUG=1; shift  ;; '-e'|'--email  ') EMAIL=$2             ; shift 2;;
21   '-j'|'--job    ') NPROC=$2        ; shift 2;; '-h'|'--help   ') cat trusting_help.txt; exit  1;;
22   '-m'|'--machine') NEMO_HPCC=$2    ; shift 2;; '-n'|'--newconf') TEST_CONF=$2         ; shift 2;;
23   '-r'|'--refconf') REFE_CONF=$2    ; shift 2;; '-t'|'--time   ') TIME_LIMI=$2         ; shift 2;;
24   '-p'|'--publish') PUBLISH=1       ; shift  ;; '-u'|'--user   ') NEMO_USER=$2         ; shift 2;;
25   '-v'|'--version') NEMO_VERS=$2    ; shift 2;; "*"             ) cat trusting_help.txt; exit  1;;
26    esac
27
28done
29
30
31## Initialization (super-computer & user environment)
32##---------------------------------------------------
33if [[ ! -z "${NEMO_HPCC}" && ! -z "${NEMO_USER}" ]]; then
34
35    if   [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_USER}'.cfg' ) ]; then
36   echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_USER}; exit 1
37    elif [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_HPCC}'.cfg' ) ]; then
38   echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_HPCC}; exit 1
39    else
40   . ${NEMO_TRUS}/trusting.env
41    fi
42
43else
44    cat ${NEMO_TRUS}/trusting_help.txt; exit 1
45fi
46
47. ./trusting_func.sh
48
49
50## Summary of trusting test context
51##---------------------------------------------------
52printf "\n\
53NEMO Trusting test:\n\
54-------------------\n\
55Testing ${TEST_CONF} based on ${REFE_CONF} from ${NEMO_BRAN}\n\
56NEMO installation: ${NEMO_USER}\n\
57Computing architecture: ${NEMO_HPCC}\n\
58Trusting SVN version: $( svn info | awk '(NR == 9) {print $NF}' )\n"
59
60
61## Making timestamped directory with messenger files
62##---------------------------------------------------
63print_step 'Time-stamp generation & testing directory creation'
64mkdir -p ${TEST_DIR} ${REFE_DIR}
65echo ${TEST_DIR} && cd ${TEST_DIR}
66init_files && get_date
67
68
69## SVN action on XIOS & NEMO essentials directories
70##---------------------------------------------------
71print_step 'SVN command on NEMO directories:'
72get_nemo_rev
73
74
75## Check softwares versions (source arch environment)
76##---------------------------------------------------
77print_step 'Get softwares releases'
78[ -e ${ARCH_ENV} ] && . ${ARCH_ENV} > /dev/null
79(( $? == 0  )) && export I_MODULE=1
80get_soft_rel
81cat model.log
82
83
84## XIOS compiling
85##---------------------------------------------------
86print_step 'Compile XIOS'
87cd ${DIR_XIOS}
88[ $DEBUG -eq 1 ] && xios_full='' && stderr_redir='>'
89eval ./make_xios ${xios_full} --arch ${NEMO_HPCC} --job $NPROC \
90    ${stderr_redir} /dev/null
91[ ! -e ${DIR_XIOS}/lib/libxios.a ] && get_out 1
92
93## NEMO config compiled from scratch
94##---------------------------------------------------
95print_step "Compile ${REFE_CONF} configuration"
96cd ${NEMO_CONF}
97
98if [[ -d ${TEST_CONF} && $DEBUG -eq 0 ]]; then
99    eval ./makenemo -n ${TEST_CONF} clean_config > /dev/null <<EOF
100y
101EOF
102fi
103
104eval ./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m ${NEMO_HPCC} -j $NPROC \
105                add_key ${KEYS_ADD} del_key ${KEYS_DEL}                   \
106    ${stderr_redir} /dev/null
107[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out 2
108
109
110## Get namelists, xml & forcing files for running
111##---------------------------------------------------
112print_step 'Set job (copying & extracting input files)'
113cd ${TEST_DIR}
114cp ${NEMO_CONF}/${TEST_CONF}/cpp_* .
115find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)' -exec cp {} . \;
116get_inputs
117(( $? != 0 )) && get_out 3
118[ $( find . -name '*.gz' -print -quit ) ] && find . -name '*.gz' -exec gunzip {} \;
119
120
121## Check input files in all cases
122##---------------------------------------------------
123print_step 'Compare with standard input files list'
124diff_inputs
125
126
127## Job submission & computing
128##---------------------------------------------------
129print_step 'Submit job'
130JOB_ID=$( eval ${JOB_SUBM} )
131(( $? != 0 )) && get_out 4
132print_step 'Pending job'
133job_pending
134print_step 'Job finished'
135
136
137## Job state
138##---------------------------------------------------
139print_step 'Test job state'
140
141if   [[ ! -e time.step || $( grep -q 'E R R O R' ocean.output ) ]]; then
142    echo 'Error'
143    comments 'E R R O R'
144    get_out 5
145else
146    echo 'Good'
147    ## Get time computation
148    ##---------------------------------------------------
149    print_step 'Get real CPU time'
150    get_cpu_time
151fi
152
153ST='OK' ## 'OK' by default
154
155
156## Inspect output text files
157##---------------------------------------------------
158print_step 'Test output files diff'
159diff_results
160
161
162## Inspect output NetCDF files
163##---------------------------------------------------
164print_step 'Test last restart files diff'
165diff_restart
166[ $ST == 'FAILED' ] && get_out 8
167
168
169## Get comments (ocean.output & diff model.log)
170##---------------------------------------------------
171comments 'W A R N I N G'
172
173
174## End
175##---------------------------------------------------
176get_out 'Code is reliable'
Note: See TracBrowser for help on using the repository browser.