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

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

dev_r5092_CNRS_SETTE Deal with use or not of environment modules system

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