New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
trusting.sh in branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/SETTE – NEMO

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

Last change on this file since 5283 was 5283, checked in by nicolasmartin, 9 years ago

dev_r5092_CNRS_SETTE Updates & nemo.cfg, $ARCH.cfg & template.cfg files for cfg dir

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