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

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

dev_r5092_CNRS_SETTE Add several annotations to comment script; worthy modifications to ending sequence

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