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

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

dev_r5092_CNRS_SETTE Nearing initial release by adding namelists & iodef files in comparison

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 7.5 KB
Line 
1#!/bin/bash
2#
3# Author: Patrick Brockmann
4# Contact: Patrick.Brockmann@cea.fr
5# History:
6# Modification: Nicolas-thierry.Martin@locean-ipsl.upmc.fr
7#
8
9
10# Set defaults
11#---------------------------------------------------
12NEMO_TRUS=$( pwd $( dirname $0 ) )
13SVN_CMD='svn status'
14DEBUG=0; PUBLISH=0; status='OK'
15
16# Get options for replacing some initials settings
17#---------------------------------------------------
18while [ $# -ne 0 ]; do
19    case $1 in
20        -b|--branch ) NEMO_BRAN=$2         ; shift 2;; -d|--debug  ) set -vx; DEBUG=1     ; shift  ;;
21   -e|--email  ) MAIL=$2              ; shift 2;; -j|--job    ) NPROC=$2             ; shift 2;;
22   -h|--help   ) cat trusting_help.txt; exit  1;; -m|--machine) CFG_ARCH=$2          ; shift 2;;
23   -n|--newconf) TEST_CONF=$2         ; shift 2;; -r|--refconf) REFE_CONF=$2         ; shift 2;;
24   -t|--time   ) TIME_LIMI=$2         ; shift 2;; -p|--publish) PUBLISH=1            ; shift  ;;
25        -u|--user   ) CFG_USER=$2          ; shift 2;; -v|--version) NEMO_VERS=$2         ; shift 2;;
26                   *) cat trusting_help.txt; exit  1;;
27    esac
28done
29
30#export DEBUG PUBLISH
31
32
33# Initialization (super-computer & user environment)
34#---------------------------------------------------
35if [[ ! -z "${CFG_ARCH}" && ! -z "${CFG_USER}" ]]; then
36
37    if   [ ! $( find ${NEMO_TRUS}/cfg -name ${CFG_USER}.cfg ) ]; then
38   echo 'No configuration file in '${NEMO_TRUS}'/cfg for '${CFG_USER}; exit 1
39    elif [ ! $( find ${NEMO_TRUS}/cfg -name ${CFG_ARCH}.cfg ) ]; then
40   echo 'No configuration file in '${NEMO_TRUS}'/cfg for '${CFG_ARCH}; exit 1
41    else
42   . ${NEMO_TRUS}/trusting.env
43    fi
44
45else
46    cat ${NEMO_TRUS}/trusting_help.txt; exit 1
47fi
48
49# If -v|--version option has been set, modify svn command
50[ $( echo ${NEMO_VERS} | grep  "up\|update"         ) ] && SVN_CMD='svn update'
51[ $( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) ] && SVN_CMD='svn update -r '$( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' )
52
53datestr1=$( LC_ALL=C date -d"${DATE_STR}" +%Y-%m-%dT%H:%M )
54. ./trusting_func.sh
55
56mkdir -p ${TEST_DIR} ${REFE_DIR}
57echo ${TEST_DIR} && cd ${TEST_DIR}
58printf "Date\n%s\n"       $datestr1 > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt
59# Only at end status will change to OK
60printf "Status\nFAILED\n"           > mesg_03_status_${CFG_USER}_${CFG_ARCH}.txt
61
62
63# Check softwares versions
64#---------------------------------------------------
65printf "Step......................\nGet softwares release\n"                     | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
66. ${ARCH_ENV} > /dev/null    # Sourcing architecture environment
67get_rel
68sed -n 2p model.log | sed 'i\Fortran compiler' | tee mesg_05_compiler_${CFG_USER}_${CFG_ARCH}.txt
69sed -n 3p model.log | sed 'i\MPI libraries   ' | tee mesg_06_mpi_${CFG_USER}_${CFG_ARCH}.txt
70sed -n 4p model.log | sed 'i\NetCDF libraries' | tee mesg_07_netcdf_${CFG_USER}_${CFG_ARCH}.txt
71
72
73# SVN action on XIOS & NEMO essentials directories
74#---------------------------------------------------
75printf "Step......................\nGet NEMO SVN revision with: ${SVN_CMD}\n"    | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
76get_rev
77sed -n 6p model.log | sed 'i\NEMO revision' > mesg_02_nemo_${CFG_USER}_${CFG_ARCH}.txt
78
79
80# NEMO config compiled from scratch
81#---------------------------------------------------
82printf "Step......................\nCompiling ${CONF_REF} configuration\n"       | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
83cd ${NEMO_CONF}
84#[ -d ${TEST_CONF} ] && ./makenemo -n ${TEST_CONF} clean
85./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m $ARCH -j $NPROC > /dev/null 2>&1
86[ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out
87
88
89# Get namelists, xml & forced files for running
90#---------------------------------------------------
91cd ${TEST_DIR}
92printf "Step......................\nPreparing job\n"                             | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
93find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
94
95if [ ! -z "${FORC_TAR}" ]; then
96    cmd_iol="tar -tvf ${NEMO_FORC}/${FORC_TAR}"; cmd_iof="tar -vxf ${NEMO_FORC}/${FORC_TAR}"
97else
98    cmd_iol="ls ${NEMO_FORC}/*"                ; cmd_iof="\cp ${NEMO_FORC}/* ."
99fi
100
101${cmd_iol} > inputs_list.txt && ${cmd_iof} > /dev/null
102[ $? -ne 0 ] && get_out
103[ $( find . -name '*.gz' -print -quit ) ] && gunzip *.gz
104
105
106# Job submission & computing
107#---------------------------------------------------
108printf "Step......................\nRunning\n"                                   | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt; echo ${JOB_SUBM}
109job_num=$( ${JOB_SUBM} | awk '{print $NF}' )
110[ $? -ne 0 ] && get_out
111
112time_elapsed=0; time_increment=30
113sleep ${time_increment}
114while [[ $( ${JOB_LIST} | grep ${job_num} ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do
115    printf "\n####################################################" >> computation.log
116    ${JOB_VIEW} ${job_num}                                          >> computation.log
117    sleep ${time_increment}
118    let time_elapsed+=${time_increment}
119done
120sleep ${time_increment}
121
122# Eventual crash during computing
123#---------------------------------------------------
124printf "Step......................\nTest if ASCII output files exist\n"          | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
125if   [ ! -f ocean.output                  ]; then
126    printf "Step......................\nOpa crashed at initialization\n"         | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
127    ${JOB_DELE} ${job_num} >/dev/null 2>&1
128    status='FAILED'
129elif [ $( grep 'E R R O R' ocean.output ) ]; then
130    printf "Step......................\nOpa crashed\n"                           | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
131    grep 'E R R O R'       ocean.output | tee    mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt
132    sed 's/^/Time step :/' time.step    | tee -a mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt
133    ${JOB_DELE} ${job_num} >/dev/null 2>&1
134    status='FAILED'
135fi
136
137
138# Inspect output text files
139#---------------------------------------------------
140printf "Step......................\nTest ASCII output files difference\n"        | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
141for file in ocean.output solver.stat tracer.stat; do
142    diff $file ${REFE_DIR}/$file
143    [ $? -ne 0 ] && status='FAILED'
144done
145
146
147# Inspect output NetCDF files
148#---------------------------------------------------
149printf "Step......................\nTest last restart NetCDF files difference\n" | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
150diff_restart 2>/dev/null
151[ $? -ne 0 ] && status='FAILED'
152
153
154# Finals tests
155#---------------------------------------------------
156if [ $status != 'FAILED' ]; then
157
158    # Comments
159    #---------------------------------------------------
160    echo 'Comments'                    | tee    mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt
161    grep 'W A R N I N G:' ocean.output | tee -a mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt
162
163    # Portability !
164    printf "Step......................\nGet real CPU time\n"                     | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
165    real_cpu_time=$( ${JOB_VIEW} ${job_num} | awk 'END{print $9}' )
166    printf "Real CPU time\n%s\n" ${real_cpu_time} | tee mesg_08_realcputime_${CFG_USER}_${CFG_ARCH}.txt
167else
168    printf "Step......................\nTest input files difference\n"           | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
169    diff_inputs
170    get_out
171fi
172
173
174# So far, everything is good
175#---------------------------------------------------
176printf "Status\nOK\n" > mesg_03_status_${CFG_USER}_${CFG_ARCH}.txt
177printf "Step......................\nCode is reliable\n"                          | tee mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
178
179
180# End
181#---------------------------------------------------
182get_out
Note: See TracBrowser for help on using the repository browser.