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

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

dev_r5092_CNRS_SETTE Wide modifications on trusting_func.sh for clearness & other significant changes on different names

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