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

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

dev_r5092_CNRS_SETTE Update

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 5.9 KB
Line 
1#!/bin/bash
2
3
4# Set defaults
5DEBUG=0; PUBLISH=0; status='OK'
6NEMO_BRAN=trunk; # dev_r5092_CNRS_SETTE dev_v3_4_STABLE_2012
7compiler=ifort   # gfortran f95 f90 pgfortran pgf95 pgf90 mpifort mpif90
8mpi=bullxmpi     # openmpi mpich intel mpxlf
9
10
11while [ $# -ne 0 ]; do
12    case $1 in
13        -b|--branch    ) NEMO_BRAN=$2         ; shift 2;;
14        -d|--debug     ) set -vx; DEBUG=1     ; shift  ;;
15        -h|--help|-help) cat trusting_help.txt; exit   ;;
16        -m|--machine   ) ARCH=$2              ; shift 2;;
17        -n|--newconf   ) CONF_TEST=$2         ; shift 2;;
18        -r|--refconf   ) CONF_REFE=$2         ; shift 2;;
19        -p|--publish   ) PUBLISH=1            ; shift  ;;
20   *)                                      break  ;;
21    esac
22done
23export CONF_REFE CONF_TEST DEBUG NEMO_BRAN PUBLISH
24
25[ $# -ne 1 ] && { ./trusting.sh -h && exit; }
26# suspend debug mode (too verbose)
27#[ $debug -eq 1 ] && set +vx
28
29# Initialization
30#=============================================
31
32. trusting.env
33echo ${DIR_TEST}
34mkdir -p ${DIR_TEST} ${DIR_REFE}
35cd ${DIR_TEST}
36datestr1=$( LC_ALL=C date -d"$DATESTR" +%Y-%m-%dT%H:%M )
37printf "Date\n%s\n"       $datestr1 > mesg_01_date.txt
38
39printf "Status\nFAILED\n"           > mesg_02_status.txt # Only at end status will change to OK
40
41. trusting_func.sh
42#=============================================
43
44
45#
46#=============================================
47for rel in $compiler $mpi netcdf; do
48    printf "Step......................\nGet $rel release\n" > mesg_03_step.txt
49    arch_rel=$( echo $LOADEDMODULES | sed "s#.*:$rel/\([^:]*\).*#\1#" )
50    [ -z "${arch_rel}" ] && arch_rel=$( echo $PATH | sed "s#.*$rel/\([^/]*\).*#\1#" )
51    [[ $rel == $compiler && -z "$FC" ]] && arch_rel=$FC
52    echo $rel ${arch_rel} >> model.log
53done
54
55sed -n 1p model.log | sed 'i\Fortran compiler' > mesg_04_curiec.txt
56sed -n 2p model.log | sed 'i\MPI             ' > mesg_05_mpicurie.txt
57sed -n 3p model.log | sed 'i\NetCDF          ' > mesg_06_netcdf_curie.txt
58
59
60#---------------------------------------------
61printf "Step......................\nCheckout XIOS, FCM-make(/EXTERNAL/fcm), NEMO engines (/NEMO) & configuration (/CONFIG)\n" > mesg_03_step.txt
62rev=0
63for dir in ${DIR_XIOS} ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_EFCM} ${NEMO_ENGI} ${NEMO_IPSL} ${NEMO_TCMP}; do
64    svn up $dir
65    rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
66    [ $dir == ${DIR_XIOS} ] && echo 'XIOS '${rev_loc} >> model.log && continue
67    (( ${rev_loc} >= $rev )) && rev=${rev_loc}
68done
69echo 'NEMO '$rev >> model.log
70
71
72#---------------------------------------------
73printf "Step......................\nCompilation NEMO configuration %s\n" ${CONF_REF} > mesg_03_step.txt
74cd ${NEMO_CONF}
75./makenemo -n ${CONF_TEST} clean
76./makenemo -n ${CONF_TEST} -r ${CONF_REFE} -m $ARCH -j 16 #> /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 {} . \;
84cp ${NEMO_FORC}/${FORC_TAR} . && tar -tvf ${FORC_TAR} > inputs_list.txt && tar -vxf ${FORC_TAR}
85[ $? -ne 0 ] && getout
86gunzip *.gz
87
88
89#---------------------------------------------
90printf "Step......................\nRunning\n"       > mesg_03_step.txt
91#${JOB_SUB} ${DIR_TEST}/../../batch.sh
92job_num=$( ${JOB_SUB} ${DIR_TEST}/../../batch.sh | awk '{print $NF}')
93[ $? -ne 0 ] && getout
94
95output_test=ocean.output   ; output_refe=${DIR_REFE}/ocean.output
96solver_test=solver.stat    ; solver_refe=${DIR_REFE}/solver.stat
97tracer_test=tracer.stat    ; tracer_refe=${DIR_REFE}/tracer.stat
98inputs_test=inputs_list.txt; inputs_refe=${DIR_REFE}/inputs_list.txt
99
100#time_elapsed=0; time_limit=10800; time_increment=300
101time_elapsed=0; time_limit=1080; time_increment=30
102sleep ${time_increment}
103while [[ $( ${JOB_LIST} | grep $job_num ) && ${time_elapsed} -lt ${time_limit} ]] ; do
104#while [[ ! -f ${solver_test} && ${time_elapsed} -lt ${time_limit} ]] ; do
105    printf "\n####################################################" >> ${DIR_TEST}/mpp.log
106    ${JOB_VIEW} $job_num >> mpp.log
107#   ${JOB_VIEW} $id >> mpp.log
108    sleep ${time_increment}
109    let time_elapsed+=time_increment
110done
111
112
113#---------------------------------------------
114printf "Step......................\nTest if solver exists\n"   > mesg_03_step.txt
115if [ ! -f ${solver_test} ]; then
116    grep 'E R R O R' ocean.output    >> mesg_11_comments.txt
117    sed 's/^/Time step :/' time.step >> mesg_11_comments.txt
118    getout
119fi
120
121
122#---------------------------------------------
123printf "Step......................\nTest solvers difference\n" > mesg_03_step.txt
124diff ${output_refe} ${output_test}
125[ $? -ne 0 ] && status='FAILED'
126diff ${solver_refe} ${solver_test}
127[ $? -ne 0 ] && status='FAILED'
128diff ${tracer_refe} ${tracer_test}
129[ $? -ne 0 ] && status='FAILED'
130
131
132#---------------------------------------------
133printf "Step......................\nTest outputs difference\n" > mesg_03_step.txt
134#diff_trusting 2>/dev/null
135#[ $? -ne 0 ] && status='FAILED'
136
137
138#---------------------------------------------
139printf "Comments\n\n"              >  mesg_11_comments.txt
140grep 'W A R N I N G:' ocean.output >> mesg_11_comments.txt
141
142
143#---------------------------------------------
144if [ $status != 'FAILED' ]; then
145    printf "Step......................\nGet Real CPU time\n" > mesg_03_step.txt
146    real_cpu_time=$( ${JOB_VIEW} $job_num | awk 'END{print $9}')
147    [ $? -ne 0 ] && getout
148    printf "Real CPU time\n%s\n" ${real_cpu_time} > mesg_08_realcputime.txt
149else
150    printf "Step......................\nTest InputFiles difference\n" > mesg_03_step.txt
151    diff ${inputs_refe} ${inputs_test}
152    { [ $? -ne 0 ] && printf "InputFiles\n%s\n" "Different" > mesg_09_inputfiles.txt } || printf "InputFiles\n%s\n" "Same" > mesg_09_inputfiles.txt
153    getout
154fi
155
156
157#---------------------------------------------
158printf "Status\nOK\n" > mesg_02_status.txt
159printf "Step......................\nCode is reliable\n" > mesg_03_step.txt
160
161#---------------------------------------------
162getout
Note: See TracBrowser for help on using the repository browser.