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

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

dev_r5092_CNRS_SETTE First commit for super-computers trusting scripts

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