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/TRUST – NEMO

source: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh @ 5292

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

dev_r5092_CNRS_SETTE Standalone TRUST directory for regular NEMO configuration testing

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 6.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
[5292]13# Get options to 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;;
[5292]18   -h|--help   ) cat trusting_help.txt; exit   ;; -m|--machine) CFG_ARCH=$2          ; shift 2;;
[5286]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  ;;
[5292]21        -u|--user   ) CFG_USER=$2          ; shift 2;; -v|--version) NEMO_REVI=$2         ; shift 2;;
[5286]22                   *) cat trusting_help.txt; exit   ;;
[5268]23    esac
24done
[5276]25
[5286]26# Set super-computer & user environment
[5292]27[[ ! -z "${CFG_ARCH}" && ! -z "${CFG_USER}" ]] && . trusting.env || { ./trusting.sh -h && exit; }
[5286]28export DEBUG PUBLISH
[5268]29
30# Initialization
31#=============================================
32
33echo ${DIR_TEST}
34mkdir -p ${DIR_TEST} ${DIR_REFE}
35cd ${DIR_TEST}
[5286]36datestr1=$( LC_ALL=C date -d"$DATE_STR" +%Y-%m-%dT%H:%M )
[5292]37printf "Date\n%s\n"       $datestr1 > mesg_01_date_${CFG_USER}_${CFG_ARCH}.txt
[5268]38
[5292]39printf "Status\nFAILED\n"           > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt # Only at end status will change to OK
[5268]40
41. trusting_func.sh
42#=============================================
43
44
45#
46#=============================================
[5286]47for rel in $CDO $COMPILER $MPI $NETCDF; do
[5292]48    printf "Step......................\nGet $rel release\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5286]49                             arch_rel=$( echo $LOADEDMODULES | sed "s#.*:$rel/\([^:]*\).*#\1#" )
50    [ -z "${arch_rel}"  ] && arch_rel=$( echo $PATH          | sed "s#.*$rel/\([^/]*\).*#\1#"  )
51    [ $( echo $rel | grep "$CDO\|$COMPILER" ) ] && arch_rel=$( $rel --version | grep -m1 -o ' [0-9.]* ' )
[5268]52    echo $rel ${arch_rel} >> model.log
53done
54
[5292]55sed -n 1p model.log | sed 'i\Fortran compiler' > mesg_04_compiler_${CFG_USER}_${CFG_ARCH}.txt
56sed -n 2p model.log | sed 'i\MPI libraries   ' > mesg_05_mpi_${CFG_USER}_${CFG_ARCH}.txt
57sed -n 3p model.log | sed 'i\NetCDF libraries' > mesg_06_netcdf_${CFG_USER}_${CFG_ARCH}.txt
[5268]58
59
60#---------------------------------------------
[5292]61printf "Step......................\nCheckout XIOS, FCM-make(/EXTERNAL/fcm), NEMO engines (/NEMO) & configuration (/CONFIG)\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
62svn_cmd='svn status'
63
64# If -v|--version option has been set, modify svn command
65[ $( echo ${NEMO_VERS} | grep  "up\|update"         ) ] && svn_cmd='svn update'
66[ $( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' ) ] && svn_cmd='svn update -r '$( echo ${NEMO_VERS} | tr -d '[:alpha:][:punct:]' )
67
[5268]68rev=0
[5292]69for dir in ${DIR_XIOS} ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_EFCM} ${NEMO_ENGI} ${NEMO_IPSL} ${NEMO_TRUS} ${NEMO_TCMP}; do
70    [ $dir == ${DIR_XIOS} ] && echo 'XIOS '$( svn info $dir | awk '(NR == 9) {print $NF}' ) >> model.log && continue
71    ${svn_cmd} $dir
[5268]72    rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
73    (( ${rev_loc} >= $rev )) && rev=${rev_loc}
74done
75echo 'NEMO '$rev >> model.log
76
77
78#---------------------------------------------
[5292]79printf "Step......................\nCompilation NEMO configuration %s\n" ${CONF_REF} > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5276]80cd ${NEMO_CONF}
[5286]81. ${ARCH_ENV}     # Sourcing architecture environment
[5280]82#[ -d ${CONF_TEST} ] && ./makenemo -n ${CONF_TEST} clean
[5286]83./makenemo -n ${CONF_TEST} -r ${CONF_REFE} -m $ARCH -j $NPROC #> /dev/null 2>&1
[5276]84[ ! -e ${CONF_TEST}/BLD/bin/nemo.exe ] && getout
[5268]85
86
87#---------------------------------------------
[5292]88printf "Step......................\nPreparing job\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5268]89cd ${DIR_TEST}
[5276]90find ${NEMO_CONF}/${CONF_TEST}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
[5268]91
[5286]92if [ ! -z "${NEMO_FORC}" ]; then
93    cp ${NEMO_FORC}/${FORC_TAR} .
94    tar -tvf ${FORC_TAR} > inputs_list.txt && tar -vxf ${FORC_TAR}
95    [ $? -ne 0 ] && getout
96    gunzip *.gz
97else
98    touch inputs_list.txt
99fi
[5268]100
[5286]101
[5268]102#---------------------------------------------
[5292]103printf "Step......................\nRunning\n"       > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5268]104#${JOB_SUB} ${DIR_TEST}/../../batch.sh
105job_num=$( ${JOB_SUB} ${DIR_TEST}/../../batch.sh | awk '{print $NF}')
106[ $? -ne 0 ] && getout
107
[5286]108time_elapsed=0; time_increment=300
[5268]109sleep ${time_increment}
[5286]110while [[ $( ${JOB_LIST} | grep $job_num ) && ${time_elapsed} -lt ${TIME_LIMI} ]] ; do
111    printf "\n####################################################" >> computation.log
112    ${JOB_VIEW} $job_num                                            >> computation.log
[5268]113    sleep ${time_increment}
[5286]114    let time_elapsed+=${time_increment}
[5268]115done
116
117
118#---------------------------------------------
[5292]119printf "Step......................\nTest if ASCII output files exist\n"   > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5286]120if      [ ! -f ${output_test} ]; then
[5268]121
[5286]122    getout
123else if [  ]
[5268]124
[5292]125    grep 'E R R O R' ocean.output    >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
126    sed 's/^/Time step :/' time.step >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
[5286]127fi
128
129
[5268]130#---------------------------------------------
[5292]131printf "Step......................\nTest ASCII output files difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5286]132for file in ocean.output solver.stat tracer.stat; do
133    diff $file ${DIR_REFE}/$file
134    [ $? -ne 0 ] && status='FAILED'
135done
[5268]136
137
138#---------------------------------------------
[5292]139printf "Step......................\nTest last restart files difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5286]140diff_trusting 2>/dev/null
141[ $? -ne 0 ] && status='FAILED'
[5268]142
143
144#---------------------------------------------
[5292]145echo 'Comments'                    >  mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
146grep 'W A R N I N G:' ocean.output >> mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
[5268]147
148
149#---------------------------------------------
150if [ $status != 'FAILED' ]; then
[5292]151    printf "Step......................\nGet Real CPU time\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5268]152    real_cpu_time=$( ${JOB_VIEW} $job_num | awk 'END{print $9}')
[5292]153    printf "Real CPU time\n%s\n" ${real_cpu_time} > mesg_08_realcputime_${CFG_USER}_${CFG_ARCH}.txt
[5268]154else
[5292]155    printf "Step......................\nTest InputFiles difference\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5286]156    diff inputs_list.txt ${DIR_REFE}/inputs_list.txt
157    [ $? -ne 0 ] && getout
[5292]158    [[ $? -ne 0 && printf "InputFiles\n%s\n" "Different" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt ]] || printf "InputFiles\n%s\n" "Same" > mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
[5268]159fi
160
161
162#---------------------------------------------
[5292]163printf "Status\nOK\n" > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt
164printf "Step......................\nCode is reliable\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
[5268]165
166#---------------------------------------------
167getout
Note: See TracBrowser for help on using the repository browser.