source: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh @ 5292

Last change on this file since 5292 was 5292, checked in by nicolasmartin, 6 years ago

dev_r5092_CNRS_SETTE Standalone TRUST directory for regular NEMO configuration testing

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 6.8 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
11DEBUG=0; PUBLISH=0; status='OK'
12
13# Get options to replace some initials settings
14while [ $# -ne 0 ]; do
15    case $1 in
16        -b|--branch ) NEMO_BRAN=$2         ; shift 2;; -d|--debug  ) set -vx; DEBUG=1     ; shift  ;;
17   -e|--email  ) MAIL=$2              ; shift 2;; -j|--job    ) NPROC=$2             ; shift 2;;
18   -h|--help   ) cat trusting_help.txt; exit   ;; -m|--machine) CFG_ARCH=$2          ; shift 2;;
19   -n|--newconf) CONF_TEST=$2         ; shift 2;; -r|--refconf) CONF_REFE=$2         ; shift 2;;
20   -t|--time   ) TIME_LIMI=$2         ; shift 2;; -p|--publish) PUBLISH=1            ; shift  ;;
21        -u|--user   ) CFG_USER=$2          ; shift 2;; -v|--version) NEMO_REVI=$2         ; shift 2;;
22                   *) cat trusting_help.txt; exit   ;;
23    esac
24done
25
26# Set super-computer & user environment
27[[ ! -z "${CFG_ARCH}" && ! -z "${CFG_USER}" ]] && . trusting.env || { ./trusting.sh -h && exit; }
28export DEBUG PUBLISH
29
30# Initialization
31#=============================================
32
33echo ${DIR_TEST}
34mkdir -p ${DIR_TEST} ${DIR_REFE}
35cd ${DIR_TEST}
36datestr1=$( LC_ALL=C date -d"$DATE_STR" +%Y-%m-%dT%H:%M )
37printf "Date\n%s\n"       $datestr1 > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt
38
39printf "Status\nFAILED\n"           > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt # Only at end status will change to OK
40
41. trusting_func.sh
42#=============================================
43
44
45#
46#=============================================
47for rel in $CDO $COMPILER $MPI $NETCDF; do
48    printf "Step......................\nGet $rel release\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
49                             arch_rel=$( echo $LOADEDMODULES | sed "s#.*:$rel/\([^:]*\).*#\1#" )
50    [ -z "${arch_rel}"  ] && arch_rel=$( echo $PATH          | sed "s#.*$rel/\([^/]*\).*#\1#"  )
51    [ $( echo $rel | grep "$CDO\|$COMPILER" ) ] && arch_rel=$( $rel --version | grep -m1 -o ' [0-9.]* ' )
52    echo $rel ${arch_rel} >> model.log
53done
54
55sed -n 1p model.log | sed 'i\Fortran compiler' > mesg_04_compiler_${CFG_USER}_${CFG_ARCH}.txt
56sed -n 2p model.log | sed 'i\MPI libraries   ' > mesg_05_mpi_${CFG_USER}_${CFG_ARCH}.txt
57sed -n 3p model.log | sed 'i\NetCDF libraries' > mesg_06_netcdf_${CFG_USER}_${CFG_ARCH}.txt
58
59
60#---------------------------------------------
61printf "Step......................\nCheckout XIOS, FCM-make(/EXTERNAL/fcm), NEMO engines (/NEMO) & configuration (/CONFIG)\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
62svn_cmd='svn status'
63
64# If -v|--version option has been set, modify svn command
65[ $( echo ${NEMO_VERS} | grep  "up\|update"         ) ] && svn_cmd='svn update'
66[ $( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) ] && svn_cmd='svn update -r '$( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' )
67
68rev=0
69for dir in ${DIR_XIOS} ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_EFCM} ${NEMO_ENGI} ${NEMO_IPSL} ${NEMO_TRUS} ${NEMO_TCMP}; do
70    [ $dir == ${DIR_XIOS} ] && echo 'XIOS '$( svn info $dir | awk '(NR == 9) {print $NF}' ) >> model.log && continue
71    ${svn_cmd} $dir
72    rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
73    (( ${rev_loc} >= $rev )) && rev=${rev_loc}
74done
75echo 'NEMO '$rev >> model.log
76
77
78#---------------------------------------------
79printf "Step......................\nCompilation NEMO configuration %s\n" ${CONF_REF} > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
80cd ${NEMO_CONF}
81. ${ARCH_ENV}     # Sourcing architecture environment
82#[ -d ${CONF_TEST} ] && ./makenemo -n ${CONF_TEST} clean
83./makenemo -n ${CONF_TEST} -r ${CONF_REFE} -m $ARCH -j $NPROC #> /dev/null 2>&1
84[ ! -e ${CONF_TEST}/BLD/bin/nemo.exe ] && getout
85
86
87#---------------------------------------------
88printf "Step......................\nPreparing job\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
89cd ${DIR_TEST}
90find ${NEMO_CONF}/${CONF_TEST}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
91
92if [ ! -z "${NEMO_FORC}" ]; then
93    cp ${NEMO_FORC}/${FORC_TAR} .
94    tar -tvf ${FORC_TAR} > inputs_list.txt && tar -vxf ${FORC_TAR}
95    [ $? -ne 0 ] && getout
96    gunzip *.gz
97else
98    touch inputs_list.txt
99fi
100
101
102#---------------------------------------------
103printf "Step......................\nRunning\n"       > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
104#${JOB_SUB} ${DIR_TEST}/../../batch.sh
105job_num=$( ${JOB_SUB} ${DIR_TEST}/../../batch.sh | awk '{print $NF}')
106[ $? -ne 0 ] && getout
107
108time_elapsed=0; time_increment=300
109sleep ${time_increment}
110while [[ $( ${JOB_LIST} | grep $job_num ) && ${time_elapsed} -lt ${TIME_LIMI} ]] ; do
111    printf "\n####################################################" >> computation.log
112    ${JOB_VIEW} $job_num                                            >> computation.log
113    sleep ${time_increment}
114    let time_elapsed+=${time_increment}
115done
116
117
118#---------------------------------------------
119printf "Step......................\nTest if ASCII output files exist\n"   > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
120if      [ ! -f ${output_test} ]; then
121
122    getout
123else if [  ]
124
125    grep 'E R R O R' ocean.output    >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
126    sed 's/^/Time step :/' time.step >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
127fi
128
129
130#---------------------------------------------
131printf "Step......................\nTest ASCII output files difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
132for file in ocean.output solver.stat tracer.stat; do
133    diff $file ${DIR_REFE}/$file
134    [ $? -ne 0 ] && status='FAILED'
135done
136
137
138#---------------------------------------------
139printf "Step......................\nTest last restart files difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
140diff_trusting 2>/dev/null
141[ $? -ne 0 ] && status='FAILED'
142
143
144#---------------------------------------------
145echo 'Comments'                    >  mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
146grep 'W A R N I N G:' ocean.output >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
147
148
149#---------------------------------------------
150if [ $status != 'FAILED' ]; then
151    printf "Step......................\nGet Real CPU time\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
152    real_cpu_time=$( ${JOB_VIEW} $job_num | awk 'END{print $9}')
153    printf "Real CPU time\n%s\n" ${real_cpu_time} > mesg_08_realcputime_${CFG_USER}_${CFG_ARCH}.txt
154else
155    printf "Step......................\nTest InputFiles difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
156    diff inputs_list.txt ${DIR_REFE}/inputs_list.txt
157    [ $? -ne 0 ] && getout
158    [[ $? -ne 0 && printf "InputFiles\n%s\n" "Different" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt ]] || printf "InputFiles\n%s\n" "Same" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
159fi
160
161
162#---------------------------------------------
163printf "Status\nOK\n" > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt
164printf "Step......................\nCode is reliable\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
165
166#---------------------------------------------
167getout
Note: See TracBrowser for help on using the repository browser.