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.env in branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc – NEMO

source: branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting.env @ 8859

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

Continuation of global refactoring of Trusting tool

  • Introduce new 'dev' mode beetween 'debug' and 'prod' modes to skip XIOS compilation from scratch and working in a solely testing directory (thanks Andrew for the suggestion)
  • Switch cfg files from 'svn:mime-type=text/x-shellscript' to 'svn:executable' trying to get syntax highlighting under Trac
  • Bugfixes: correct XIOS branch 'XIOS_DEV_CMIP6' for ORCA1 and remove remaining 'TRUST_DIR_BENCHMARK' (replace by TRUST_TEST_BENCHMARK)
  • Improve the workflow displayed in the terminal
File size: 6.8 KB
Line 
1#!/bin/bash
2
3
4##--------------------------------------------------------------------------------
5## Defaults
6##--------------------------------------------------------------------------------
7
8## Trusting result: 'FAILED' result for 'Unknown error'
9export TRUST_FLAG_RESULT='FAILED' TRUST_FLAG_ERROR='X'
10
11## Locked options from command line (export as of now to environment)
12##-------------------------------------------------------------------
13
14if   [ ${TRUST_FLAG_DEBUG} == 'true' ]; then
15    ## debug mode (skip XIOS compilation    , output stdout & stderr)
16    TRUST_IO_XIOS_MODE=''
17    TRUST_MAIN_STDOUT=''
18elif [ ${TRUST_FLAG_DEV}   == 'true' ]; then
19    ## dev mode   (skip XIOS compilation    , output only stderr    )
20    TRUST_IO_XIOS_MODE=''
21    TRUST_MAIN_STDOUT='1> /dev/null'
22else
23    ## prod mode  (compile XIOS from scratch, no stdout nor stderr  )
24    TRUST_IO_XIOS_MODE='--full'
25    TRUST_MAIN_STDOUT='>& /dev/null'
26fi
27
28export TRUST_IO_XIOS_MODE TRUST_MAIN_STDOUT
29
30## If '-v' arg. has been set, modify default SVN action on working copy
31if [ ${TRUST_SVN_REV} ]; then
32
33    if   [ $( echo ${TRUST_SVN_REV} | grep  "HEAD\|up\|update"                     ) ]; then
34   TRUST_SVN_ACTION='svn update -r HEAD --accept mine-conflict'
35    elif [ $( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then
36   TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' )
37    elif [ $( echo ${TRUST_SVN_REV} | grep -o '[0-9]*'                             ) ]; then
38   TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '[0-9]*' )
39    fi
40
41else
42    ## By default, no update on SVN directories
43    TRUST_SVN_ACTION='svn status'
44fi
45
46export TRUST_SVN_ACTION
47
48
49## Options editable by .cfg files (no export at this time)
50##--------------------------------------------------------
51
52## NEMO 'trunk' branch by default
53[ -z "${TRUST_SVN_BRANCH}" ] && TRUST_SVN_BRANCH='trunk'
54
55## Ref. cfg. unset or empty (mandatory)
56if [ -z "${TRUST_CFG_REF}" ]; then
57
58    ## Default cfg from trunk excepting last stable
59    TRUST_CFG_REF='ORCA2_LIM3_PISCES'
60
61    if [[ ${TRUST_SVN_BRANCH}                          \
62     && ${TRUST_SVN_BRANCH} == 'nemo_v3_6_STABLE'   ]]; then
63   TRUST_CFG_REF='ORCA2_LIM_PISCES'
64    fi
65
66fi
67
68
69##--------------------------------------------------------------------------------
70## Source user & (super)computer configurations
71##--------------------------------------------------------------------------------
72. ./cfg/${TRUST_MAIN_USER}.cfg
73. ./cfg/${TRUST_MAIN_HPCC}.cfg
74
75
76##--------------------------------------------------------------------------------
77## Checking and export environment variables
78##--------------------------------------------------------------------------------
79
80## Trusting installation
81## ---------------------
82
83[ -z "${TRUST_DIR_WORK}"    ] &&    TRUST_DIR_WORK=${TRUST_MAIN_DIR}/../CONFIG
84[ -z "${TRUST_DIR_SCRATCH}" ] && TRUST_DIR_SCRATCH=${TRUST_MAIN_DIR}
85export TRUST_DIR_WORK TRUST_DIR_SCRATCH TRUST_DIR_STORE
86
87
88## Branch checkout (./install_new_branch.sh)
89##------------------------------------------
90
91export TRUST_SVN_REPO='https://forge.ipsl.jussieu.fr'
92export TRUST_SVN_CO=( 'ARCH           CONFIG          NEMO             
93                       EXTERNAL/AGRIF EXTERNAL/fcm    EXTERNAL/IOIPSL   
94                       TOOLS/COMPILE  TOOLS/maketools TOOLS/REBUILD_NEMO
95                       TRUST                                            ' )
96export TRUST_SVN_UP=( 'ARCH           CONFIG          NEMO           
97                       EXTERNAL/AGRIF EXTERNAL/fcm    EXTERNAL/IOIPSL
98                       TOOLS/COMPILE                                 ' )
99
100export TRUST_SVN_BRANCH
101export TRUST_SVN_NEMOGCM=${TRUST_DIR_WORK}/${TRUST_SVN_BRANCH}/NEMOGCM
102
103
104## NEMO Configuration
105##-------------------
106
107[ -z "${TRUST_CFG_NEW}" ] && TRUST_CFG_NEW=${TRUST_CFG_REF}'_trust'
108export TRUST_CFG_NEW TRUST_CFG_REF
109export TRUST_CFG_KEY_ADD TRUST_CFG_KEY_DEL
110
111
112## Inputs/Outputs
113## --------------
114
115[ -z "${TRUST_IO_XIOS}" ] && get_out A
116export TRUST_IO_XIOS
117
118## Forcing directory set and not empty
119if [ ${TRUST_IO_FORC_PATH} ]; then
120
121    ## Forcing archive unset
122    if [[ ! ${TRUST_IO_FORC_TAR} && ${TRUST_IO_FORC_TAR-_} ]]; then
123
124   ## Default forcing archive from trunk
125   TRUST_IO_FORC_TAR='ORCA2_LIM_nemo_v3.7.tar INPUTS_PISCES_v3.6st.tar'
126   [ ${TRUST_CFG_REF} == 'AMM12' ] && TRUST_IO_FORC_TAR='AMM12_v3.7.tar'
127
128   ## Update forcing archive for stable
129   if [ ${TRUST_SVN_BRANCH} == 'nemo_v3_6_STABLE' ]; then
130       TRUST_IO_FORC_TAR='ORCA2_LIM_nemo_v3.6.tar'
131
132       if   [ ${TRUST_CFG_REF} == 'ORCA1_LIM3_PISCES' ]; then
133      TRUST_IO_FORC_TAR='INPUTS_ORCA1_LIM3_PISCES_V10.tar'
134       elif [ ${TRUST_CFG_REF} == 'AMM12'             ]; then
135      TRUST_IO_FORC_TAR='AMM12_v3.6.tar'
136       fi
137
138   fi
139
140    fi
141
142fi
143
144export TRUST_IO_FORC_PATH TRUST_IO_FORC_TAR
145export TRUST_IO_CDO
146
147
148## Compilation
149##------------
150
151## Assuming the sourcing of XIOS arch .env file (modules) for setting
152if [ -z "${TRUST_JOB_ENV}" ]; then
153    TRUST_JOB_ENV=${TRUST_IO_XIOS}/arch/arch-${TRUST_MAIN_HPCC}.env
154fi
155
156export TRUST_JOB_ENV
157
158## Default parallel compilation on 4 procs
159[ -z "${TRUST_COMPILE_NPROC}" ] && TRUST_COMPILE_NPROC='4'
160export TRUST_COMPILE_NPROC
161
162## Not mandatory
163export TRUST_COMPILE_FORTRAN TRUST_COMPILE_MPI TRUST_COMPILE_NETCDF
164
165
166## Running
167##--------
168
169## Assuming the job submit script is in './batch', if not
170if [ -z "${TRUST_JOB_SCRIPT}" ]; then
171    TRUST_JOB_SCRIPT=${TRUST_MAIN_DIR}/batch/${TRUST_MAIN_HPCC}.sh || get_out A
172fi
173
174export TRUST_JOB_SCRIPT
175
176## Mandatory job management cmds (submit, status checking and killing job)
177if [[ -z "${TRUST_JOB_SUBMIT}" || -z "${TRUST_JOB_STATE}" \
178                               || -z "${TRUST_JOB_KILL}"    ]]; then
179    get_out A
180fi
181
182export TRUST_JOB_SUBMIT TRUST_JOB_STATE TRUST_JOB_KILL
183
184## Default test timeout to 3h (pending AND running time)
185[ -z "${TRUST_JOB_TIMEOUT}" ] && TRUST_JOB_TIMEOUT='10800'
186export TRUST_JOB_TIMEOUT
187
188## Job informations not mandatory
189export TRUST_JOB_INFO TRUST_JOB_TIME TRUST_JOB_RAM_P TRUST_JOB_RAM_V
190
191
192## Trusting test
193##--------------
194
195export TRUST_TEST_NAME=${TRUST_MAIN_USER}'_'${TRUST_MAIN_HPCC}
196export TRUST_TEST_DATE=$( date -u +"%Y%m%d%Z%H%M" )
197
198export TRUST_TEST_SUMMARY=trusting_${TRUST_TEST_DATE}_${TRUST_TEST_NAME}.txt
199export  TRUST_TEST_BACKUP=trusting_${TRUST_TEST_DATE}_${TRUST_TEST_NAME}.tgz
200
201##       TRUST_TEST_DIR unset
202if [[ ! ${TRUST_TEST_DIR}       && ${TRUST_TEST_DIR-_}       ]]; then
203        TRUST_TEST_DIR=${TRUST_DIR_SCRATCH}/${TRUST_CFG_REF}/${TRUST_SVN_BRANCH}
204        TRUST_TEST_DIR+=/${TRUST_TEST_DATE}
205    export TRUST_TEST_DIR
206fi
207
208## TRUST_TEST_BENCHMARK unset
209if [[ ! ${TRUST_TEST_BENCHMARK} && ${TRUST_TEST_BENCHMARK-_} ]]; then
210    TRUST_TEST_BENCHMARK=${TRUST_DIR_STORE}/${TRUST_CFG_REF}/${TRUST_SVN_BRANCH}
211    export TRUST_TEST_BENCHMARK
212fi
213
214export TRUST_TEST_LOG=${TRUST_TEST_BENCHMARK}/trusting_${TRUST_TEST_NAME}.txt
215
216export TRUST_TEST_MAILING
Note: See TracBrowser for help on using the repository browser.