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

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

dev_r5092_CNRS_SETTE Small improvments & drafting of remaining configurations addition

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