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 @ 5286

Last change on this file since 5286 was 5286, checked in by nicolasmartin, 9 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
RevLine 
[5268]1#!/bin/bash
[5286]2#
3# Author: Patrick Brockmann
4# Contact: Patrick.Brockmann@cea.fr
5# History:
6# Modification: Nicolas-thierry.Martin@locean-ipsl.upmc.fr
7#
[5268]8
9
[5276]10# Set defaults
11DEBUG=0; PUBLISH=0; status='OK'
[5268]12
[5286]13# Get options && replace some initials settings
[5268]14while [ $# -ne 0 ]; do
15    case $1 in
[5286]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   ;;
[5268]22    esac
23done
[5276]24
[5286]25# Set super-computer & user environment
26[[ ! -z "$ARCH" && . trusting.env ]] || { ./trusting.sh -h && exit; }
27export DEBUG PUBLISH
[5268]28
29# Initialization
30#=============================================
31
32echo ${DIR_TEST}
33mkdir -p ${DIR_TEST} ${DIR_REFE}
34cd ${DIR_TEST}
[5286]35datestr1=$( LC_ALL=C date -d"$DATE_STR" +%Y-%m-%dT%H:%M )
[5268]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#=============================================
[5286]46for rel in $CDO $COMPILER $MPI $NETCDF; do
[5268]47    printf "Step......................\nGet $rel release\n" > mesg_03_step.txt
[5286]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.]* ' )
[5268]51    echo $rel ${arch_rel} >> model.log
52done
53
54sed -n 1p model.log | sed 'i\Fortran compiler' > mesg_04_curiec.txt
[5280]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
[5268]57
58
59#---------------------------------------------
60printf "Step......................\nCheckout XIOS, FCM-make(/EXTERNAL/fcm), NEMO engines (/NEMO) & configuration (/CONFIG)\n" > mesg_03_step.txt
61rev=0
[5286]62for dir in ${DIR_XIOS} ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_EFCM} ${NEMO_ENGI} ${NEMO_IPSL} ${NEMO_SETT} ${NEMO_TCMP}; do
[5268]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#---------------------------------------------
[5276]72printf "Step......................\nCompilation NEMO configuration %s\n" ${CONF_REF} > mesg_03_step.txt
73cd ${NEMO_CONF}
[5286]74. ${ARCH_ENV}     # Sourcing architecture environment
[5280]75#[ -d ${CONF_TEST} ] && ./makenemo -n ${CONF_TEST} clean
[5286]76./makenemo -n ${CONF_TEST} -r ${CONF_REFE} -m $ARCH -j $NPROC #> /dev/null 2>&1
[5276]77[ ! -e ${CONF_TEST}/BLD/bin/nemo.exe ] && getout
[5268]78
79
80#---------------------------------------------
81printf "Step......................\nPreparing job\n" > mesg_03_step.txt
82cd ${DIR_TEST}
[5276]83find ${NEMO_CONF}/${CONF_TEST}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
[5268]84
[5286]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
[5268]93
[5286]94
[5268]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
[5286]101time_elapsed=0; time_increment=300
[5268]102sleep ${time_increment}
[5286]103while [[ $( ${JOB_LIST} | grep $job_num ) && ${time_elapsed} -lt ${TIME_LIMI} ]] ; do
104    printf "\n####################################################" >> computation.log
105    ${JOB_VIEW} $job_num                                            >> computation.log
[5268]106    sleep ${time_increment}
[5286]107    let time_elapsed+=${time_increment}
[5268]108done
109
110
111#---------------------------------------------
[5286]112printf "Step......................\nTest if ASCII output files exist\n"   > mesg_03_step.txt
113if      [ ! -f ${output_test} ]; then
[5268]114
[5286]115    getout
116else if [  ]
[5268]117
[5286]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
[5268]123#---------------------------------------------
[5286]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
[5268]129
130
131#---------------------------------------------
[5286]132printf "Step......................\nTest last restart files difference\n" > mesg_03_step.txt
133diff_trusting 2>/dev/null
134[ $? -ne 0 ] && status='FAILED'
[5268]135
136
137#---------------------------------------------
[5286]138echo 'Comments'                    >  mesg_11_comments.txt
[5268]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
[5286]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
[5268]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.