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

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

dev_r5092_CNRS_SETTE Updates

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