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

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

dev_r5092_CNRS_SETTE Few bugfixes & improvments, clarify displayed comments

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 5.0 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 by default
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"
53
54## Making timestamped directory with messenger files
55##---------------------------------------------------
56print_step 'Time-stamp generation & testing directory creation'
57mkdir -p ${TEST_DIR} ${REFE_DIR}
58echo ${TEST_DIR} && cd ${TEST_DIR}
59init_files && get_date
60
61## SVN action on XIOS & NEMO essentials directories
62##---------------------------------------------------
63print_step 'SVN command on NEMO directories:'
64get_nemo_rev
65
66## Check softwares versions (source arch environment)
67##---------------------------------------------------
68print_step 'Get softwares releases'
69[ -e ${ARCH_ENV} ] && . ${ARCH_ENV} > /dev/null
70(( $? == 0  )) && export I_MODULE=1
71get_soft_rel
72cat model.log
73
74## XIOS compiling
75##---------------------------------------------------
76print_step 'Compile XIOS'
77cd ${DIR_XIOS}
78[ $DEBUG -eq 1 ] && xios_full='' && stderr_redir='>'
79eval ./make_xios ${xios_full} --arch ${NEMO_HPCC} --job $NPROC ${stderr_redir} /dev/null
80[ ! -e ${DIR_XIOS}/lib/libxios.a ] && get_out 1
81
82## NEMO config compiled from scratch
83##---------------------------------------------------
84print_step "Compile ${REFE_CONF} configuration"
85cd ${NEMO_CONF}
86[[ -d ${TEST_CONF} && $DEBUG -eq 0 ]] && eval ./makenemo -n ${TEST_CONF} clean >               /dev/null
87eval ./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m ${NEMO_HPCC} -j $NPROC      ${stderr_redir} /dev/null
88[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out 2
89
90## Get namelists, xml & forcing files for running
91##---------------------------------------------------
92print_step 'Set job (copying & extracting input files)'
93cd ${TEST_DIR}
94find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
95get_inputs
96(( $? != 0 )) && get_out 3
97[ $( find . -name '*.gz' -print -quit ) ] && gunzip *.gz
98
99## Check input files in all cases
100##---------------------------------------------------
101print_step 'Compare with standard input files list'
102diff_inputs
103
104## Job submission & computing
105##---------------------------------------------------
106print_step 'Submit job'
107JOB_ID=$( eval ${JOB_SUBM} )
108(( $? != 0 )) && get_out 4
109print_step 'Pending job'
110job_pending
111print_step 'Job finished'
112
113## Job state
114##---------------------------------------------------
115print_step 'Test job state'
116if   [[ ! -e time.step || $( grep -q 'E R R O R' ocean.output ) ]]; then
117    echo 'Error'
118    comments 'E R R O R'
119    get_out 5
120else
121    echo 'Good'
122    ## Get time computation
123    ##---------------------------------------------------
124    print_step 'Get real CPU time'
125    get_cpu_time
126fi
127
128ST='OK' ## 'OK' by default
129
130## Inspect output text files
131##---------------------------------------------------
132print_step 'Test output files diff'
133diff_results
134
135## Inspect output NetCDF files
136##---------------------------------------------------
137print_step 'Test last restart files diff'
138diff_restart
139[ "$ST" == 'FAILED' ] && get_out 8
140
141## Get comments (ocean.output & diff model.log)
142##---------------------------------------------------
143comments 'W A R N I N G'
144
145## End
146##---------------------------------------------------
147get_out 'Code is reliable'
Note: See TracBrowser for help on using the repository browser.