source: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/SETTE/trusting.sh @ 5286

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

dev_r5092_CNRS_SETTE Major update with clear partition of architecture & user configuration

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