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

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

dev_r5092_CNRS_SETTE Corrections in trusting.sh to recompile NEMO from scratch & find all gz archives

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