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

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

dev_r5092_CNRS_SETTE add namelists for AGRIF Agulhas

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