1 | + SCRIPT_PID=61313 |
---|
2 | + set +x |
---|
3 | + /bin/ksh -x /tmp/jobstart.61294 |
---|
4 | date |
---|
5 | |
---|
6 | |
---|
7 | + date |
---|
8 | Fri Jul 27 12:34:14 CEST 2018 |
---|
9 | #D- Task type DO NOT CHANGE (computing, post-processing or checking) |
---|
10 | TaskType=post-processing |
---|
11 | |
---|
12 | + TaskType=post-processing |
---|
13 | ######################################################################## |
---|
14 | |
---|
15 | #D- Flag to determine if this job in a standalone mode |
---|
16 | #D- Default : value from AA_job if any |
---|
17 | StandAlone=${StandAlone:=true} |
---|
18 | |
---|
19 | + StandAlone=true |
---|
20 | #D- Path to libIGCM |
---|
21 | #D- Default : value from AA_job if any |
---|
22 | libIGCM=${libIGCM:=/ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM} |
---|
23 | |
---|
24 | + libIGCM=/ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM |
---|
25 | #D- Flag to determine allready produced time series. Empty if you start from the beginning |
---|
26 | #D- Default : Value from AA_job if any. Usefull in StandAlone case if you want to continue a time series |
---|
27 | CompletedFlag=${CompletedFlag:=} |
---|
28 | |
---|
29 | + CompletedFlag='' |
---|
30 | #D- Flag to determine task type this script will perform. |
---|
31 | #D- Possible Value : 2D, 3D, Chunck2D, Chunck3D |
---|
32 | #D- Default : Value from AA_job if any. Usefull in StandAlone case. |
---|
33 | TsTask=${TsTask:=2D} |
---|
34 | + TsTask=Chunck3D |
---|
35 | if [ X${TsTask} = Xempty ] ; then |
---|
36 | TsTask="" |
---|
37 | fi |
---|
38 | |
---|
39 | + [ XChunck3D '=' Xempty ] |
---|
40 | #D- Flag to determine if rebuild process has been performed asynchronously |
---|
41 | #D- Possible value true or false. |
---|
42 | #D- If true raw files has allready been patched by rebuild job |
---|
43 | #D- If false create_ts will patch the raw files |
---|
44 | #D- Default : Value from AA_job if any. Usefull in StandAlone case. |
---|
45 | RebuildFrequency=${RebuildFrequency:=true} |
---|
46 | |
---|
47 | + RebuildFrequency=true |
---|
48 | #D- Flag to determine job's output directory |
---|
49 | #D- Default : value from libIGCM_post.ksh if any |
---|
50 | POST_DIR=${POST_DIR:=${PBS_O_WORKDIR:=$(pwd)}} |
---|
51 | |
---|
52 | + POST_DIR=/ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/OutScript |
---|
53 | #D- Increased verbosity (1, 2, 3) |
---|
54 | #D- Default : value from AA_job if any |
---|
55 | Verbosity=${Verbosity:=3} |
---|
56 | |
---|
57 | + Verbosity=3 |
---|
58 | #D- Low level debug : to bypass lib test checks and stack construction |
---|
59 | #D- Default : value from AA_job if any |
---|
60 | DEBUG_debug=${DEBUG_debug:=false} |
---|
61 | |
---|
62 | + DEBUG_debug=false |
---|
63 | #D- TEMPORARY Flag to determine atmospheric resolution |
---|
64 | #D- Default : value from atmospheric driver if any |
---|
65 | RESOL_ATM=ALL |
---|
66 | |
---|
67 | + RESOL_ATM=ALL |
---|
68 | #D- Flag to determine surface resolution |
---|
69 | #D- Default : value from surface driver if any |
---|
70 | RESOL_SRF=ALL |
---|
71 | |
---|
72 | + RESOL_SRF=ALL |
---|
73 | #D- Flag to determine surface resolution |
---|
74 | #D- Default : value from surface driver if any |
---|
75 | RESOL_SBG=ALL |
---|
76 | |
---|
77 | + RESOL_SBG=ALL |
---|
78 | #D- TEMPORARY Flag to determine ocean resolution |
---|
79 | #D- Default : value from ocean driver if any |
---|
80 | RESOL_OCE=${RESOL_OCE:=ORCA2} |
---|
81 | |
---|
82 | + RESOL_OCE=ORCA2 |
---|
83 | #D- TEMPORARY Flag to determine ice resolution |
---|
84 | #D- Default : value from ice driver if any |
---|
85 | RESOL_ICE=${RESOL_OCE:=ORCA2} |
---|
86 | |
---|
87 | + RESOL_ICE=ORCA2 |
---|
88 | #D- TEMPORARY Flag to determine marine biogeochemistry resolution |
---|
89 | #D- Default : value from ice driver if any |
---|
90 | RESOL_MBG=${RESOL_OCE:=ORCA2} |
---|
91 | |
---|
92 | + RESOL_MBG=ORCA2 |
---|
93 | ######################################################################## |
---|
94 | |
---|
95 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
96 | + . /ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM/libIGCM_debug/libIGCM_debug.ksh |
---|
97 | #!/bin/ksh |
---|
98 | |
---|
99 | #************************************************************** |
---|
100 | # Author: Patrick Brockmann, Martial Mancip |
---|
101 | # Contact: Patrick.Brockmann__at__cea.fr Martial.Mancip__at__ipsl.jussieu.fr |
---|
102 | # $Revision:: 1418 $ Revision of last commit |
---|
103 | # $Author:: sdipsl $ Author of last commit |
---|
104 | # $Date:: 2017-12-19 10:21:41 +0100 (Tue, 19 Dec 2017) $ Date of last commit |
---|
105 | # IPSL (2006) |
---|
106 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
107 | # |
---|
108 | #************************************************************** |
---|
109 | |
---|
110 | #================================================== |
---|
111 | # The documentation of this file can be automatically generated |
---|
112 | # if you use the prefix #D- for comments to be extracted. |
---|
113 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
114 | #================================================== |
---|
115 | |
---|
116 | #================================================== |
---|
117 | # Add high level verbosity |
---|
118 | typeset -i Verbosity=${Verbosity:=3} |
---|
119 | |
---|
120 | #================================================== |
---|
121 | # DEBUG_debug |
---|
122 | # Add low level verbosity |
---|
123 | DEBUG_debug=${DEBUG_debug:=false} |
---|
124 | |
---|
125 | #D- postProcessingStopLevel (0,1,2,3) |
---|
126 | #D- 3 stop if any post-processing went wrong |
---|
127 | #D- 2 dont stop if atlas, monitoring or metrics failed |
---|
128 | #D- 1 dont stop if atlas, monitoring, metrics, create_ts or create_se failed |
---|
129 | #D- 0 dont stop if atlas, monitoring, metrics, create_ts, create_se, rebuild or pack_* failed |
---|
130 | postProcessingStopLevel=${postProcessingStopLevel:=0} |
---|
131 | |
---|
132 | #================================================== |
---|
133 | # GENERATE RANDOM ERROR ; only apply if ( ${DEBUG_debug} ) |
---|
134 | typeset -r RandomError=false |
---|
135 | |
---|
136 | #================================================== |
---|
137 | # NULL_STR |
---|
138 | # Default null string |
---|
139 | typeset -r NULL_STR="_0_" |
---|
140 | |
---|
141 | #================================================== |
---|
142 | # libIGCM_CurrentTag |
---|
143 | # Current libIGCM tag, check compatibilty with *.card |
---|
144 | typeset -r libIGCMVersion="2.8.3" |
---|
145 | |
---|
146 | #================================================== |
---|
147 | # Exit Flag (internal debug) |
---|
148 | # When true, end the master loop AFTER SAVES FILES |
---|
149 | ExitFlag=false |
---|
150 | |
---|
151 | #================================================== |
---|
152 | # When we start to run the simulation is not finished |
---|
153 | simulationIsOver=false |
---|
154 | |
---|
155 | #================================================== |
---|
156 | # When we start to run we dont flush AMQP messages |
---|
157 | FlushAMQP=false |
---|
158 | |
---|
159 | #================================================== |
---|
160 | # Declare a stack of functions calls |
---|
161 | unset IGCM_debug_Stack |
---|
162 | unset IGCM_debug_StackArgs |
---|
163 | unset IGCM_debug_StackTiming |
---|
164 | IGCM_debug_Stack[0]=${NULL_STR} |
---|
165 | IGCM_debug_StackArgs[0]=${NULL_STR} |
---|
166 | IGCM_debug_StackTiming[0]=${NULL_STR} |
---|
167 | IGCM_debug_LenStack=0 |
---|
168 | |
---|
169 | #D-#================================================================== |
---|
170 | #D-function IGCM_debug_getDate_ms |
---|
171 | #D- * Purpose: Give number of milliseconds since 01-jan-1970 |
---|
172 | function IGCM_debug_getDate_ms |
---|
173 | { |
---|
174 | typeset nanosecs ms |
---|
175 | # nano secondes since 01-jan-1970 |
---|
176 | nanosecs=$( date +%s%N ) |
---|
177 | |
---|
178 | # truncate the last 6 digits to get milliseconds since 01-jan-1970 |
---|
179 | ms=${nanosecs:0:${#nanosecs}-6} |
---|
180 | |
---|
181 | echo "$ms" |
---|
182 | } |
---|
183 | |
---|
184 | #D-#================================================================== |
---|
185 | #D-function IGCM_debug_sizeOfTabContent |
---|
186 | #D- * Purpose: Give sumed size of a list of files |
---|
187 | #D- * Usage: IGCM_debug_sizeOfTabContent entityList destination |
---|
188 | #D- * where entityList is a list of files or directory |
---|
189 | #D- * where dest is either a directory or a file name |
---|
190 | function IGCM_debug_sizeOfTabContent |
---|
191 | { |
---|
192 | typeset entityListe destination iEntity sizeKo sumSizeKo sumSizeMo |
---|
193 | |
---|
194 | eval set +A entityListe \${${1}} |
---|
195 | destination=${2} |
---|
196 | sumSizeKo=0 |
---|
197 | |
---|
198 | # Here we will try to compute size (file or directory size) from local path and not from archive. |
---|
199 | for ((i = 0; i < ${#entityListe[*]}; i += 1)) ; do |
---|
200 | if [ -f ${entityListe[$i]} ] ; then |
---|
201 | # One file or a bunch of files has been copied without renaming from a visible filesystem |
---|
202 | iEntity=${entityListe[$i]} |
---|
203 | elif [ -f ${entityListe[$i]##/*/} ] ; then |
---|
204 | # One file or a bunch of files has been copied without renaming from an non visible filesystem |
---|
205 | # remove path /home/login/../ from entityListe elements |
---|
206 | iEntity=${entityListe[$i]##/*/} |
---|
207 | elif [ -f ${destination} ] ; then |
---|
208 | # a file has been copied and renamed |
---|
209 | iEntity=${destination} |
---|
210 | elif [ -f ${destination}/${entityListe[$i]##/*/} ] ; then |
---|
211 | # a copy in a directory but not in ${PWD} |
---|
212 | iEntity=${destination}/${entityListe[$i]##/*/} |
---|
213 | elif [ -d ${entityListe[$i]} ] ; then |
---|
214 | # a directory has been copied from a non remote place |
---|
215 | iEntity=${entityListe[$i]} |
---|
216 | elif [ -d ${destination}/${entityListe[$i]##/*/} ] ; then |
---|
217 | # a directory has been copied from a remote archive and not renamed |
---|
218 | iEntity=${destination}/${entityListe[$i]##/*/} |
---|
219 | elif [ -d ${destination} ] ; then |
---|
220 | # a directory has been copied from a remote archive and renamed |
---|
221 | iEntity=${destination} |
---|
222 | fi |
---|
223 | sizeKo=$( du --apparent-size -skL ${iEntity} | gawk '{print $1}' ) |
---|
224 | sumSizeKo=$(( $sumSizeKo + $sizeKo )) |
---|
225 | done |
---|
226 | sumSizeMo=$( echo "scale=6;${sumSizeKo}/1024" | bc ) |
---|
227 | echo "${sumSizeKo}|${sumSizeMo}" |
---|
228 | } |
---|
229 | |
---|
230 | #D-#================================================================== |
---|
231 | #D-function IGCM_debug_send_AMQP_msg__MAILTUNNEL |
---|
232 | #D- * Purpose: Take over AMQP C client using mail as a message recipient |
---|
233 | #D- * One argument : base64 encoded message |
---|
234 | #D- * Attach encoded config.card when starting the simulation |
---|
235 | |
---|
236 | function IGCM_debug_send_AMQP_msg__MAILTUNNEL { |
---|
237 | |
---|
238 | typeset b64_encoded_msg mail_recipient |
---|
239 | typeset buffer send_messages mail_frequency |
---|
240 | typeset last_mail_date__file |
---|
241 | typeset secondsBetweenRefAndLastMail secondsSinceLastMail |
---|
242 | |
---|
243 | b64_encoded_msg=$1 |
---|
244 | |
---|
245 | mail_recipient="superviseur@mail.ipsl.upmc.fr" |
---|
246 | send_messages=0 |
---|
247 | mail_frequency=3600 # in seconds |
---|
248 | # use to keep track when was last mail sent (maybe to be replaced with global variable) |
---|
249 | last_mail_date__file=${R_BUF}/.stamp.${config_UserChoices_TagName}.${config_UserChoices_JobName} |
---|
250 | # use to accumulate messages before sending them |
---|
251 | buffer=${R_BUF}/.buffer.${config_UserChoices_TagName}.${config_UserChoices_JobName} |
---|
252 | |
---|
253 | # init |
---|
254 | if [ ! -f "${buffer}" ]; then |
---|
255 | touch ${buffer} |
---|
256 | fi |
---|
257 | |
---|
258 | if [ ! -f "${last_mail_date__file}" ]; then |
---|
259 | touch ${last_mail_date__file} |
---|
260 | else |
---|
261 | # compute last time the file was changed (in seconds) |
---|
262 | secondsBetweenRefAndLastMail=$(stat -c %Y ${last_mail_date__file}) |
---|
263 | status=$? |
---|
264 | # |
---|
265 | # Only execute this block when the stat command succeeded. |
---|
266 | # The stat command might fail in some circumstance but we consider it is ok to continue anyway. |
---|
267 | if [ ${status} -eq 0 ] ; then |
---|
268 | secondsSinceLastMail=$(( $(date +%s) - ${secondsBetweenRefAndLastMail} )) |
---|
269 | # send message when exceeding threshold |
---|
270 | [ ${secondsSinceLastMail} -gt ${mail_frequency} ] && send_messages=1 |
---|
271 | fi |
---|
272 | fi |
---|
273 | |
---|
274 | # queue messages in the buffer |
---|
275 | echo ${b64_encoded_msg} >> ${buffer} |
---|
276 | |
---|
277 | # send mail |
---|
278 | |
---|
279 | if [ X${initBigBro} = Xtrue ] ; then |
---|
280 | #echo $(date +"%Y-%m-%dT%H:%M:%S.%N%z") > ${SUBMIT_DIR}/mail.txt |
---|
281 | mailx -s "[TEMPORARY AMQP CHANNEL]" -a ${SUBMIT_DIR}/config.card.base64 ${mail_recipient} < ${buffer} # send buffer |
---|
282 | rm -f $buffer ; touch ${buffer} # clear buffer |
---|
283 | touch ${last_mail_date__file} # memorize last mail date |
---|
284 | rm -f ${SUBMIT_DIR}/config.card.base64 # remove temporary file |
---|
285 | initBigBro=false |
---|
286 | elif [ ${send_messages} -eq 1 ] ; then |
---|
287 | #echo $(date +"%Y-%m-%dT%H:%M:%S.%N%z") >> ${SUBMIT_DIR}/mail.txt |
---|
288 | mailx -s "[TEMPORARY AMQP CHANNEL]" ${mail_recipient} < ${buffer} # send buffer |
---|
289 | rm -f ${buffer} ; touch ${buffer} # flush the buffer |
---|
290 | touch ${last_mail_date__file} # memorize last mail date |
---|
291 | fi |
---|
292 | |
---|
293 | if ( ${FlushAMQP} ) ; then |
---|
294 | mailx -s "[TEMPORARY AMQP CHANNEL]" ${mail_recipient} < ${buffer} # send buffer |
---|
295 | rm -f ${buffer} # cleaning behind us |
---|
296 | rm -f ${last_mail_date__file} # cleaning behind us |
---|
297 | fi |
---|
298 | |
---|
299 | # Allways all good for now. |
---|
300 | return 0 |
---|
301 | } |
---|
302 | |
---|
303 | #D-#================================================================== |
---|
304 | #D-function IGCM_debug_sendAMQP_Purge |
---|
305 | #D- * Purpose: Take over AMQP C client using mail as a message recipient |
---|
306 | #D- * No argument : send a message indicating a simulation has been purged |
---|
307 | |
---|
308 | function IGCM_debug_sendAMQP_Purge { |
---|
309 | |
---|
310 | typeset mail_recipient encodedBody |
---|
311 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
312 | mail_recipient="superviseur@mail.ipsl.upmc.fr" |
---|
313 | # Clea nup tag on server side |
---|
314 | code=8888 |
---|
315 | # Usual AMQP message to route messages on server side |
---|
316 | encodedBody=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" | base64 -w 0 ) |
---|
317 | # send mail |
---|
318 | |
---|
319 | IGCM_debug_Print 2 "IGCM_debug_sendAMQP_Purge" |
---|
320 | echo ${encodedBody}|mailx -s "[TEMPORARY AMQP CHANNEL]" ${mail_recipient} |
---|
321 | fi |
---|
322 | |
---|
323 | # Allways all good for now. |
---|
324 | return 0 |
---|
325 | } |
---|
326 | |
---|
327 | #D-#================================================================== |
---|
328 | #D-function IGCM_debug_sendAMQP_Metrics |
---|
329 | #D- * Purpose: Take over AMQP C client using mail as a message recipient |
---|
330 | #D- * Two arguments : - Directory where metrics.json files can be found |
---|
331 | #D- * - Metrics Group Name. metrics will be added to this group |
---|
332 | #D- * Attach encoded metrics.json files. |
---|
333 | |
---|
334 | function IGCM_debug_sendAMQP_Metrics { |
---|
335 | |
---|
336 | typeset mail_recipient encodedBody |
---|
337 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
338 | mail_recipient="superviseur@mail.ipsl.upmc.fr" |
---|
339 | # Metrics tag on server side |
---|
340 | code=7100 |
---|
341 | # Usual AMQP message to route messages on server side |
---|
342 | encodedBody=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"metricsGroupName\":\"${2}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" | base64 -w 0 ) |
---|
343 | # send mail |
---|
344 | attachmentsOptions="" |
---|
345 | for metricsFile in $( ls $1/*json ) ; do |
---|
346 | attachmentsOptions="-a ${metricsFile} ${attachmentsOptions}" |
---|
347 | done |
---|
348 | IGCM_debug_Print 2 "IGCM_debug_sendAMQP_Metrics" |
---|
349 | echo ${encodedBody}|mailx -s "[TEMPORARY AMQP CHANNEL]" ${attachmentsOptions} ${mail_recipient} |
---|
350 | fi |
---|
351 | |
---|
352 | # Allways all good for now. |
---|
353 | return 0 |
---|
354 | } |
---|
355 | |
---|
356 | #D-#================================================================== |
---|
357 | #D-function IGCM_debug_sendAMQP_projectAccounting |
---|
358 | #D- * Purpose: Take over AMQP C client using mail as a message recipient |
---|
359 | #D- * One argument : - File name where project accounting details are stored |
---|
360 | #D- * Attach encoded accounting file. |
---|
361 | |
---|
362 | function IGCM_debug_sendAMQP_projectAccounting { |
---|
363 | |
---|
364 | typeset mail_recipient encodedBody |
---|
365 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
366 | mail_recipient="superviseur@mail.ipsl.upmc.fr" |
---|
367 | # Metrics tag on server side |
---|
368 | code=7010 |
---|
369 | # Usual AMQP message to route messages on server side |
---|
370 | encodedBody=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"accountingProject\":\"${PROJECT}\",\"centre\":\"${CENTER}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" | base64 -w 0 ) |
---|
371 | # send mail |
---|
372 | attachmentsOptions="-a ${1}" |
---|
373 | IGCM_debug_Print 2 "IGCM_debug_sendAMQP_projectAccounting" |
---|
374 | echo ${encodedBody}|mailx -s "[TEMPORARY AMQP CHANNEL]" ${attachmentsOptions} ${mail_recipient} |
---|
375 | # clean behind |
---|
376 | rm -f $1 |
---|
377 | fi |
---|
378 | |
---|
379 | # Allways all good for now. |
---|
380 | return 0 |
---|
381 | } |
---|
382 | |
---|
383 | #D-#================================================================== |
---|
384 | #D-function IGCM_debug_SendAMQP |
---|
385 | #D- * Purpose: Send body; encoded body and config.card to rabbitMQ |
---|
386 | function IGCM_debug_sendAMQP { |
---|
387 | |
---|
388 | typeset decal first additionnalOption encodedBody |
---|
389 | |
---|
390 | # Encode message Body |
---|
391 | encodedBody=$( echo "${Body}" | base64 -w 0 ) |
---|
392 | |
---|
393 | # Send config.card ? |
---|
394 | if [ X${1} = Xactivate ] ; then |
---|
395 | # Encode config.card |
---|
396 | cat ${SUBMIT_DIR}/config.card | base64 -w 0 > ${SUBMIT_DIR}/config.card.base64 |
---|
397 | # Prepare additionnal option |
---|
398 | additionnalOption="-f ${SUBMIT_DIR}/config.card.base64" |
---|
399 | # |
---|
400 | initBigBro=true |
---|
401 | else |
---|
402 | additionnalOption= |
---|
403 | # |
---|
404 | initBigBro=false |
---|
405 | fi |
---|
406 | |
---|
407 | # Only cosmetics : stack file |
---|
408 | if [ X${ActivateStackFilling} = Xtrue ] ; then |
---|
409 | decal=0 |
---|
410 | while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do |
---|
411 | printf ' ' >> ${StackFileLocation}/${StackFileName} |
---|
412 | (( decal = decal + 1 )) |
---|
413 | done |
---|
414 | # Log to stack file using human readable format |
---|
415 | echo "${Body}" >> ${StackFileLocation}/${StackFileName} |
---|
416 | fi |
---|
417 | |
---|
418 | # Log separately encoded AMQP message command for reuse in a mock up |
---|
419 | #echo sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b ${encodedBody} >> ${RUN_DIR_PATH}/send.AMQP.${config_UserChoices_JobName}.${config_UserChoices_ExperimentName}.${config_UserChoices_SpaceName}.${config_UserChoices_TagName}.${CumulPeriod}.history.txt |
---|
420 | |
---|
421 | # Send the message |
---|
422 | if [ X${BigBrotherChannel} = XMAIL ] ; then |
---|
423 | IGCM_debug_send_AMQP_msg__MAILTUNNEL "${encodedBody}" |
---|
424 | status=$? |
---|
425 | else |
---|
426 | sendAMQPMsg -h localhost -p 5672 ${additionnalOption} -b ${encodedBody} |
---|
427 | status=$? |
---|
428 | fi |
---|
429 | |
---|
430 | if [ ${status} -gt 0 ] ; then |
---|
431 | IGCM_debug_Print 2 "IGCM_debug_Push/PopStack/ActivateBigBro : command sendAMQPMsg failed error code ${status}" |
---|
432 | echo sendAMQPMsg -h localhost -p 5672 -b "${Body}" |
---|
433 | exit 1 |
---|
434 | fi |
---|
435 | } |
---|
436 | |
---|
437 | #D-#================================================================== |
---|
438 | #D-function IGCM_debug_CallStack |
---|
439 | #D-* Purpose: Print the call stack tree from the oldest to the youngest (opposite of the display standard) |
---|
440 | #D- |
---|
441 | function IGCM_debug_CallStack { |
---|
442 | if ( $DEBUG_debug ) ; then |
---|
443 | # Cosmetics |
---|
444 | typeset i decal |
---|
445 | i=0 |
---|
446 | until [ $i -eq ${IGCM_debug_LenStack} ]; do |
---|
447 | decal=0 |
---|
448 | until [ $decal -eq ${i} ]; do |
---|
449 | printf -- ' ' |
---|
450 | (( decal = decal + 1 )) |
---|
451 | done |
---|
452 | echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}" "(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})" |
---|
453 | ((i = i + 1)) |
---|
454 | done |
---|
455 | fi |
---|
456 | } |
---|
457 | |
---|
458 | #D-#================================================================== |
---|
459 | #D-function IGCM_debug_PushStack |
---|
460 | #D-* Purpose: Push a function name in the stack |
---|
461 | #D- |
---|
462 | function IGCM_debug_PushStack { |
---|
463 | if ( $DEBUG_debug ) ; then |
---|
464 | typeset decal inputs startTime_ms |
---|
465 | |
---|
466 | # Only cosmetics : stack file |
---|
467 | if [ X${ActivateStackFilling} = Xtrue ] ; then |
---|
468 | echo >> ${StackFileLocation}/${StackFileName} |
---|
469 | decal=0 |
---|
470 | while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do |
---|
471 | printf ' ' >> ${StackFileLocation}/${StackFileName} |
---|
472 | (( decal = decal + 1 )) |
---|
473 | done |
---|
474 | |
---|
475 | # Fill the stack file |
---|
476 | echo "> ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName} |
---|
477 | fi |
---|
478 | |
---|
479 | # Save input list in an indexed array |
---|
480 | INPUTS=( $@ ) |
---|
481 | |
---|
482 | # Get timing information |
---|
483 | startTime_ms=$( IGCM_debug_getDate_ms ) |
---|
484 | |
---|
485 | # We add function call name on beginning of the stack |
---|
486 | set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]} |
---|
487 | |
---|
488 | # Save timing in milliseconds in an indexed array |
---|
489 | set +A IGCM_debug_StackTiming -- ${startTime_ms} ${IGCM_debug_StackTiming[*]} |
---|
490 | |
---|
491 | # We include the "null" Args in the beginning of the StackArgs |
---|
492 | set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} |
---|
493 | |
---|
494 | # Then, we shift StackArgs tabular |
---|
495 | # Replacing blank separated list by comma separated list of quoted elements (except the first and last element) |
---|
496 | if [ $# -gt 1 ]; then |
---|
497 | IGCM_debug_StackArgs[0]=$(echo ${INPUTS[*]:1} | sed -e "s/\ /\",\"/g" ) |
---|
498 | fi |
---|
499 | |
---|
500 | # Increment LenStack |
---|
501 | (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 )) |
---|
502 | |
---|
503 | #IGCM_debug_CallStack |
---|
504 | fi |
---|
505 | } |
---|
506 | |
---|
507 | #D-#================================================================== |
---|
508 | #D-function IGCM_debug_PopStack |
---|
509 | #D-* Purpose: Pop a function name in the stack |
---|
510 | #D- |
---|
511 | function IGCM_debug_PopStack { |
---|
512 | if ( $DEBUG_debug ) ; then |
---|
513 | typeset i decal command arguments startTime_ms endTime_ms |
---|
514 | typeset instrumentation dest prefix |
---|
515 | # they are not typeset because they are send "by adress" to son functions |
---|
516 | # we unset them to avoid "memory effect" |
---|
517 | unset fileList source |
---|
518 | |
---|
519 | # INTRODUCE SIMPLE ERROR GENERATOR TO TEST SUPERVISOR |
---|
520 | # PROBABILITY ERROR IS 0.0001 PER COMMAND OR FUNCTION CALL |
---|
521 | # THERE ARE ~500 COMMAND OR FUNCTION CALL PER PERIOD |
---|
522 | # ONLY WHEN TaskType is "computing". |
---|
523 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
524 | if [ X${TaskType} = Xcomputing ]; then |
---|
525 | if ( ${RandomError} ) ; then |
---|
526 | if [ $((RANDOM%10000)) -le 10 ] ; then |
---|
527 | IGCM_debug_Print 1 "Random error has been triggered" |
---|
528 | if [ X${ActivateStackFilling} = Xtrue ] ; then |
---|
529 | echo "RANDOM ERROR" >> ${StackFileLocation}/${StackFileName} |
---|
530 | fi |
---|
531 | ExitFlag=true |
---|
532 | fi |
---|
533 | fi |
---|
534 | fi |
---|
535 | fi |
---|
536 | |
---|
537 | if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then |
---|
538 | # Everything is cool |
---|
539 | |
---|
540 | # Get timing information |
---|
541 | endTime_ms=$( IGCM_debug_getDate_ms ) |
---|
542 | |
---|
543 | # Save Stack information before poping the stack |
---|
544 | command=${IGCM_debug_Stack[0]} |
---|
545 | |
---|
546 | # Go from comma separated list of quoted elements (except the first and the last element) |
---|
547 | # to unquoted space separated elements in an array |
---|
548 | set -A arguments -- $( echo ${IGCM_debug_StackArgs[0]} | sed -e "s/\",\"/\ /g" ) |
---|
549 | |
---|
550 | # Save Stack information before poping the stack |
---|
551 | startTime_ms=${IGCM_debug_StackTiming[0]} |
---|
552 | |
---|
553 | # Pop the stack |
---|
554 | (( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 )) |
---|
555 | set -A IGCM_debug_Stack -- ${IGCM_debug_Stack[*]:1} |
---|
556 | set -A IGCM_debug_StackArgs -- ${IGCM_debug_StackArgs[*]:1} |
---|
557 | set -A IGCM_debug_StackTiming -- ${IGCM_debug_StackTiming[*]:1} |
---|
558 | else |
---|
559 | echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack} |
---|
560 | IGCM_debug_Exit $@ |
---|
561 | fi |
---|
562 | |
---|
563 | # Special actions depending on command to prepare IGCM_debug_PrintInfosActions call |
---|
564 | # We are interested in: |
---|
565 | # 0. Which command performs the work |
---|
566 | # 1. Size of entity we are working with |
---|
567 | # 2. Where are we reading |
---|
568 | # 3. Where are we writing |
---|
569 | # 4. How long it took |
---|
570 | |
---|
571 | instrumentation=false |
---|
572 | |
---|
573 | case ${command} in |
---|
574 | # Classical copy (only files are given to IGCM_sys_Cp as options) |
---|
575 | IGCM_sys_Cp) |
---|
576 | instrumentation=true |
---|
577 | # All but the latest |
---|
578 | fileList=${arguments[*]:0:${#arguments[*]}-1} |
---|
579 | # just need the first file to get the directory |
---|
580 | source=${arguments[0]} |
---|
581 | # Nothing but the latest |
---|
582 | dest=${arguments[${#arguments[*]}-1]} |
---|
583 | # Size of file whose name are stored in a list |
---|
584 | entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) |
---|
585 | ;; |
---|
586 | |
---|
587 | # Copy from archive machine or from buffer |
---|
588 | IGCM_sys_Get|IGCM_sys_GetBuffer) |
---|
589 | instrumentation=true |
---|
590 | if [ ${#arguments[*]} -eq 2 ] ; then |
---|
591 | source=${arguments[0]} |
---|
592 | dest=${arguments[1]} |
---|
593 | # Size of file whose name are stored in a variable |
---|
594 | entitySize=$( IGCM_debug_sizeOfTabContent source ${dest} ) |
---|
595 | elif ( [ ${#arguments[*]} -eq 3 ] && [ ${arguments[0]} = '/l' ] ) ; then |
---|
596 | # IGCM_sys_Get /l liste_file[*] /ccc/scratch/cont003/dsm/p86denv/RUN_DIR/985998_14754/ |
---|
597 | # Keep the array name hosting the all list |
---|
598 | eval set +A fileList \${${arguments[1]}} |
---|
599 | # just need the first file to get the directory |
---|
600 | source=${fileList[0]} |
---|
601 | dest=${arguments[2]} |
---|
602 | # Size of file whose name are stored in a list |
---|
603 | entitySize=$( IGCM_debug_sizeOfTabContent fileList[*] ${dest} ) |
---|
604 | elif [ [ ${#arguments[*]} -ge 3 ] ; then |
---|
605 | # All but the latest |
---|
606 | fileList=${arguments[*]:0:${#arguments[*]}-1} |
---|
607 | # just need the first file to get the directory |
---|
608 | source=${arguments[0]} |
---|
609 | # Nothing but the latest |
---|
610 | dest=${arguments[${#arguments[*]}-1]} |
---|
611 | # Size of file whose name are stored in a list |
---|
612 | entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) |
---|
613 | fi |
---|
614 | ;; |
---|
615 | |
---|
616 | # Copy from compute node or copy to archive/buffer |
---|
617 | IGCM_sys_Get_Master|IGCM_sys_Get_Dir|IGCM_sys_Put_Out|IGCM_sys_PutBuffer_Out) |
---|
618 | instrumentation=true |
---|
619 | source=${arguments[0]} |
---|
620 | dest=${arguments[1]} |
---|
621 | # Size of file whose name are stored in a variable |
---|
622 | entitySize=$( IGCM_debug_sizeOfTabContent source ${dest} ) |
---|
623 | ;; |
---|
624 | |
---|
625 | # Rebuild command |
---|
626 | IGCM_sys_rebuild|IGCM_sys_rebuild_station) |
---|
627 | instrumentation=true |
---|
628 | # All but the first |
---|
629 | fileList=${arguments[*]:1:${#arguments[*]}-1} |
---|
630 | # just need a file to get the directory |
---|
631 | source=${arguments[1]} |
---|
632 | # Nothing but the first |
---|
633 | dest=${arguments[0]} |
---|
634 | # Size of file whose name are stored in a list |
---|
635 | entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) |
---|
636 | ;; |
---|
637 | |
---|
638 | # NCO commands |
---|
639 | IGCM_sys_ncrcat|IGCM_sys_ncecat|IGCM_sys_ncra|IGCM_sys_ncks|IGCM_sys_cdo) |
---|
640 | # Example of what we want to catch : only filenames in those command lines |
---|
641 | # IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE} |
---|
642 | # IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${file1} ${liste_file_tmp[*]} ${file_out} |
---|
643 | # IGCM_sys_ncrcat -p ${dir} ${liste_file_tmp} --output ${output} |
---|
644 | # IGCM_sys_ncrcat -x -v ${list_var} -p ${dir} ${liste_file_tmp} --output ${output} |
---|
645 | instrumentation=true |
---|
646 | keepGoing=true |
---|
647 | prefix=. |
---|
648 | i=0 |
---|
649 | while ( ${keepGoing} ) ; do |
---|
650 | # the last one is not interesting |
---|
651 | if [ ${i} -eq ${#arguments[*]}-1 ] ; then |
---|
652 | keepGoing=false |
---|
653 | # look after "-p" option. Path prefix is the following arguments |
---|
654 | elif [ ${arguments[${i}]} = "-p" ] ; then |
---|
655 | ((i = i + 1)) |
---|
656 | prefix=${arguments[${i}]} |
---|
657 | ((i = i + 1)) |
---|
658 | elif [ ${i} -eq ${#arguments[*]}-1 ] ; then |
---|
659 | keepGoing=false |
---|
660 | # looking for files |
---|
661 | elif [ -f ${prefix}/${arguments[${i}]} ] ; then |
---|
662 | fileList="${fileList} ${prefix}/${arguments[${i}]}" |
---|
663 | ((i = i + 1)) |
---|
664 | # other options are not interesting |
---|
665 | else |
---|
666 | ((i = i + 1)) |
---|
667 | fi |
---|
668 | done |
---|
669 | |
---|
670 | # i value is at least 1 |
---|
671 | # just need one file to get the directory |
---|
672 | source=$( echo ${fileList} | gawk '{print $1}' ) |
---|
673 | # Nothing but the latest |
---|
674 | dest=${arguments[${#arguments[*]}-1]} |
---|
675 | # Size of file whose name are stored in a list |
---|
676 | entitySize=$( IGCM_debug_sizeOfTabContent fileList ${dest} ) |
---|
677 | ;; |
---|
678 | esac |
---|
679 | |
---|
680 | # Print information related to instrumentation |
---|
681 | ( ${instrumentation} ) && IGCM_debug_PrintInfosActions ${command} ${entitySize} ${startTime_ms} ${endTime_ms} ${dest} ${source} |
---|
682 | |
---|
683 | # Only cosmetics : stack file |
---|
684 | if [ X${ActivateStackFilling} = Xtrue ] ; then |
---|
685 | decal=0 |
---|
686 | while [ ${decal} -lt ${IGCM_debug_LenStack} ]; do |
---|
687 | printf ' ' >> ${StackFileLocation}/${StackFileName} |
---|
688 | (( decal = decal + 1 )) |
---|
689 | done |
---|
690 | fi |
---|
691 | |
---|
692 | if ( ${ExitFlag} ) ; then |
---|
693 | # Inform the stack file |
---|
694 | if [ X${ActivateStackFilling} = Xtrue ] ; then |
---|
695 | echo '!!! ExitFlag has been activated !!!' >> ${StackFileLocation}/${StackFileName} |
---|
696 | fi |
---|
697 | |
---|
698 | # Unplugged message 4900 handling for now. To ease downstream treatment. |
---|
699 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
700 | if [ X${TaskType} = Xcomputing ]; then |
---|
701 | # RabbitMQ message code "COMPUTING JOBs COMMAND FAILURE" |
---|
702 | code=1900 |
---|
703 | elif [ X${TaskType} = Xpost-processing ]; then |
---|
704 | # RabbitMQ message code "POST-PROCESSING JOBs COMMAND FAILURE" |
---|
705 | code=2900 |
---|
706 | elif [ X${TaskType} = Xchecking ]; then |
---|
707 | # RabbitMQ message code "POST-PROCESSING FROM CHECKER JOBs COMMAND FAILURE" |
---|
708 | code=3900 |
---|
709 | fi |
---|
710 | # RabbitMQ message body |
---|
711 | Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"command\":\"${command}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) |
---|
712 | |
---|
713 | # Fill the rabbitMQ queue |
---|
714 | IGCM_debug_sendAMQP |
---|
715 | fi |
---|
716 | else |
---|
717 | # Inform the stack file |
---|
718 | if [ X${ActivateStackFilling} = Xtrue ] ; then |
---|
719 | echo "< ${IGCM_debug_LenStack} : ${@}" >> ${StackFileLocation}/${StackFileName} |
---|
720 | fi |
---|
721 | fi |
---|
722 | |
---|
723 | # Reset array if necessary |
---|
724 | if [ ${IGCM_debug_LenStack} = 0 ]; then |
---|
725 | #echo |
---|
726 | #IGCM_debug_Print 3 "Clean stack array" |
---|
727 | #echo |
---|
728 | unset IGCM_debug_Stack |
---|
729 | unset IGCM_debug_StackArgs |
---|
730 | unset IGCM_debug_StackTiming |
---|
731 | IGCM_debug_Stack[0]=${NULL_STR} |
---|
732 | IGCM_debug_StackArgs[0]=${NULL_STR} |
---|
733 | IGCM_debug_StackTiming[0]=${NULL_STR} |
---|
734 | fi |
---|
735 | fi |
---|
736 | #IGCM_debug_CallStack |
---|
737 | } |
---|
738 | |
---|
739 | #D-#================================================================== |
---|
740 | #D-function IGCM_debug_BigBro_Initialize |
---|
741 | #D-* Purpose: switch rabbitMQ on |
---|
742 | #D- |
---|
743 | function IGCM_debug_BigBro_Initialize { |
---|
744 | IGCM_debug_PushStack "IGCM_debug_BigBro_Initialize" |
---|
745 | |
---|
746 | typeset postProcessingIDLength postProcessingName postProcessingDate postProcessingDimn postProcessingComp postProcessingFile accountingFile |
---|
747 | |
---|
748 | # Message type standard fields: |
---|
749 | # https://github.com/Prodiguer/prodiguer-docs/wiki/MQ-Standard-Message-Fields |
---|
750 | |
---|
751 | # Message type dictionnary and custom fields: |
---|
752 | # https://github.com/Prodiguer/prodiguer-docs/wiki/Monitoring-Message-Dictionary |
---|
753 | |
---|
754 | if [ X${BigBrother} = Xtrue ] ; then |
---|
755 | # create a unique ID for this specific job |
---|
756 | jobuid=$(uuidgen) |
---|
757 | |
---|
758 | # get the assigned id by the scheduler for that job |
---|
759 | IGCM_sys_getJobSchedulerID jobSchedulerID |
---|
760 | |
---|
761 | if [ X${TaskType} = Xcomputing ]; then |
---|
762 | if ( ${FirstInitialize} ) ; then |
---|
763 | # RabbitMQ message code "BEGIN A SIMULATION" |
---|
764 | code=0000 |
---|
765 | # create and persist a unique id for this simulation |
---|
766 | simuid=$(uuidgen) |
---|
767 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration simuid ${simuid} |
---|
768 | # Standard fields for the first message |
---|
769 | genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"activity\":\"IPSL\",\"name\":\"${config_UserChoices_JobName}\",\"experiment\":\"${config_UserChoices_ExperimentName}\",\"space\":\"${config_UserChoices_SpaceName}\",\"model\":\"${config_UserChoices_TagName}\",\"startDate\":\"${config_UserChoices_DateBegin}\",\"endDate\":\"${config_UserChoices_DateEnd}\",\"login\":\"${LOGIN}\",\"centre\":\"${CENTER}\",\"machine\":\"${MASTER}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) |
---|
770 | # RabbitMQ message body with specific fields associated message codes treated here |
---|
771 | Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"jobSchedulerID\":\"${jobSchedulerID}\",\"jobSubmissionPath\":\"${SUBMIT_DIR}\",\"archivePath\":\"${R_SAVE}\",\"storagePath\":\"${R_BUFR}\",\"storageSmallPath\":\"${R_FIGR}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) |
---|
772 | # Fill the rabbitMQ queue (the config.card in use will be sent) |
---|
773 | IGCM_debug_sendAMQP activate |
---|
774 | else |
---|
775 | # RabbitMQ message code "A NEW COMPUTING JOB IS RUNNING PART OF A SIMULATION" |
---|
776 | code=1000 |
---|
777 | # retrieve this simulation's unique id |
---|
778 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration simuid |
---|
779 | simuid=${run_Configuration_simuid} |
---|
780 | # Using standard fields for message others than the first one. Still subject to change |
---|
781 | genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) |
---|
782 | # RabbitMQ message body with specific fields associated message codes treated here |
---|
783 | Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"jobSchedulerID\":\"${jobSchedulerID}\",\"jobSubmissionPath\":\"${SUBMIT_DIR}\",\"archivePath\":\"${R_SAVE}\",\"storagePath\":\"${R_BUFR}\",\"storageSmallPath\":\"${R_FIGR}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) |
---|
784 | # Fill the rabbitMQ queue |
---|
785 | IGCM_debug_sendAMQP |
---|
786 | fi |
---|
787 | |
---|
788 | # NOT VERY NICE BUT ... IT WORKS |
---|
789 | # Be sure that the genericSimulationID will be small from now on |
---|
790 | # Using standard fields for messages others than the first one. Still subject to change |
---|
791 | genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) |
---|
792 | |
---|
793 | elif [ X${TaskType} = Xpost-processing ]; then |
---|
794 | # RabbitMQ message code "A NEW POST-PROCESSING JOB IS RUNNING PART OF A SIMULATION" |
---|
795 | code=2000 |
---|
796 | # retrieve this simulation's unique id |
---|
797 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration simuid |
---|
798 | simuid=${run_Configuration_simuid} |
---|
799 | # Using standard fields for message others than the first one. Still subject to change |
---|
800 | genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" ) |
---|
801 | |
---|
802 | # Specify the post-processing task we are dealing with |
---|
803 | postProcessingIDLength=$( echo "${Script_Post_Output}" | tr -d -c "\." | wc -c ) |
---|
804 | postProcessingName=$( echo "${Script_Post_Output}" | gawk -F. '{print $1}' ) |
---|
805 | postProcessingDate=$( echo "${Script_Post_Output}" | gawk -F. '{print $2}' ) |
---|
806 | postProcessingDimn="null" |
---|
807 | postProcessingComp="null" |
---|
808 | postProcessingFile="null" |
---|
809 | if [ ${postProcessingIDLength} -eq 2 ] ; then |
---|
810 | postProcessingDimn=$( echo "${Script_Post_Output}" | gawk -F. '{print $3}' ) |
---|
811 | elif [ ${postProcessingIDLength} -eq 4 ] ; then |
---|
812 | postProcessingComp=$( echo "${Script_Post_Output}" | gawk -F. '{print $4}' ) |
---|
813 | postProcessingFile=$( echo "${Script_Post_Output}" | gawk -F. '{print $5}' ) |
---|
814 | fi |
---|
815 | |
---|
816 | # RabbitMQ message body with specific fields associated message codes treated here |
---|
817 | Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"jobSchedulerID\":\"${jobSchedulerID}\",\"jobSubmissionPath\":\"${SUBMIT_DIR}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\",\"postProcessingName\":\"${postProcessingName}\",\"postProcessingDate\":\"${postProcessingDate}\",\"postProcessingDimn\":\"${postProcessingDimn}\",\"postProcessingComp\":\"${postProcessingComp}\",\"postProcessingFile\":\"${postProcessingFile}\"}" ) |
---|
818 | # Fill the rabbitMQ queue |
---|
819 | IGCM_debug_sendAMQP |
---|
820 | |
---|
821 | elif [ X${TaskType} = Xchecking ]; then |
---|
822 | # retrieve this simulation's unique id |
---|
823 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration simuid |
---|
824 | simuid=${run_Configuration_simuid} |
---|
825 | # Using standard fields for message others than the first one. Still subject to change |
---|
826 | genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"msgProducerVersion\":\"${libIGCMVersion}\",\"simuid\":\"${simuid}\",\"jobuid\":\"N\/A\"" ) |
---|
827 | fi |
---|
828 | |
---|
829 | # Turn the flag on |
---|
830 | ActivateBigBro=true |
---|
831 | |
---|
832 | if [ X${TaskType} = Xcomputing ]; then |
---|
833 | # Save project accounting details in a file |
---|
834 | accountingFile=cpt_${CENTER}_${PROJECT}_$( date +"%Y%m%d_%H%M" ).dat |
---|
835 | IGCM_sys_projectAccounting ${accountingFile} |
---|
836 | |
---|
837 | # And send it |
---|
838 | IGCM_debug_sendAMQP_projectAccounting ${accountingFile} |
---|
839 | fi |
---|
840 | fi |
---|
841 | IGCM_debug_PopStack "IGCM_debug_BigBro_Initialize" |
---|
842 | } |
---|
843 | |
---|
844 | #D-#================================================================== |
---|
845 | #D-function IGCM_debug_BigBro_Update |
---|
846 | #D-* Purpose: Update rabbitMQ messages exchanges during the run |
---|
847 | #D- |
---|
848 | function IGCM_debug_BigBro_Update { |
---|
849 | IGCM_debug_PushStack "IGCM_debug_BigBro_Update" |
---|
850 | |
---|
851 | # Message type standard fields: |
---|
852 | # https://github.com/Prodiguer/prodiguer-docs/wiki/MQ-Standard-Message-Fields |
---|
853 | |
---|
854 | # Message type dictionnary and custom fields: |
---|
855 | # https://github.com/Prodiguer/prodiguer-docs/wiki/Monitoring-Message-Dictionary |
---|
856 | |
---|
857 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
858 | if [ X${TaskType} = Xcomputing ]; then |
---|
859 | # Send ${PeriodDateBegin}, ${PeriodDateEnd} and ${CumulPeriod} |
---|
860 | # RabbitMQ message body |
---|
861 | Body=$( echo "{${genericSimulationID},\"msgCode\":\"1001\",\"PeriodDateBegin\":\"${PeriodDateBegin}\",\"PeriodDateEnd\":\"${PeriodDateEnd}\",\"CumulPeriod\":\"${CumulPeriod}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) |
---|
862 | # Fill the rabbitMQ queue |
---|
863 | IGCM_debug_sendAMQP |
---|
864 | fi |
---|
865 | fi |
---|
866 | IGCM_debug_PopStack "IGCM_debug_BigBro_Update" |
---|
867 | } |
---|
868 | |
---|
869 | #D-#================================================================== |
---|
870 | #D-function IGCM_debug_BigBro_Finalize |
---|
871 | #D-* Purpose: Finalize rabbitMQ messages exchanges |
---|
872 | #D- |
---|
873 | function IGCM_debug_BigBro_Finalize { |
---|
874 | IGCM_debug_PushStack "IGCM_debug_BigBro_Finalize" |
---|
875 | |
---|
876 | # Message type standard fields: |
---|
877 | # https://github.com/Prodiguer/prodiguer-docs/wiki/MQ-Standard-Message-Fields |
---|
878 | |
---|
879 | # Message type dictionnary and custom fields: |
---|
880 | # https://github.com/Prodiguer/prodiguer-docs/wiki/Monitoring-Message-Dictionary |
---|
881 | |
---|
882 | if ( $DEBUG_debug ) ; then |
---|
883 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
884 | if [ X${TaskType} = Xcomputing ]; then |
---|
885 | if ( ${simulationIsOver} ) ; then |
---|
886 | # RabbitMQ message code "SIMULATION ENDS" |
---|
887 | code=0100 |
---|
888 | FlushAMQP=true |
---|
889 | elif ( ${ExitFlag} ) ; then |
---|
890 | # RabbitMQ message code "EXIT THE JOBS BECAUSE ERROR(S) HAS BEEN TRIGGERED" |
---|
891 | code=1999 |
---|
892 | FlushAMQP=true |
---|
893 | else |
---|
894 | # RabbitMQ message code "COMPUTING JOB ENDS" |
---|
895 | code=1100 |
---|
896 | fi |
---|
897 | elif [ X${TaskType} = Xpost-processing ]; then |
---|
898 | if ( ${ExitFlag} ) ; then |
---|
899 | # RabbitMQ message code "POST-PROCESSING JOB FAILS" |
---|
900 | code=2999 |
---|
901 | FlushAMQP=true |
---|
902 | else |
---|
903 | # RabbitMQ message code "POST-PROCESSING JOB ENDS" |
---|
904 | code=2100 |
---|
905 | FlushAMQP=true |
---|
906 | fi |
---|
907 | elif [ X${TaskType} = Xchecking ]; then |
---|
908 | if ( ${ExitFlag} ) ; then |
---|
909 | # RabbitMQ message code "POST-PROCESSING JOB FAILS" |
---|
910 | code=3999 |
---|
911 | FlushAMQP=true |
---|
912 | else |
---|
913 | # RabbitMQ message code "POST-PROCESSING JOB ENDS" |
---|
914 | code=3100 |
---|
915 | FlushAMQP=true |
---|
916 | fi |
---|
917 | fi |
---|
918 | # RabbitMQ message body |
---|
919 | Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) |
---|
920 | # Fill the rabbitMQ queue |
---|
921 | IGCM_debug_sendAMQP |
---|
922 | fi |
---|
923 | fi |
---|
924 | |
---|
925 | IGCM_debug_PopStack "IGCM_debug_BigBro_Finalize" |
---|
926 | } |
---|
927 | |
---|
928 | #D-#================================================================== |
---|
929 | #D-function IGCM_debug_Exit |
---|
930 | #D-* Purpose: Print Call Stack and set ExitFlag to true |
---|
931 | #D- |
---|
932 | function IGCM_debug_Exit { |
---|
933 | IGCM_debug_PushStack "IGCM_debug_Exit" |
---|
934 | echo "IGCM_debug_Exit : " "${@}" |
---|
935 | echo |
---|
936 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!" |
---|
937 | echo "!! ERROR TRIGGERED !!" |
---|
938 | echo "!! EXIT FLAG SET !!" |
---|
939 | echo "!------------------------!" |
---|
940 | echo |
---|
941 | IGCM_debug_CallStack |
---|
942 | ExitFlag=true |
---|
943 | IGCM_debug_PopStack "IGCM_debug_Exit" |
---|
944 | } |
---|
945 | |
---|
946 | #D-#================================================== |
---|
947 | #D-function IGCM_debug_Verif_Exit |
---|
948 | #D-* Purpose: exit with number 1 if ExitFlag is true |
---|
949 | #D- |
---|
950 | function IGCM_debug_Verif_Exit { |
---|
951 | if ( ${ExitFlag} ) ; then |
---|
952 | echo "IGCM_debug_Verif_Exit : Something wrong happened previously." |
---|
953 | echo "IGCM_debug_Verif_Exit : ERROR and EXIT keyword will help find out where." |
---|
954 | # Only computing TaskType stops the job for now. |
---|
955 | if [ X${TaskType} = Xcomputing ] ; then |
---|
956 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal" |
---|
957 | echo " EXIT THE JOB." |
---|
958 | echo |
---|
959 | IGCM_debug_CallStack |
---|
960 | |
---|
961 | # Mail notification |
---|
962 | IGCM_sys_SendMail |
---|
963 | |
---|
964 | # Inform the rabbitMQ queue |
---|
965 | IGCM_debug_BigBro_Finalize |
---|
966 | |
---|
967 | # And Good Bye |
---|
968 | date |
---|
969 | exit 1 |
---|
970 | |
---|
971 | elif [ X${TaskType} = Xpost-processing ] ; then |
---|
972 | StopAll=false |
---|
973 | # Test if we need to stop the computing job |
---|
974 | case ${postProcessingName} in |
---|
975 | atlas*|monitoring*|metrics*) |
---|
976 | [ ${postProcessingStopLevel} -gt 2 ] && StopAll=true ;; |
---|
977 | create_*) |
---|
978 | [ ${postProcessingStopLevel} -gt 1 ] && StopAll=true ;; |
---|
979 | rebuild*|pack_*) |
---|
980 | [ ${postProcessingStopLevel} -gt 0 ] && StopAll=true ;; |
---|
981 | esac |
---|
982 | # Notify the computing job that something wrong happened and stop it. |
---|
983 | ( ${StopAll} ) && IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal.${Script_Post_Output}" |
---|
984 | |
---|
985 | # If SpaceName is PROD we stop when post_processing failed |
---|
986 | if [ X${config_UserChoices_SpaceName} = XPROD ] ; then |
---|
987 | echo " EXIT THE POST-PROCESSING JOB." |
---|
988 | echo |
---|
989 | IGCM_debug_CallStack |
---|
990 | |
---|
991 | # Inform the rabbitMQ queue |
---|
992 | IGCM_debug_BigBro_Finalize |
---|
993 | |
---|
994 | # And Good Bye |
---|
995 | date |
---|
996 | exit 1 |
---|
997 | else |
---|
998 | echo "In config.card the variable SpaceName is not in PROD" |
---|
999 | echo " SO WE DO NOT EXIT THE JOB." |
---|
1000 | echo |
---|
1001 | date |
---|
1002 | fi |
---|
1003 | elif [ X${TaskType} = Xchecking ] ; then |
---|
1004 | echo "Nothing will happen for now" |
---|
1005 | fi |
---|
1006 | fi |
---|
1007 | } |
---|
1008 | |
---|
1009 | #D-#================================================================== |
---|
1010 | #D-function IGCM_debug_Print |
---|
1011 | #D-* Purpose: Print arguments according to a level of verbosity. |
---|
1012 | #D- |
---|
1013 | function IGCM_debug_Print |
---|
1014 | { |
---|
1015 | typeset level=$1 |
---|
1016 | shift |
---|
1017 | |
---|
1018 | if [ X"${1}" = X"-e" ]; then |
---|
1019 | typeset cmd_echo="echo -e" |
---|
1020 | shift |
---|
1021 | else |
---|
1022 | typeset cmd_echo="echo" |
---|
1023 | fi |
---|
1024 | |
---|
1025 | if [ ${level} -le ${Verbosity} ] ; then |
---|
1026 | typeset i |
---|
1027 | case "${level}" in |
---|
1028 | 1) for i in "$@" ; do |
---|
1029 | ${cmd_echo} $(date +"%Y-%m-%d %T") "--Debug1-->" ${i} |
---|
1030 | done ;; |
---|
1031 | 2) for i in "$@" ; do |
---|
1032 | ${cmd_echo} $(date +"%Y-%m-%d %T") "--------Debug2-->" ${i} |
---|
1033 | done ;; |
---|
1034 | 3) for i in "$@" ; do |
---|
1035 | ${cmd_echo} $(date +"%Y-%m-%d %T") "--------------Debug3-->" ${i} |
---|
1036 | done ;; |
---|
1037 | esac |
---|
1038 | fi |
---|
1039 | } |
---|
1040 | |
---|
1041 | #D-#================================================================== |
---|
1042 | #D-function IGCM_debug_PrintVariables |
---|
1043 | #D-* Purpose: Print arguments when match a pattern |
---|
1044 | #D- according to a level of verbosity. |
---|
1045 | function IGCM_debug_PrintVariables |
---|
1046 | { |
---|
1047 | typeset level=$1 |
---|
1048 | shift |
---|
1049 | |
---|
1050 | list=$( set | grep ^$1 | sed -e "s/'//g" ) |
---|
1051 | |
---|
1052 | if [ "X${list}" != X ] ; then |
---|
1053 | IGCM_debug_Print ${level} ${list} |
---|
1054 | fi |
---|
1055 | } |
---|
1056 | |
---|
1057 | #D-#================================================================== |
---|
1058 | #D-function IGCM_debug_PrintInfosActions |
---|
1059 | #D-* Purpose: Print information related to instrumentation |
---|
1060 | function IGCM_debug_PrintInfosActions |
---|
1061 | { |
---|
1062 | typeset actionType=$1 |
---|
1063 | typeset entitySize=$2 |
---|
1064 | typeset start_ms=$3 |
---|
1065 | typeset end_ms=$4 |
---|
1066 | |
---|
1067 | typeset dest=$5 |
---|
1068 | typeset source=$6 |
---|
1069 | |
---|
1070 | typeset diff_ms entitySizeKo entitySizeMo flux_Ko_ms flux_Ko_s flux_Mo_s |
---|
1071 | typeset dirFrom dirTo |
---|
1072 | |
---|
1073 | diff_ms=$(( $end_ms - $start_ms )) |
---|
1074 | # echo "diff_ms=$diff_ms" |
---|
1075 | |
---|
1076 | entitySizeKo=$( echo ${entitySize} | gawk -F"|" '{print $1}' ) |
---|
1077 | # echo "entitySizeKo=$entitySizeKo" |
---|
1078 | entitySizeMo=$( echo ${entitySize} | gawk -F"|" '{print $2}' ) |
---|
1079 | |
---|
1080 | # flux en Ko / ms |
---|
1081 | flux_Ko_ms=$( echo "scale=6;${entitySizeKo}/${diff_ms}" | bc ) |
---|
1082 | # echo "flux_Ko_ms=$flux_Ko_ms" |
---|
1083 | |
---|
1084 | # flux en Ko / s |
---|
1085 | flux_Ko_s=$(( $flux_Ko_ms * 1000 )) |
---|
1086 | # echo "flux_Ko_s=$flux_Ko_s" |
---|
1087 | |
---|
1088 | # flux en Mo / s |
---|
1089 | flux_Mo_s=$( echo "scale=6;${flux_Ko_s}/1024" | bc ) |
---|
1090 | # echo "flux_Mo_s=$flux_Mo_s" |
---|
1091 | |
---|
1092 | if [ -d $dest ] ; then |
---|
1093 | dirTo=$( readlink -f ${dest} ) |
---|
1094 | else |
---|
1095 | dirTo=$( readlink -f $( dirname ${dest} ) ) |
---|
1096 | fi |
---|
1097 | |
---|
1098 | if [ -d $source ] ; then |
---|
1099 | dirFrom=$( readlink -f ${source} ) |
---|
1100 | else |
---|
1101 | dirFrom=$( readlink -f $( dirname ${source} ) ) |
---|
1102 | fi |
---|
1103 | |
---|
1104 | instrumentationContent=$( echo "\"actionName\":\"${actionType}\",\"size_Mo\":\"${entitySizeMo}\",\"duration_ms\":\"${diff_ms}\",\"throughput_Mo_s\":\"${flux_Mo_s}\",\"dirFrom\":\"${dirFrom}\",\"dirTo\":\"${dirTo}\"" ) |
---|
1105 | |
---|
1106 | if [ X${ActivateStackFilling} = Xtrue ] ; then |
---|
1107 | echo "{${instrumentationContent}}" >> ${StackFileLocation}/${StackFileName} |
---|
1108 | fi |
---|
1109 | |
---|
1110 | # Inform the rabbitMQ queue |
---|
1111 | if [ X${ActivateBigBro} = Xtrue ] ; then |
---|
1112 | # RabbitMQ message body |
---|
1113 | Body=$( echo "{${genericSimulationID},\"msgCode\":\"7000\",\"msgUID\":\"$(uuidgen)\",${instrumentationContent},\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" ) |
---|
1114 | # Fill the rabbitMQ queue |
---|
1115 | IGCM_debug_sendAMQP |
---|
1116 | fi |
---|
1117 | } |
---|
1118 | |
---|
1119 | #D-#================================================================== |
---|
1120 | #D-function IGCM_debug_Check |
---|
1121 | #D- * Purpose: Check the present file by comparison with a reference file |
---|
1122 | function IGCM_debug_Check |
---|
1123 | { |
---|
1124 | #--------------------- |
---|
1125 | if [ ! -n "${libIGCM}" ] ; then |
---|
1126 | echo "Check libIGCM_debug ..........................................[ FAILED ]" |
---|
1127 | echo "--Error--> libIGCM variable is not defined" |
---|
1128 | exit 2 |
---|
1129 | fi |
---|
1130 | |
---|
1131 | #--------------------- |
---|
1132 | if [ ! -n "${Verbosity}" ] ; then |
---|
1133 | echo "Check libIGCM_debug ..........................................[ FAILED ]" |
---|
1134 | echo "--Error--> Verbosity variable is not defined" |
---|
1135 | exit 3 |
---|
1136 | fi |
---|
1137 | |
---|
1138 | #--------------------- |
---|
1139 | # Need to remove timestamps here |
---|
1140 | diff ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref <(${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh | sed -e "s:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]\:[0-9][0-9]\:[0-9][0-9] ::g") > /dev/null 2>&1 |
---|
1141 | status=$? |
---|
1142 | |
---|
1143 | if [ ${status} -eq 0 ] ; then |
---|
1144 | echo "Check libIGCM_debug ..............................................[ OK ]" |
---|
1145 | else |
---|
1146 | echo "Check libIGCM_debug ..........................................[ FAILED ]" |
---|
1147 | echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh" |
---|
1148 | echo " has produced the file IGCM_debug_Test.ref.failed" |
---|
1149 | echo " Please analyse differences with the reference file by typing:" |
---|
1150 | echo " diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref" |
---|
1151 | echo " Report errors to the author: Patrick.Brockmann@cea.fr" |
---|
1152 | diff ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref <(${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh | sed -e "s:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]\:[0-9][0-9]\:[0-9][0-9] ::g") |
---|
1153 | exit 4 |
---|
1154 | fi |
---|
1155 | #--------------------- |
---|
1156 | } |
---|
1157 | + Verbosity=3 |
---|
1158 | + typeset -i Verbosity |
---|
1159 | + DEBUG_debug=false |
---|
1160 | + postProcessingStopLevel=0 |
---|
1161 | + RandomError=false |
---|
1162 | + typeset -r RandomError |
---|
1163 | + NULL_STR=_0_ |
---|
1164 | + typeset -r NULL_STR |
---|
1165 | + libIGCMVersion=2.8.3 |
---|
1166 | + typeset -r libIGCMVersion |
---|
1167 | + ExitFlag=false |
---|
1168 | + simulationIsOver=false |
---|
1169 | + FlushAMQP=false |
---|
1170 | + unset IGCM_debug_Stack |
---|
1171 | + unset IGCM_debug_StackArgs |
---|
1172 | + unset IGCM_debug_StackTiming |
---|
1173 | + IGCM_debug_Stack[0]=_0_ |
---|
1174 | + IGCM_debug_StackArgs[0]=_0_ |
---|
1175 | + IGCM_debug_StackTiming[0]=_0_ |
---|
1176 | + IGCM_debug_LenStack=0 |
---|
1177 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
1178 | + . /ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM/libIGCM_card/libIGCM_card.ksh |
---|
1179 | #!/bin/ksh |
---|
1180 | |
---|
1181 | #************************************************************** |
---|
1182 | # Author: Patrick Brockmann |
---|
1183 | # Contact: Patrick.Brockmann__at__cea.fr |
---|
1184 | # $Revision:: 1152 $ Revision of last commit |
---|
1185 | # $Author:: sdipsl $ Author of last commit |
---|
1186 | # $Date:: 2015-01-19 15:45:38 +0100 (Mon, 19 Jan 2015) $ Date of last commit |
---|
1187 | # IPSL (2006) |
---|
1188 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
1189 | # |
---|
1190 | #************************************************************** |
---|
1191 | |
---|
1192 | #================================================== |
---|
1193 | # The documentation of this file can be automatically generated |
---|
1194 | # if you use the prefix #D- for comments to be extracted. |
---|
1195 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
1196 | #================================================== |
---|
1197 | |
---|
1198 | #D-#================================================================== |
---|
1199 | #D-libIGCM_card |
---|
1200 | #D-This ksh library handles extraction of information from configuration file |
---|
1201 | #D-called "card" file (en français fichier "carte"). |
---|
1202 | #D-All function described bellow must be prefixed by IGCM_card. |
---|
1203 | #D-A card file is organized as follows : |
---|
1204 | #D- --------------------- |
---|
1205 | #D-[Messages] |
---|
1206 | #D-Option1= "Hello Earth" |
---|
1207 | #D-Option2= "Hello Mars" |
---|
1208 | #D- |
---|
1209 | #D-# My comments |
---|
1210 | #D-[Recipes] |
---|
1211 | #D-Cake= "file1.doc" |
---|
1212 | #D-Starter= "file2.doc" |
---|
1213 | #D- |
---|
1214 | #D-[ColorValues] |
---|
1215 | #D-Red= 120 |
---|
1216 | #D-Blue= 230 |
---|
1217 | #D-Green= 178 |
---|
1218 | #D- |
---|
1219 | #D-[Couples] |
---|
1220 | #D-List1= (up, down), \ |
---|
1221 | #D- (humid, dry), \ |
---|
1222 | #D- (hot, cold), \ |
---|
1223 | #D- (far, close) |
---|
1224 | #D-List2= (ice, fire, air, water) |
---|
1225 | #D- --------------------- |
---|
1226 | #D- |
---|
1227 | |
---|
1228 | #D-#================================================================== |
---|
1229 | #D-function IGCM_card_PrintOption |
---|
1230 | #D-* Purpose: Print an option from a given file.card and section |
---|
1231 | #D-* Usage: IGCM_card_PrintOption file.card section option |
---|
1232 | #D-* Only used by IGCM_card_Test.ksh |
---|
1233 | #D- |
---|
1234 | function IGCM_card_PrintOption |
---|
1235 | { |
---|
1236 | IGCM_debug_PushStack "IGCM_card_PrintOption" $@ |
---|
1237 | if ( [ -r "$1" ] && [ -f "$1" ] ) ; then |
---|
1238 | gawk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintOption.awk "$@" |
---|
1239 | else |
---|
1240 | echo |
---|
1241 | IGCM_debug_Print 1 "--Error--> IGCM_card_PrintOption $@" |
---|
1242 | IGCM_debug_Print 1 " $1 is not readable" |
---|
1243 | IGCM_debug_Exit "IGCM_card_PrintOption" |
---|
1244 | fi |
---|
1245 | IGCM_debug_PopStack "IGCM_card_PrintOption" |
---|
1246 | } |
---|
1247 | |
---|
1248 | #D-#================================================================== |
---|
1249 | #D-function IGCM_card_PrintSection |
---|
1250 | #D-* Purpose: Print all options from a given file.card and section |
---|
1251 | #D-* Usage: IGCM_card_PrintSection file.card section |
---|
1252 | #D-* Only used by IGCM_card_Test.ksh |
---|
1253 | #D- |
---|
1254 | function IGCM_card_PrintSection |
---|
1255 | { |
---|
1256 | IGCM_debug_PushStack "IGCM_card_PrintSection" $@ |
---|
1257 | if ( [ -r "$1" ] && [ -f "$1" ] ) ; then |
---|
1258 | gawk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintSection.awk -- "$@" |
---|
1259 | else |
---|
1260 | IGCM_debug_Print 1 "--Error--> IGCM_card_PrintSection $@" |
---|
1261 | IGCM_debug_Print 1 " $1 is not readable" |
---|
1262 | IGCM_debug_Exit "IGCM_card_PrintSection" |
---|
1263 | fi |
---|
1264 | IGCM_debug_PopStack "IGCM_card_PrintSection" |
---|
1265 | } |
---|
1266 | |
---|
1267 | #D-#================================================================== |
---|
1268 | #D-function IGCM_card_DefineVariableFromOption |
---|
1269 | #D-* Purpose: Define a variable from a given file.card, section and option |
---|
1270 | #D-* Variable name is automatically defined as file_section_option |
---|
1271 | #D-* Usage: IGCM_card_DefineVariableFromOption file.card section option |
---|
1272 | #D- |
---|
1273 | function IGCM_card_DefineVariableFromOption |
---|
1274 | { |
---|
1275 | IGCM_debug_PushStack "IGCM_card_DefineVariableFromOption" $@ |
---|
1276 | if ( [ -r "$1" ] && [ -f "$1" ] ) ; then |
---|
1277 | # Get basename of card file ($1) |
---|
1278 | typeset name1=${1##*/} |
---|
1279 | # Build name of variable as $1_$2_$3 (cardname_Section_Option) |
---|
1280 | typeset name=${name1%%.*}_${2}_${3} |
---|
1281 | typeset value=$( gawk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintOption.awk -- "$@" ) |
---|
1282 | |
---|
1283 | # Only if a Section is missing we exit the job. |
---|
1284 | # We must allow missing Option to keep backward compatibilty. |
---|
1285 | if [ "${value}" = "Error: Section not found" ] ; then |
---|
1286 | echo |
---|
1287 | IGCM_debug_Print 1 "Error with readding of ${name} variable in ${1}." |
---|
1288 | IGCM_debug_Print 1 "Error: Section ${2} not found" |
---|
1289 | IGCM_debug_Exit |
---|
1290 | IGCM_debug_Verif_Exit |
---|
1291 | elif [ "${value}" = "Error: Option not found" ] ; then |
---|
1292 | eval ${name}=${NULL_STR} |
---|
1293 | else |
---|
1294 | eval ${name}=${value} |
---|
1295 | fi |
---|
1296 | else |
---|
1297 | echo |
---|
1298 | IGCM_debug_Print 1 "--Error--> IGCM_card_DefineVariableFromOption" |
---|
1299 | IGCM_debug_Print 1 "--Error--> $1 is not readable" |
---|
1300 | IGCM_debug_Exit "IGCM_card_DefineVariableFromOption" |
---|
1301 | IGCM_debug_Verif_Exit |
---|
1302 | fi |
---|
1303 | IGCM_debug_PopStack "IGCM_card_DefineVariableFromOption" |
---|
1304 | } |
---|
1305 | |
---|
1306 | #D-#================================================================== |
---|
1307 | #D-function IGCM_card_DefineArrayFromOption |
---|
1308 | #D-* Purpose: Define an array variable from a given file.card, section and option |
---|
1309 | #D-* Array variable is automatically defined as file_section_option |
---|
1310 | #D-* Usage: IGCM_card_DefineArrayFromOption file.card section option |
---|
1311 | #D- |
---|
1312 | function IGCM_card_DefineArrayFromOption |
---|
1313 | { |
---|
1314 | IGCM_debug_PushStack "IGCM_card_DefineArrayFromOption" $@ |
---|
1315 | if ( [ -r "$1" ] && [ -f "$1" ] ) ; then |
---|
1316 | # Get basename of card file ($1) |
---|
1317 | typeset name1=${1##*/} |
---|
1318 | # Build name of array as $1_$2_$3 (cardname_Section_Option) |
---|
1319 | typeset name=${name1%%.*}_${2}_${3} |
---|
1320 | eval unset ${name} |
---|
1321 | eval ${name}[0]=${NULL_STR} |
---|
1322 | set +A ${name} -- $( gawk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintOption.awk -- "$@" | gawk -- 'BEGIN {FS="[() ,]+"} {for (i=2; i <= NF-1; i++) printf("%s ",$i)}' ) |
---|
1323 | else |
---|
1324 | echo |
---|
1325 | IGCM_debug_Print 1 "--Error--> IGCM_card_DefineArrayFromOption $@" |
---|
1326 | IGCM_debug_Print 1 " $1 is not readable" |
---|
1327 | IGCM_debug_Exit "IGCM_card_DefineArrayFromOption" |
---|
1328 | fi |
---|
1329 | IGCM_debug_PopStack "IGCM_card_DefineArrayFromOption" |
---|
1330 | } |
---|
1331 | |
---|
1332 | #D-#================================================================== |
---|
1333 | #D-function IGCM_card_DefineArrayFromSection |
---|
1334 | #D-* Purpose: Define an array variable from a given file.card and section |
---|
1335 | #D-* Array variable is automatically defined as file_section |
---|
1336 | #D-* Usage: IGCM_card_DefineArrayFromSection file.card section |
---|
1337 | #D- |
---|
1338 | function IGCM_card_DefineArrayFromSection |
---|
1339 | { |
---|
1340 | IGCM_debug_PushStack "IGCM_card_DefineArrayFromSection" $@ |
---|
1341 | if ( [ -r "$1" ] && [ -f "$1" ] ) ; then |
---|
1342 | # Get basename of card file ($1) |
---|
1343 | typeset name1=${1##*/} |
---|
1344 | # Build name of array as $1_$2 (cardname_Section) |
---|
1345 | typeset name=${name1%%.*}_${2} |
---|
1346 | eval unset ${name} |
---|
1347 | eval ${name}[0]=${NULL_STR} |
---|
1348 | set +A ${name} -- $( gawk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintSection.awk -- "$@" ) |
---|
1349 | #if [ "$( eval echo \${${name}[@]} )" = "Error: Section not found" ] ; then |
---|
1350 | # echo |
---|
1351 | # IGCM_debug_Print 1 "Error with readding of ${name} variable in ${1}." |
---|
1352 | # IGCM_debug_Print 1 "Error: Section ${2} not found" |
---|
1353 | # IGCM_debug_Exit |
---|
1354 | # IGCM_debug_Verif_Exit |
---|
1355 | #fi |
---|
1356 | if [ "$( eval echo \${${name}[@]} )" = "Error: Section not found" ] ; then |
---|
1357 | echo |
---|
1358 | IGCM_debug_Print 1 "Warning with readding of ${name} variable in ${1}." |
---|
1359 | IGCM_debug_Print 1 "Warning: Section ${2} not found" |
---|
1360 | eval unset ${name} |
---|
1361 | fi |
---|
1362 | else |
---|
1363 | IGCM_debug_Print 1 "--Error--> IGCM_card_DefineArrayFromSection $@" |
---|
1364 | IGCM_debug_Print 1 " $1 is not readable" |
---|
1365 | IGCM_debug_Exit "IGCM_card_DefineArrayFromSection" |
---|
1366 | fi |
---|
1367 | IGCM_debug_PopStack "IGCM_card_DefineArrayFromSection" |
---|
1368 | } |
---|
1369 | |
---|
1370 | #D-#================================================================== |
---|
1371 | #D-function IGCM_card_WriteOption |
---|
1372 | #D-* Purpose: Write an option in a given file.card and section |
---|
1373 | #D-* Usage: IGCM_card_WriteOption file.card section newvalue |
---|
1374 | #D-* Examples: IGCM_card_WriteOption file.card Recipes Red 150 |
---|
1375 | #D- IGCM_card_WriteOption file.card Messages Option2 '"Hello Mercure"' |
---|
1376 | #D- IGCM_card_WriteOption file.card Messages ListVal1 '( 1, 2, 3 )' |
---|
1377 | #D- listname="(Sebastien, Martial, Patrick)" |
---|
1378 | #D- IGCM_card_WriteOption NewTestFile.card Messages ListVal2 "${listname}" |
---|
1379 | #D- |
---|
1380 | function IGCM_card_WriteOption |
---|
1381 | { |
---|
1382 | IGCM_debug_PushStack "IGCM_card_WriteOption" $@ |
---|
1383 | if ( [ -r "$1" ] && [ -w "$1" ] && [ -f "$1" ] ) ; then |
---|
1384 | if [ $( IGCM_card_PrintOption "$1" "$2" "$3" | grep "not found" | wc -l ) -gt 0 ] ; then |
---|
1385 | IGCM_debug_Print 1 "!!! Issue with IGCM_card_WriteOption !!!" |
---|
1386 | IGCM_debug_Print 1 "We tried to write : $@" |
---|
1387 | IGCM_debug_Exit "Must check that option $3 in section $2 exist in this file $1" |
---|
1388 | IGCM_debug_Verif_Exit |
---|
1389 | fi |
---|
1390 | |
---|
1391 | # The tmpfile uses now the real path of the card to be modified, |
---|
1392 | # not just a local tmpfile with PID. |
---|
1393 | tmpfile=$1_mutex_$$ |
---|
1394 | |
---|
1395 | IGCM_card_CheckConflict $1 |
---|
1396 | |
---|
1397 | # Do the job |
---|
1398 | ( gawk -f ${libIGCM}/libIGCM_card/IGCM_card_WriteOption.awk -- "$@" 2> /dev/null ) > ${tmpfile} |
---|
1399 | |
---|
1400 | cp $1 $1.bak |
---|
1401 | mv ${tmpfile} $1 |
---|
1402 | |
---|
1403 | else |
---|
1404 | echo |
---|
1405 | IGCM_debug_Print 1 "--Error--> IGCM_card_WriteOption $@" |
---|
1406 | IGCM_debug_Print 1 " $1 is not readable or not writable" |
---|
1407 | IGCM_debug_Exit "IGCM_card_WriteOption" |
---|
1408 | fi |
---|
1409 | IGCM_debug_PopStack "IGCM_card_WriteOption" |
---|
1410 | } |
---|
1411 | |
---|
1412 | #D-#================================================================== |
---|
1413 | #D-function IGCM_card_CheckConflict |
---|
1414 | #D-* Purpose: Check that a card is not in use by another process. If it is the case wait until it is not. |
---|
1415 | #D-* Usage: IGCM_card_CheckConflict run.card |
---|
1416 | #D-* Examples: |
---|
1417 | #D- |
---|
1418 | function IGCM_card_CheckConflict |
---|
1419 | { |
---|
1420 | IGCM_debug_PushStack "IGCM_card_CheckConflict" $@ |
---|
1421 | typeset isleep tmpfiles |
---|
1422 | |
---|
1423 | # Watch for possible conflics : Check for other tmpfiles. |
---|
1424 | set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null ) |
---|
1425 | ((isleep=0)) |
---|
1426 | while [ ${#tmpfiles[@]} -gt 0 ] ; do |
---|
1427 | echo "Conflict between two processes working on " $1 "!!!" ${tmpfiles[@]} |
---|
1428 | sleep 1 |
---|
1429 | ((isleep=isleep+1)) |
---|
1430 | if [ ${isleep} -gt 20 ] ; then |
---|
1431 | echo "Too many loops waiting for other process working on " $1 ". We continue." |
---|
1432 | echo "You should see if one process of your run or post-treatment may have terminated suddenly." |
---|
1433 | echo "Afer, you should erase this(those) file(s) : " ${tmpfiles[@]} |
---|
1434 | # Send a mail to USER ?? |
---|
1435 | break ; |
---|
1436 | fi |
---|
1437 | unset tmpfiles |
---|
1438 | set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null ) |
---|
1439 | done |
---|
1440 | |
---|
1441 | IGCM_debug_PopStack "IGCM_card_CheckConflict" |
---|
1442 | } |
---|
1443 | |
---|
1444 | #D-#================================================================== |
---|
1445 | #D-function IGCM_card_WriteArrayOption |
---|
1446 | #D-* Purpose: Write an array option a given file.card and section |
---|
1447 | #D-* Usage: IGCM_card_WriteArrayOption file.card section option newarray |
---|
1448 | #D-* Examples: set -A MyArray -- 1 2 3 |
---|
1449 | #D- IGCM_card_WriteArrayOption file.card Recipes List MyArray |
---|
1450 | #D- |
---|
1451 | function IGCM_card_WriteArrayOption |
---|
1452 | { |
---|
1453 | IGCM_debug_PushStack "IGCM_card_WriteArrayOption" $@ |
---|
1454 | |
---|
1455 | if ( [ -r "$1" ] && [ -w "$1" ] && [ -f "$1" ] ) ; then |
---|
1456 | if [ X"${4}" != X"" ]; then |
---|
1457 | tab=$4 |
---|
1458 | IGCM_card_WriteOption $1 $2 $3 '('$( eval echo \${${tab}[@]} | sed -e 's/ /,/g' )')' |
---|
1459 | else |
---|
1460 | IGCM_card_WriteOption $1 $2 $3 '()' |
---|
1461 | fi |
---|
1462 | else |
---|
1463 | echo |
---|
1464 | IGCM_debug_Print 1 "--Error--> IGCM_card_WriteArrayOption $@" |
---|
1465 | IGCM_debug_Print 1 " $1 is not readable or not writable" |
---|
1466 | IGCM_debug_Exit "IGCM_card_WriteArrayOption" |
---|
1467 | fi |
---|
1468 | IGCM_debug_PopStack "IGCM_card_WriteArrayOption" |
---|
1469 | } |
---|
1470 | |
---|
1471 | #D-#================================================================== |
---|
1472 | #D-function IGCM_card_Check |
---|
1473 | #D-* Purpose: Check the present file by comparison with a reference file |
---|
1474 | #D-* Usage: IGCM_card_Check |
---|
1475 | #D- |
---|
1476 | function IGCM_card_Check |
---|
1477 | { |
---|
1478 | #--------------------- |
---|
1479 | if [ ! -n "${libIGCM}" ] ; then |
---|
1480 | echo "Check libIGCM_card ...........................................[ FAILED ]" |
---|
1481 | echo "--Error--> libIGCM variable is not defined" |
---|
1482 | IGCM_debug_Exit "IGCM_card_Check" |
---|
1483 | fi |
---|
1484 | |
---|
1485 | #--------------------- |
---|
1486 | whence -v gawk > /dev/null 2>&1 |
---|
1487 | if [ ! $? -eq 0 ] ; then |
---|
1488 | echo "Check libIGCM_card ...........................................[ FAILED ]" |
---|
1489 | echo "--Error--> gawk command is not defined" |
---|
1490 | IGCM_debug_Exit "IGCM_card_Check" |
---|
1491 | fi |
---|
1492 | |
---|
1493 | #--------------------- |
---|
1494 | # No need to remove timestamps here |
---|
1495 | diff ${libIGCM}/libIGCM_card/IGCM_card_Test.ref <(${libIGCM}/libIGCM_card/IGCM_card_Test.ksh) > /dev/null 2>&1 |
---|
1496 | status=$? |
---|
1497 | |
---|
1498 | if [ ${status} -eq 0 ] ; then |
---|
1499 | echo "Check libIGCM_card ...............................................[ OK ]" |
---|
1500 | else |
---|
1501 | echo "Check libIGCM_card ...........................................[ FAILED ]" |
---|
1502 | echo "--Error--> Execution of ${libIGCM}/libIGCM_card/IGCM_card_Test.ksh" |
---|
1503 | echo " has produced the file IGCM_card_Test.ref.failed" |
---|
1504 | echo " Please analyse differences with the reference file by typing:" |
---|
1505 | echo " diff IGCM_card_Test.ref.failed ${libIGCM}/libIGCM_card/IGCM_card_Test.ref" |
---|
1506 | echo " Report errors to the author: Patrick.Brockmann@cea.fr" |
---|
1507 | diff ${libIGCM}/libIGCM_card/IGCM_card_Test.ref <(${libIGCM}/libIGCM_card/IGCM_card_Test.ksh) |
---|
1508 | IGCM_debug_Exit "IGCM_card_Check" |
---|
1509 | fi |
---|
1510 | } |
---|
1511 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh |
---|
1512 | + . /ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM/libIGCM_date/libIGCM_date.ksh |
---|
1513 | #!/bin/ksh |
---|
1514 | |
---|
1515 | #************************************************************** |
---|
1516 | # Author: Sebastien Denvil |
---|
1517 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
1518 | # $Revision:: 1206 $ Revision of last commit |
---|
1519 | # $Author:: sdipsl $ Author of last commit |
---|
1520 | # $Date:: 2015-06-05 17:28:35 +0200 (Fri, 05 Jun 2015) $ Date of last commit |
---|
1521 | # IPSL (2006) |
---|
1522 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
1523 | # |
---|
1524 | #************************************************************** |
---|
1525 | |
---|
1526 | #================================================== |
---|
1527 | # The documentation of this file can be automatically generated |
---|
1528 | # if you use the prefix #D- for comments to be extracted. |
---|
1529 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
1530 | #================================================== |
---|
1531 | |
---|
1532 | #D-#================================================================== |
---|
1533 | #D-libIGCM_date |
---|
1534 | #D-This ksh library handles date calculs and convertions in different calendars. |
---|
1535 | #D- types of calendars are possible : |
---|
1536 | #D- |
---|
1537 | #D- - leap|gregorian|standard (other name leap) : |
---|
1538 | #D- The normal calendar. The time origin for the |
---|
1539 | #D- julian day in this case is 24 Nov -4713. |
---|
1540 | #D- - noleap|365_day : |
---|
1541 | #D- A 365 day year without leap years. |
---|
1542 | #D- - all_leap|366_day : |
---|
1543 | #D- A 366 day year with only leap years. |
---|
1544 | #D- - 360d|360_day : |
---|
1545 | #D- Year of 360 days with month of equal length. |
---|
1546 | |
---|
1547 | # Number of digit in the year |
---|
1548 | typeset -r dY=${dY:=4} |
---|
1549 | #typeset -r MaxpY=$( echo "10^"$((dY+1)) | bc -l ) |
---|
1550 | # Number of digit in non-human date representation |
---|
1551 | typeset -r pY=$(( dY+4 )) |
---|
1552 | |
---|
1553 | #================================================================== |
---|
1554 | function IGCM_date_YearDigit |
---|
1555 | { |
---|
1556 | IGCM_debug_PushStack "IGCM_date_YearDigit" $@ |
---|
1557 | |
---|
1558 | typeset NUM |
---|
1559 | |
---|
1560 | NUM=$(( 10#${1} )) |
---|
1561 | echo $( gawk "BEGIN { printf \"%0${dY}d\",${NUM} }" ) |
---|
1562 | |
---|
1563 | IGCM_debug_PopStack "IGCM_date_YearDigit" |
---|
1564 | } |
---|
1565 | |
---|
1566 | #================================================================== |
---|
1567 | function IGCM_date_GregorianDigit |
---|
1568 | { |
---|
1569 | IGCM_debug_PushStack "IGCM_date_GregorianDigit" $@ |
---|
1570 | |
---|
1571 | typeset NUM |
---|
1572 | |
---|
1573 | NUM=$(( 10#${1} )) |
---|
1574 | |
---|
1575 | echo $( gawk "BEGIN { printf \"%0${pY}d\",${NUM} }" ) |
---|
1576 | |
---|
1577 | IGCM_debug_PopStack "IGCM_date_GregorianDigit" |
---|
1578 | } |
---|
1579 | |
---|
1580 | #================================================================== |
---|
1581 | function IGCM_date_HumanDigit |
---|
1582 | { |
---|
1583 | IGCM_debug_PushStack "IGCM_date_HumanDigit" $@ |
---|
1584 | |
---|
1585 | echo $( IGCM_date_GregorianDigit $( print ${1} | sed 's/-//g' ) ) \ |
---|
1586 | | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/" |
---|
1587 | |
---|
1588 | IGCM_debug_PopStack "IGCM_date_HumanDigit" |
---|
1589 | } |
---|
1590 | |
---|
1591 | #================================================================== |
---|
1592 | function IGCM_date_SupressZeros |
---|
1593 | { |
---|
1594 | IGCM_debug_PushStack "IGCM_date_SupressZeros" $@ |
---|
1595 | echo $( print ${1} | sed -e "s/0*//" ) |
---|
1596 | IGCM_debug_PopStack "IGCM_date_SupressZeros" |
---|
1597 | } |
---|
1598 | |
---|
1599 | #================================================================== |
---|
1600 | function IGCM_date_ConvertFormatToGregorian |
---|
1601 | { |
---|
1602 | IGCM_debug_PushStack "IGCM_date_ConvertFormatToGregorian" $@ |
---|
1603 | |
---|
1604 | # from a yyyy-mm-dd date format return |
---|
1605 | # a yyymmdd date format |
---|
1606 | # usage IGCM_date_ConvertFormat yyyy-mm-dd |
---|
1607 | |
---|
1608 | # if there is no argument on the command line, |
---|
1609 | # then assume that a y-m-d formated date is being |
---|
1610 | # piped in |
---|
1611 | typeset ymd |
---|
1612 | if [ $# = 0 ] |
---|
1613 | then |
---|
1614 | read ymd |
---|
1615 | else |
---|
1616 | ymd=$1 |
---|
1617 | fi |
---|
1618 | |
---|
1619 | IGCM_date_GregorianDigit $( print ${ymd} | sed 's/-//g' ) |
---|
1620 | |
---|
1621 | IGCM_debug_PopStack "IGCM_date_ConvertFormatToGregorian" |
---|
1622 | } |
---|
1623 | |
---|
1624 | #================================================================== |
---|
1625 | function IGCM_date_ConvertFormatToHuman |
---|
1626 | { |
---|
1627 | IGCM_debug_PushStack "IGCM_date_ConvertFormatToHuman" $@ |
---|
1628 | |
---|
1629 | # from a yyyymmdd date format return |
---|
1630 | # a yyyy-mm-dd date format |
---|
1631 | # usage IGCM_date_ConvertFormat yyyymmdd |
---|
1632 | |
---|
1633 | # if there is no argument on the command line, |
---|
1634 | # then assume that a yyyymmdd formated date is being |
---|
1635 | # piped in |
---|
1636 | typeset dt |
---|
1637 | if [ $# = 0 ] |
---|
1638 | then |
---|
1639 | read dt |
---|
1640 | else |
---|
1641 | dt=$1 |
---|
1642 | fi |
---|
1643 | |
---|
1644 | # break the yyyymmdd into separate parts for year, month and day |
---|
1645 | echo $( IGCM_date_GregorianDigit ${dt} ) | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/" |
---|
1646 | |
---|
1647 | IGCM_debug_PopStack "IGCM_date_ConvertFormatToHuman" |
---|
1648 | } |
---|
1649 | |
---|
1650 | #================================================================== |
---|
1651 | function IGCM_date_GetYearMonth |
---|
1652 | { |
---|
1653 | IGCM_debug_PushStack "IGCM_date_GetYearMonth" $@ |
---|
1654 | |
---|
1655 | # from a yyyymmdd date format return |
---|
1656 | # a yyyy year and mm month |
---|
1657 | # usage IGCM_date_GetYearMonth yyyymmdd year_var month_var |
---|
1658 | |
---|
1659 | # if there is no argument on the command line, |
---|
1660 | # then assume that a yyyymmdd formated date is being |
---|
1661 | # piped in |
---|
1662 | typeset dt |
---|
1663 | if [ $# = 0 ] |
---|
1664 | then |
---|
1665 | read dt |
---|
1666 | else |
---|
1667 | dt=$1 |
---|
1668 | fi |
---|
1669 | |
---|
1670 | # break the yyyymmdd into separate parts for year, month and day |
---|
1671 | eval $2=$( IGCM_date_GregorianDigit ${dt} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" ) |
---|
1672 | eval $3=$( IGCM_date_GregorianDigit ${dt} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" ) |
---|
1673 | |
---|
1674 | IGCM_debug_PopStack "IGCM_date_GetYearMonth" |
---|
1675 | } |
---|
1676 | |
---|
1677 | #================================================================== |
---|
1678 | function IGCM_date_GetYearMonthDay |
---|
1679 | { |
---|
1680 | IGCM_debug_PushStack "IGCM_date_GetYearMonthDay" $@ |
---|
1681 | |
---|
1682 | # from a yyyymmdd date format return |
---|
1683 | # a yyyy year, mm month and dd day |
---|
1684 | # usage IGCM_date_GetYearMonthDay yyyymmdd year_var month_var day_var |
---|
1685 | |
---|
1686 | # if there is no argument on the command line, |
---|
1687 | # then assume that a yyyymmdd formated date is being |
---|
1688 | # piped in |
---|
1689 | typeset dt |
---|
1690 | if [ $# = 0 ] |
---|
1691 | then |
---|
1692 | read dt |
---|
1693 | else |
---|
1694 | dt=$1 |
---|
1695 | fi |
---|
1696 | |
---|
1697 | # break the yyyymmdd into separate parts for year, month and day |
---|
1698 | eval $2=$( IGCM_date_GregorianDigit ${dt} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" ) |
---|
1699 | eval $3=$( IGCM_date_GregorianDigit ${dt} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" ) |
---|
1700 | eval $4=$( IGCM_date_GregorianDigit ${dt} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\3/" ) |
---|
1701 | |
---|
1702 | IGCM_debug_PopStack "IGCM_date_GetYearMonthDay" |
---|
1703 | } |
---|
1704 | |
---|
1705 | #D-#================================================================== |
---|
1706 | #D-function IGCM_date_DaysInYear |
---|
1707 | #D-* Purpose: Return the number of days in a year |
---|
1708 | #D-* Usage: IGCM_date_DaysInYear yyyy |
---|
1709 | #D- if there is no argument on the command line, |
---|
1710 | #D- then assume that a yyyy is being piped in |
---|
1711 | #D- |
---|
1712 | function IGCM_date_DaysInYear |
---|
1713 | { |
---|
1714 | # IGCM_debug_PushStack "IGCM_date_DaysInYear" $@ |
---|
1715 | # return the number of days in a year |
---|
1716 | # usage IGCM_date_DaysInYear yyyy |
---|
1717 | |
---|
1718 | # What is the calendar : |
---|
1719 | case ${config_UserChoices_CalendarType} in |
---|
1720 | 360d|360_day) |
---|
1721 | if [ X$2 = X ] ; then |
---|
1722 | echo 360 |
---|
1723 | else |
---|
1724 | eval $2=360 > /dev/null 2>&1 |
---|
1725 | fi |
---|
1726 | # IGCM_debug_PopStack "IGCM_date_DaysInYear" |
---|
1727 | return;; |
---|
1728 | noleap|365_day) |
---|
1729 | if [ X$2 = X ] ; then |
---|
1730 | echo 365 |
---|
1731 | else |
---|
1732 | eval $2=365 > /dev/null 2>&1 |
---|
1733 | fi |
---|
1734 | |
---|
1735 | # IGCM_debug_PopStack "IGCM_date_DaysInYear" |
---|
1736 | return;; |
---|
1737 | all_leap|366_day) |
---|
1738 | if [ X$2 = X ] ; then |
---|
1739 | echo 366 |
---|
1740 | else |
---|
1741 | eval $2=366 > /dev/null 2>&1 |
---|
1742 | fi |
---|
1743 | |
---|
1744 | # IGCM_debug_PopStack "IGCM_date_DaysInYear" |
---|
1745 | return;; |
---|
1746 | esac |
---|
1747 | |
---|
1748 | typeset y a |
---|
1749 | |
---|
1750 | # if there is no argument on the command line, |
---|
1751 | # then assume that a yyyy is being piped in |
---|
1752 | if [ $# = 0 ] |
---|
1753 | then |
---|
1754 | read y |
---|
1755 | else |
---|
1756 | y=$(( 10#${1} )) |
---|
1757 | fi |
---|
1758 | |
---|
1759 | # a year is a leap year if it is even divisible by 4 |
---|
1760 | # but not evenly divisible by 100 |
---|
1761 | # unless it is evenly divisible by 400 |
---|
1762 | |
---|
1763 | # if it is evenly divisible by 400 it must be a leap year |
---|
1764 | a=$(( $y % 400 )) |
---|
1765 | if [ $a = 0 ] |
---|
1766 | then |
---|
1767 | if [ X$2 = X ] ; then |
---|
1768 | echo 366 |
---|
1769 | else |
---|
1770 | eval $2=366 > /dev/null 2>&1 |
---|
1771 | fi |
---|
1772 | |
---|
1773 | # IGCM_debug_PopStack "IGCM_date_DaysInYear" |
---|
1774 | return |
---|
1775 | fi |
---|
1776 | |
---|
1777 | # if it is evenly divisible by 100 it must not be a leap year |
---|
1778 | a=$(( $y % 100 )) |
---|
1779 | if [ $a = 0 ] |
---|
1780 | then |
---|
1781 | if [ X$2 = X ] ; then |
---|
1782 | echo 365 |
---|
1783 | else |
---|
1784 | eval $2=365 > /dev/null 2>&1 |
---|
1785 | fi |
---|
1786 | |
---|
1787 | # IGCM_debug_PopStack "IGCM_date_DaysInYear" |
---|
1788 | return |
---|
1789 | fi |
---|
1790 | |
---|
1791 | # if it is evenly divisible by 4 it must be a leap year |
---|
1792 | a=$(( $y % 4 )) |
---|
1793 | if [ $a = 0 ] |
---|
1794 | then |
---|
1795 | if [ X$2 = X ] ; then |
---|
1796 | echo 366 |
---|
1797 | else |
---|
1798 | eval $2=366 > /dev/null 2>&1 |
---|
1799 | fi |
---|
1800 | |
---|
1801 | # IGCM_debug_PopStack "IGCM_date_DaysInYear" |
---|
1802 | return |
---|
1803 | fi |
---|
1804 | |
---|
1805 | # otherwise it is not a leap year |
---|
1806 | if [ X$2 = X ] ; then |
---|
1807 | echo 365 |
---|
1808 | else |
---|
1809 | eval $2=365 > /dev/null 2>&1 |
---|
1810 | fi |
---|
1811 | |
---|
1812 | # IGCM_debug_PopStack "IGCM_date_DaysInYear" |
---|
1813 | } |
---|
1814 | |
---|
1815 | #D-#================================================================== |
---|
1816 | #D-function IGCM_date_DaysInMonth |
---|
1817 | #D-* Purpose: Calculate the number of days in a month |
---|
1818 | #D-* Usage: IGCM_date_DaysInMonth yyyy mm |
---|
1819 | #D- or IGCM_date_DaysInMonth yyyymmdd |
---|
1820 | #D- if there are no command line arguments then |
---|
1821 | #D- assume that a yyyymmdd is being piped in and read the value. |
---|
1822 | #D- if there is only one argument assume it is a yyyymmdd on the command line |
---|
1823 | #D- other wise it is a yyyy and mm on the command line |
---|
1824 | function IGCM_date_DaysInMonth |
---|
1825 | { |
---|
1826 | # IGCM_debug_PushStack "IGCM_date_DaysInMonth" $@ |
---|
1827 | |
---|
1828 | # calculates the number of days in a month |
---|
1829 | # usage IGCM_date_DaysInMonth yyyy mm |
---|
1830 | # or IGCM_date_DaysInMonth yyyymmdd |
---|
1831 | |
---|
1832 | # What is the calendar : |
---|
1833 | if ( [ "${config_UserChoices_CalendarType}" = "360d" ] || [ "${config_UserChoices_CalendarType}" = "360_day" ] ) ; then |
---|
1834 | if [ X$3 = X ] ; then |
---|
1835 | echo 30 |
---|
1836 | else |
---|
1837 | eval $3=30 > /dev/null 2>&1 |
---|
1838 | fi |
---|
1839 | |
---|
1840 | # IGCM_debug_PopStack "IGCM_date_DaysInMonth" |
---|
1841 | return |
---|
1842 | fi |
---|
1843 | |
---|
1844 | typeset ymd y m |
---|
1845 | |
---|
1846 | # if there are no command line arguments then assume that a yyyymmdd is being |
---|
1847 | # piped in and read the value. |
---|
1848 | # if there is only one argument assume it is a yyyymmdd on the command line |
---|
1849 | # other wise it is a yyyy and mm on the command line |
---|
1850 | if [ $# = 0 ] |
---|
1851 | then |
---|
1852 | read ymd |
---|
1853 | elif [ $# = 1 ] |
---|
1854 | then |
---|
1855 | ymd=$1 |
---|
1856 | else |
---|
1857 | ymd=$(( ( $1 * 10000 ) + ( $2 * 100 ) + 1 )) |
---|
1858 | fi |
---|
1859 | |
---|
1860 | # extract the year and the month |
---|
1861 | y=$(( $ymd / 10000 )) ; |
---|
1862 | m=$(( ( $ymd % 10000 ) / 100 )) ; |
---|
1863 | |
---|
1864 | # 30 days hath september etc. |
---|
1865 | case $m in |
---|
1866 | 1|3|5|7|8|10|12) |
---|
1867 | if [ X$3 = X ] ; then |
---|
1868 | echo 31 |
---|
1869 | else |
---|
1870 | eval $3=31 > /dev/null 2>&1 |
---|
1871 | fi |
---|
1872 | |
---|
1873 | # IGCM_debug_PopStack "IGCM_date_DaysInMonth" |
---|
1874 | return ;; |
---|
1875 | 4|6|9|11) |
---|
1876 | if [ X$3 = X ] ; then |
---|
1877 | echo 30 |
---|
1878 | else |
---|
1879 | eval $3=30 > /dev/null 2>&1 |
---|
1880 | fi |
---|
1881 | |
---|
1882 | # IGCM_debug_PopStack "IGCM_date_DaysInMonth" |
---|
1883 | return ;; |
---|
1884 | *) ;; |
---|
1885 | esac |
---|
1886 | |
---|
1887 | # except for month 2 which depends on whether the year is a leap year |
---|
1888 | # Use IGCM_date_DaysInYear to get the number of days in the year and return a value |
---|
1889 | # accordingly. |
---|
1890 | |
---|
1891 | IGCM_date_DaysInYear $y diy |
---|
1892 | case $diy in |
---|
1893 | 365) |
---|
1894 | if [ X$3 = X ] ; then |
---|
1895 | echo 28 |
---|
1896 | else |
---|
1897 | eval $3=28 > /dev/null 2>&1 |
---|
1898 | fi |
---|
1899 | |
---|
1900 | # IGCM_debug_PopStack "IGCM_date_DaysInMonth" |
---|
1901 | return ;; |
---|
1902 | 366) |
---|
1903 | if [ X$3 = X ] ; then |
---|
1904 | echo 29 |
---|
1905 | else |
---|
1906 | eval $3=29 > /dev/null 2>&1 |
---|
1907 | fi |
---|
1908 | |
---|
1909 | # IGCM_debug_PopStack "IGCM_date_DaysInMonth" |
---|
1910 | return ;; |
---|
1911 | esac |
---|
1912 | |
---|
1913 | # IGCM_debug_PopStack "IGCM_date_DaysInMonth" |
---|
1914 | } |
---|
1915 | |
---|
1916 | #D-#================================================================== |
---|
1917 | #D-function IGCM_date_ConvertGregorianDateToJulian |
---|
1918 | #D-* Purpose: Convert yyyymmdd to yyyyddd |
---|
1919 | #D-* Usage: IGCM_date_ConvertGregorianDateToJulian 19980429 |
---|
1920 | #D- if there is no command line argument, then assume that the date |
---|
1921 | #D- is coming in on a pipe and use read to collect it |
---|
1922 | #D- |
---|
1923 | function IGCM_date_ConvertGregorianDateToJulian |
---|
1924 | { |
---|
1925 | IGCM_debug_PushStack "IGCM_date_ConvertGregorianDateToJulian" $@ |
---|
1926 | |
---|
1927 | # IGCM_date_ConvertGregorianDateToJulian converts yyyymmdd to yyyyddd |
---|
1928 | # usage IGCM_date_ConvertGregorianDateToJulian 19980429 |
---|
1929 | |
---|
1930 | typeset dt y m d x jul |
---|
1931 | |
---|
1932 | # if there is no command line argument, then assume that the date |
---|
1933 | # is coming in on a pipe and use read to collect it |
---|
1934 | if [ $# = 0 ] |
---|
1935 | then |
---|
1936 | read dt |
---|
1937 | else |
---|
1938 | dt=$( IGCM_date_SupressZeros $1 ) |
---|
1939 | fi |
---|
1940 | |
---|
1941 | # break the yyyymmdd into separate parts for year, month and day |
---|
1942 | y=$(( $dt / 10000 )) |
---|
1943 | m=$(( ( $dt % 10000 ) / 100 )) |
---|
1944 | d=$(( ( $dt % 100 ) )) |
---|
1945 | |
---|
1946 | # add the days in each month up to (but not including the month itself) |
---|
1947 | # into the days. For example if the date is 19980203 then extract the |
---|
1948 | # number of days in January and add it to 03. If the date is June 14, 1998 |
---|
1949 | # then extract the number of days in January, February, March, April and May |
---|
1950 | # and add them to 14. |
---|
1951 | x=1 |
---|
1952 | while [ $x -lt $m ] |
---|
1953 | do |
---|
1954 | IGCM_date_DaysInMonth $y $x md |
---|
1955 | d=$(( $d + $md )) |
---|
1956 | x=$(( $x + 1 )) |
---|
1957 | done |
---|
1958 | |
---|
1959 | # combine the year and day back together again and you have the julian date. |
---|
1960 | jul=$(( ( $y * 1000 ) + $d )) |
---|
1961 | echo $jul |
---|
1962 | |
---|
1963 | IGCM_debug_PopStack "IGCM_date_ConvertGregorianDateToJulian" |
---|
1964 | } |
---|
1965 | |
---|
1966 | #D-#================================================================== |
---|
1967 | #D-function IGCM_date_ConvertJulianDateToGregorian() |
---|
1968 | #D-* Purpose: Convert yyyyddd to yyyymmdd |
---|
1969 | #D-* Usage: IGCM_date_ConvertJulianDateToGregorian 1998213 |
---|
1970 | #D- if there is no command line argument, assume one is being |
---|
1971 | #D- piped in and read it |
---|
1972 | #D- |
---|
1973 | function IGCM_date_ConvertJulianDateToGregorian |
---|
1974 | { |
---|
1975 | IGCM_debug_PushStack "IGCM_date_ConvertJulianDateToGregorian" $@ |
---|
1976 | |
---|
1977 | # IGCM_date_ConvertJulianDateToGregorian converts yyyyddd to yyyymmdd |
---|
1978 | # usage IGCM_date_ConvertJulianDateToGregorian 1998213 |
---|
1979 | |
---|
1980 | typeset dt y m d grg |
---|
1981 | |
---|
1982 | # if there is no command line argument, assume one is being |
---|
1983 | # piped in and read it |
---|
1984 | if [ X$1 = X ] |
---|
1985 | then |
---|
1986 | read dt |
---|
1987 | else |
---|
1988 | dt=$1 |
---|
1989 | fi |
---|
1990 | |
---|
1991 | # break apart the year and the days |
---|
1992 | y=$(( $dt / 1000 )) |
---|
1993 | d=$(( $dt % 1000 )) |
---|
1994 | |
---|
1995 | # subtract the number of days in each month starting from 1 |
---|
1996 | # from the days in the date. When the day goes below 1, you |
---|
1997 | # have the current month. Add back the number of days in the |
---|
1998 | # month to get the correct day of the month |
---|
1999 | m=1 |
---|
2000 | while [ $d -gt 0 ] |
---|
2001 | do |
---|
2002 | IGCM_date_DaysInMonth $y $m md |
---|
2003 | d=$(( $d - $md )) |
---|
2004 | m=$(( $m + 1 )) |
---|
2005 | done |
---|
2006 | |
---|
2007 | d=$(( $d + $md )) |
---|
2008 | |
---|
2009 | # the loop steps one past the correct month, so back up the month |
---|
2010 | m=$(( $m - 1 )) |
---|
2011 | |
---|
2012 | # assemble the results into a gregorian date |
---|
2013 | grg=$(( ( $y * 10000 ) + ( $m * 100 ) + $d )) |
---|
2014 | echo $( IGCM_date_GregorianDigit $grg ) |
---|
2015 | |
---|
2016 | IGCM_debug_PopStack "IGCM_date_ConvertJulianDateToGregorian" |
---|
2017 | } |
---|
2018 | |
---|
2019 | #D-#================================================================== |
---|
2020 | #D-function IGCM_date_AddDaysToJulianDate |
---|
2021 | #D-* Purpose: Add days to a yyyyddd formatted date |
---|
2022 | #D-* Usage: IGCM_date_AddDaysToJulianDate 1998312 { ,-}14 |
---|
2023 | #D- Read the difference from the command lines |
---|
2024 | #D- and the date from the command line, or standard input |
---|
2025 | #D- |
---|
2026 | function IGCM_date_AddDaysToJulianDate |
---|
2027 | { |
---|
2028 | IGCM_debug_PushStack "IGCM_date_AddDaysToJulianDate" $@ |
---|
2029 | |
---|
2030 | # IGCM_date_AddDaysToJulianDate adds days to a yyyyddd formatted date |
---|
2031 | # usage IGCM_date_AddDaysToJulianDate 1998312 { ,-}14 |
---|
2032 | |
---|
2033 | typeset dif yd d y |
---|
2034 | |
---|
2035 | # Read the difference from the command lines |
---|
2036 | # and the date from the command line, or standard input |
---|
2037 | if [ X$2 = X ] |
---|
2038 | then |
---|
2039 | dif=$1 |
---|
2040 | read yd |
---|
2041 | else |
---|
2042 | yd=$1 |
---|
2043 | dif=$2 |
---|
2044 | fi |
---|
2045 | |
---|
2046 | # Break it into pieces |
---|
2047 | d=$(( $yd % 1000 )) |
---|
2048 | y=$(( $yd / 1000 )) |
---|
2049 | |
---|
2050 | # Add the number of days (if days is negative this results is |
---|
2051 | # a subtraction) |
---|
2052 | d=$(( $d + $dif )) |
---|
2053 | |
---|
2054 | # Extract the days in the year |
---|
2055 | IGCM_date_DaysInYear $y diy |
---|
2056 | |
---|
2057 | # If the calculated day exceeds the days in the year, |
---|
2058 | # add one year to the year and subtract the days in the year from the |
---|
2059 | # calculated days. Extract the days in the new year and repeat |
---|
2060 | # test until you end up with a day number that falls within the |
---|
2061 | # days of the year |
---|
2062 | while [ $d -gt $diy ] |
---|
2063 | do |
---|
2064 | d=$(( $d - $diy )) |
---|
2065 | y=$(( $y + 1 )) |
---|
2066 | IGCM_date_DaysInYear $y diy |
---|
2067 | done |
---|
2068 | |
---|
2069 | # This is the reverse process. If the calculated number of days |
---|
2070 | # is less than 1, move back one year. Extract |
---|
2071 | # the days in this year and add the days in the year |
---|
2072 | # loop on this test until you end up with a number that |
---|
2073 | # falls within the days of the year |
---|
2074 | while [ $d -lt 1 ] |
---|
2075 | do |
---|
2076 | y=$(( $y - 1 )) |
---|
2077 | IGCM_date_DaysInYear $y diy |
---|
2078 | d=$(( $d + $diy )) |
---|
2079 | done |
---|
2080 | |
---|
2081 | # put the year and day back together and echo the result |
---|
2082 | yd=$(( ( $y * 1000 ) + $d )) |
---|
2083 | |
---|
2084 | echo $yd |
---|
2085 | |
---|
2086 | IGCM_debug_PopStack "IGCM_date_AddDaysToJulianDate" |
---|
2087 | } |
---|
2088 | |
---|
2089 | #D-#================================================================== |
---|
2090 | #D-function IGCM_date_AddDaysToGregorianDate |
---|
2091 | #D-* Purpose: Add days to a yyyymmdd formatted date |
---|
2092 | #D-* Usage: IGCM_date_AddDaysToGregorianDate 19980312 { ,-}14 |
---|
2093 | #D- Read the difference from the command lines |
---|
2094 | #D- and the date from the command line, or standard input |
---|
2095 | #D- |
---|
2096 | function IGCM_date_AddDaysToGregorianDate |
---|
2097 | { |
---|
2098 | IGCM_debug_PushStack "IGCM_date_AddDaysToGregorianDate" $@ |
---|
2099 | |
---|
2100 | # IGCM_date_AddDaysToGregorianDate adds days to a yyyymmdd formatted date |
---|
2101 | # usage IGCM_date_AddDaysToGregorianDate 19980312 { ,-}14 |
---|
2102 | |
---|
2103 | # Read the difference from the command lines |
---|
2104 | # and the date from the command line, or standard input |
---|
2105 | typeset dif yd tmp res |
---|
2106 | if [ X$2 = X ] |
---|
2107 | then |
---|
2108 | dif=$1 |
---|
2109 | read yd |
---|
2110 | else |
---|
2111 | yd=$1 |
---|
2112 | dif=$2 |
---|
2113 | fi |
---|
2114 | |
---|
2115 | tmp=$( IGCM_date_ConvertGregorianDateToJulian $yd ) |
---|
2116 | tmp=$( IGCM_date_AddDaysToJulianDate $tmp $dif ) |
---|
2117 | res=$( IGCM_date_ConvertJulianDateToGregorian $tmp ) |
---|
2118 | |
---|
2119 | echo $res |
---|
2120 | |
---|
2121 | IGCM_debug_PopStack "IGCM_date_AddDaysToGregorianDate" |
---|
2122 | } |
---|
2123 | |
---|
2124 | #D-#================================================================== |
---|
2125 | #D-function IGCM_date_DaysBetweenJulianDate |
---|
2126 | #D-* Purpose: Calculate the days difference between two dates and reports |
---|
2127 | #D- the number days as jul1 - jul2 |
---|
2128 | #D-* Usage: IGCM_date_DaysBetweenJulianDate jul1 jul2 |
---|
2129 | #D- where julian date is in the form yyyyddd |
---|
2130 | #D- |
---|
2131 | function IGCM_date_DaysBetweenJulianDate |
---|
2132 | { |
---|
2133 | IGCM_debug_PushStack "IGCM_date_DaysBetweenJulianDate" $@ |
---|
2134 | |
---|
2135 | # calculates the days difference between two dates and reports |
---|
2136 | # the number days as jul1 - jul2 |
---|
2137 | # usage IGCM_date_DaysBetweenJulianDate jul1 jul2 |
---|
2138 | # where julian date is in the form yyyyddd |
---|
2139 | |
---|
2140 | usage () { |
---|
2141 | echo "Usage:" |
---|
2142 | echo " IGCM_date_DaysBetweenJulianDate jul1 jul2" |
---|
2143 | echo "" |
---|
2144 | echo " Calculates the day difference between" |
---|
2145 | echo " two julian dates (jul1 -jul2)" |
---|
2146 | echo " where a julian date is in the form of yyyyddd." |
---|
2147 | } |
---|
2148 | |
---|
2149 | if [ $# -lt 2 ]; then |
---|
2150 | usage |
---|
2151 | IGCM_debug_Exit "IGCM_date_DaysBetweenJulianDate" |
---|
2152 | fi |
---|
2153 | |
---|
2154 | typeset jul1 jul2 yyyy1 yyyy2 ddd1 ddd2 res |
---|
2155 | |
---|
2156 | # This process subtracts arg2 from arg1. If arg2 is larger |
---|
2157 | # then reverse the arguments. The calculations are done, and |
---|
2158 | # then the sign is reversed |
---|
2159 | if [ $1 -lt $2 ] |
---|
2160 | then |
---|
2161 | jul1=$2 |
---|
2162 | jul2=$1 |
---|
2163 | elif [ $1 -gt $2 ] |
---|
2164 | then |
---|
2165 | jul1=$1 |
---|
2166 | jul2=$2 |
---|
2167 | else |
---|
2168 | echo 0 |
---|
2169 | IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate" |
---|
2170 | return |
---|
2171 | fi |
---|
2172 | |
---|
2173 | # Break the dates in to year and day portions |
---|
2174 | yyyy1=$(( $jul1 / 1000 )) |
---|
2175 | yyyy2=$(( $jul2 / 1000 )) |
---|
2176 | ddd1=$(( $jul1 % 1000 )) |
---|
2177 | ddd2=$(( $jul2 % 1000 )) |
---|
2178 | |
---|
2179 | # Subtract days |
---|
2180 | res=$(( $ddd1 - $ddd2 )) |
---|
2181 | |
---|
2182 | # Then add days in year until year2 matches year1 |
---|
2183 | case ${config_UserChoices_CalendarType} in |
---|
2184 | 360d|360_day) |
---|
2185 | res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) ;; |
---|
2186 | noleap|365_day) |
---|
2187 | res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) ;; |
---|
2188 | all_leap|366_day) |
---|
2189 | res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) ;; |
---|
2190 | leap|gregorian|standard) |
---|
2191 | while [ $yyyy2 -lt $yyyy1 ] |
---|
2192 | do |
---|
2193 | IGCM_date_DaysInYear $yyyy2 diy |
---|
2194 | res=$(( $res + $diy )) |
---|
2195 | yyyy2=$(( $yyyy2 + 1 )) |
---|
2196 | done |
---|
2197 | ;; |
---|
2198 | esac |
---|
2199 | |
---|
2200 | # if argument 2 was larger than argument 1 then |
---|
2201 | # the arguments were reversed before calculating |
---|
2202 | # adjust by reversing the sign |
---|
2203 | if [ $1 -lt $2 ] |
---|
2204 | then |
---|
2205 | res=$(( $res * -1 )) |
---|
2206 | fi |
---|
2207 | |
---|
2208 | # and output the results |
---|
2209 | echo $res |
---|
2210 | |
---|
2211 | IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate" |
---|
2212 | } |
---|
2213 | |
---|
2214 | #D-#================================================================== |
---|
2215 | #D-function IGCM_date_DaysBetweenGregorianDate () |
---|
2216 | #D-* Purpose: Calculate the days difference between two dates and reports |
---|
2217 | #D- the number days as grg1 - grg2 |
---|
2218 | #D-* Usage: IGCM_date_DaysBetweenGregorianDate grg1 grg2 |
---|
2219 | #D- where gregorian date is in the form yyyymmdd |
---|
2220 | #D- |
---|
2221 | function IGCM_date_DaysBetweenGregorianDate |
---|
2222 | { |
---|
2223 | IGCM_debug_PushStack "IGCM_date_DaysBetweenGregorianDate" $@ |
---|
2224 | |
---|
2225 | # calculates the days difference between two dates and reports |
---|
2226 | # the number days as grg1 - grg2 |
---|
2227 | # usage IGCM_date_DaysBetweenGregorianDate grg1 grg2 |
---|
2228 | # where gregorian date is in the form yyyymmdd |
---|
2229 | |
---|
2230 | usage () { |
---|
2231 | echo "Usage:" |
---|
2232 | echo " IGCM_date_DaysBetweenGregorianDate grg1 grg2" |
---|
2233 | echo "" |
---|
2234 | echo " Calculate day difference between" |
---|
2235 | echo " two gregorian dates (grg1 - grg2)" |
---|
2236 | echo " where a gregorian date is in the form of yyyymmdd." |
---|
2237 | } |
---|
2238 | |
---|
2239 | if [ $# -lt 2 ]; then |
---|
2240 | usage |
---|
2241 | IGCM_debug_Exit "IGCM_date_DaysBetweenGregorianDate" |
---|
2242 | fi |
---|
2243 | |
---|
2244 | typeset grg1 grg2 jul1 jul2 res |
---|
2245 | |
---|
2246 | # convert each date to julian |
---|
2247 | grg1=$1 |
---|
2248 | grg2=$2 |
---|
2249 | |
---|
2250 | jul1=$( IGCM_date_ConvertGregorianDateToJulian $grg1 ) |
---|
2251 | jul2=$( IGCM_date_ConvertGregorianDateToJulian $grg2 ) |
---|
2252 | |
---|
2253 | if [ $jul1 -ne $jul2 ]; then |
---|
2254 | # calculate the answer using IGCM_date_DaysBetweenJulianDate |
---|
2255 | res=$( IGCM_date_DaysBetweenJulianDate $jul1 $jul2 ) |
---|
2256 | # and output the results |
---|
2257 | echo $res |
---|
2258 | else |
---|
2259 | echo 0 |
---|
2260 | fi |
---|
2261 | |
---|
2262 | IGCM_debug_PopStack "IGCM_date_DaysBetweenGregorianDate" |
---|
2263 | } |
---|
2264 | |
---|
2265 | #D-#================================================================== |
---|
2266 | #D-function IGCM_date_DaysSinceJC () |
---|
2267 | #D-* Purpose: Calculate the days difference between a date and 00010101 |
---|
2268 | #D-* Usage: IGCM_date_DaysSinceJC grg1 |
---|
2269 | #D- where gregorian date is in the form yyyymmdd |
---|
2270 | #D- |
---|
2271 | function IGCM_date_DaysSinceJC |
---|
2272 | { |
---|
2273 | IGCM_debug_PushStack "IGCM_date_DaysSinceJC" $@ |
---|
2274 | |
---|
2275 | # calculates the days difference between a date and 00010101 |
---|
2276 | # usage IGCM_date_DaysSinceJC grg1 |
---|
2277 | # where gregorian date is in the form yyyymmdd |
---|
2278 | |
---|
2279 | usage () { |
---|
2280 | echo "Usage:" |
---|
2281 | echo " IGCM_date_DaysSinceJC grg1" |
---|
2282 | echo "" |
---|
2283 | echo " Calculate day difference between" |
---|
2284 | echo " a gregorian date and 00010101" |
---|
2285 | echo " where a gregorian date is in the form of yyyymmdd." |
---|
2286 | } |
---|
2287 | |
---|
2288 | if [ $# -lt 1 ]; then |
---|
2289 | usage |
---|
2290 | IGCM_debug_Exit "IGCM_date_DaysSinceJC" |
---|
2291 | fi |
---|
2292 | |
---|
2293 | typeset aux num |
---|
2294 | |
---|
2295 | if [ ${1} -lt 5000000 ]; then |
---|
2296 | case ${config_UserChoices_CalendarType} in |
---|
2297 | 360d|360_day) |
---|
2298 | aux=-360;; |
---|
2299 | noleap|365_day) |
---|
2300 | aux=-365;; |
---|
2301 | all_leap|366_day) |
---|
2302 | aux=-366;; |
---|
2303 | leap|gregorian|standard) |
---|
2304 | aux=-366;; |
---|
2305 | esac |
---|
2306 | num=101 |
---|
2307 | elif [ ${1} -lt 15000000 ]; then |
---|
2308 | # To save CPU type we use auxiliary value |
---|
2309 | # which is number of days since JC and 10000101 |
---|
2310 | case ${config_UserChoices_CalendarType} in |
---|
2311 | 360d|360_day) |
---|
2312 | aux=359640;; |
---|
2313 | noleap|365_day) |
---|
2314 | aux=364635;; |
---|
2315 | all_leap|366_day) |
---|
2316 | aux=365634;; |
---|
2317 | leap|gregorian|standard) |
---|
2318 | aux=364877;; |
---|
2319 | esac |
---|
2320 | num=10000101 |
---|
2321 | else |
---|
2322 | # To save CPU type we use auxiliary value |
---|
2323 | # which is number of days since JC and 19000101 |
---|
2324 | case ${config_UserChoices_CalendarType} in |
---|
2325 | 360d|360_day) |
---|
2326 | aux=683640;; |
---|
2327 | noleap|365_day) |
---|
2328 | aux=693135;; |
---|
2329 | all_leap|366_day) |
---|
2330 | aux=695034;; |
---|
2331 | leap|gregorian|standard) |
---|
2332 | aux=693595;; |
---|
2333 | esac |
---|
2334 | num=19000101 |
---|
2335 | fi |
---|
2336 | echo $(( $( IGCM_date_DaysBetweenGregorianDate $1 ${num} ) + $aux )) |
---|
2337 | |
---|
2338 | IGCM_debug_PopStack "IGCM_date_DaysSinceJC" |
---|
2339 | } |
---|
2340 | |
---|
2341 | #D-#================================================================== |
---|
2342 | #D-function IGCM_date_DaysInPreviousPeriod () |
---|
2343 | #D-* Purpose: Give the numbers of days during the previous prd1 period from grg1 date # OLD create_ts_begin_date |
---|
2344 | #D-* Usage: IGCM_date_DaysInPreviousPeriod grg1 prd1 [end] |
---|
2345 | #D- where grg1 gregorian date is in the form yyyymmdd |
---|
2346 | #D- where prd1 period is in the form N[Yy], N[Mm], N[Dd]. N integer |
---|
2347 | #D- where [end] is an optionnal keyword to specify grg1 is the end of prd1 |
---|
2348 | #D- |
---|
2349 | function IGCM_date_DaysInPreviousPeriod { |
---|
2350 | IGCM_debug_PushStack "IGCM_date_DaysInPreviousPeriod" $@ |
---|
2351 | |
---|
2352 | typeset Length Period treatedYear PeriodLengthInYears PeriodLengthInMonths year0 i |
---|
2353 | |
---|
2354 | Period=${2} |
---|
2355 | case ${Period} in |
---|
2356 | *Y|*y) |
---|
2357 | PeriodLengthInYears=$( echo ${Period} | awk -F '[yY]' '{print $1}' ) |
---|
2358 | IGCM_date_GetYearMonth ${1} year month |
---|
2359 | year=$( IGCM_date_SupressZeros ${year} ) |
---|
2360 | if [ X${3} = Xend ] ; then |
---|
2361 | (( year = year - PeriodLengthInYears + 1)) |
---|
2362 | fi |
---|
2363 | Length=0 |
---|
2364 | i=0 |
---|
2365 | until [ $i -ge $PeriodLengthInYears ] ; do |
---|
2366 | (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) |
---|
2367 | (( i = i + 1 )) |
---|
2368 | done |
---|
2369 | ;; |
---|
2370 | *M|*m) |
---|
2371 | PeriodLengthInMonths=$( echo ${Period} | awk -F '[mM]' '{print $1}' ) |
---|
2372 | IGCM_date_GetYearMonth ${1} year month |
---|
2373 | year=$( IGCM_date_SupressZeros ${year} ) |
---|
2374 | if [ X${3} = Xend ] ; then |
---|
2375 | (( month = month - PeriodLengthInMonths + 1 )) |
---|
2376 | fi |
---|
2377 | year0=year |
---|
2378 | if [ $month -le 0 ] ; then |
---|
2379 | (( month = month + 12 )) |
---|
2380 | year=$( printf "%04i\n" $(( year - 1 )) ) |
---|
2381 | fi |
---|
2382 | month=$( printf "%02i\n" ${month} ) |
---|
2383 | treatedYear=0 |
---|
2384 | Length=0 |
---|
2385 | i=0 |
---|
2386 | for ((i = 0; i < ${PeriodLengthInMonths}; i += 1)) ; do |
---|
2387 | |
---|
2388 | (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 * treatedYear )) ) )) |
---|
2389 | |
---|
2390 | if [ $(( month + i )) -ge $(( 12 * (treatedYear + 1) )) ] ; then |
---|
2391 | (( year = year0 + 1 )) |
---|
2392 | (( treatedYear = treatedYear + 1 )) |
---|
2393 | fi |
---|
2394 | done |
---|
2395 | ;; |
---|
2396 | *D|*d) |
---|
2397 | Length=$( echo ${Period} | sed -e "s/[dD]//" ) ;; |
---|
2398 | *) |
---|
2399 | IGCM_debug_Exit "IGCM_date_DaysInPreviousPeriod " ${Period} " invalid PeriodLength : choose in *Y, *M, *D." |
---|
2400 | IGCM_debug_Verif_Exit ;; |
---|
2401 | esac |
---|
2402 | echo ${Length} |
---|
2403 | |
---|
2404 | IGCM_debug_PopStack "IGCM_date_DaysInPreviousPeriod" |
---|
2405 | } |
---|
2406 | |
---|
2407 | #D-#================================================================== |
---|
2408 | #D-function IGCM_date_DaysInNextPeriod () |
---|
2409 | #D-* Purpose: Give the numbers of days during the next prd1 period from grg1 date # OLD create_ts_next_date |
---|
2410 | #D-* Usage: IGCM_date_DaysInNextPeriod grg1 prd1 |
---|
2411 | #D- where grg1 gregorian date is in the form yyyymmdd |
---|
2412 | #D- where prd1 period is in the form N[Yy], N[Mm], N[Dd]. N integer |
---|
2413 | #D- |
---|
2414 | function IGCM_date_DaysInNextPeriod { |
---|
2415 | IGCM_debug_PushStack "IGCM_date_DaysInNextPeriod" $@ |
---|
2416 | |
---|
2417 | typeset Length Period treatedYear PeriodLengthInYears PeriodLengthInMonths year0 month0 i |
---|
2418 | |
---|
2419 | Period=${2} |
---|
2420 | case ${Period} in |
---|
2421 | *Y|*y) |
---|
2422 | PeriodLengthInYears=$( echo ${Period} | awk -F '[yY]' '{print $1}' ) |
---|
2423 | IGCM_date_GetYearMonth ${1} year month |
---|
2424 | year=$( IGCM_date_SupressZeros ${year} ) |
---|
2425 | Length=0 |
---|
2426 | i=0 |
---|
2427 | until [ $i -ge $PeriodLengthInYears ] ; do |
---|
2428 | (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) )) |
---|
2429 | (( i = i + 1 )) |
---|
2430 | done |
---|
2431 | ;; |
---|
2432 | *M|*m) |
---|
2433 | PeriodLengthInMonths=$( echo ${Period} | awk -F '[mM]' '{print $1}' ) |
---|
2434 | IGCM_date_GetYearMonth ${1} year month |
---|
2435 | year=$( IGCM_date_SupressZeros ${year} ) |
---|
2436 | year0=year |
---|
2437 | if [ $(( month + 1 )) -lt 13 ] ; then |
---|
2438 | month0=$(( month + 1 )) |
---|
2439 | else |
---|
2440 | month0=$(( month + 1 - 12 )) |
---|
2441 | (( year = year0 + 1 )) |
---|
2442 | fi |
---|
2443 | treatedYear=0 |
---|
2444 | Length=0 |
---|
2445 | i=0 |
---|
2446 | for ((i = 0; i < ${PeriodLengthInMonths}; i += 1)) ; do |
---|
2447 | |
---|
2448 | (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 * treatedYear )) ) )) |
---|
2449 | |
---|
2450 | if [ $(( month0 + i )) -ge $(( 12 * (treatedYear + 1) )) ] ; then |
---|
2451 | (( year = year0 + 1 )) |
---|
2452 | (( treatedYear = treatedYear + 1 )) |
---|
2453 | fi |
---|
2454 | done |
---|
2455 | ;; |
---|
2456 | *D|*d) |
---|
2457 | Length=$( echo ${Period} | sed -e "s/[dD]//" ) ;; |
---|
2458 | *) |
---|
2459 | IGCM_debug_Exit "IGCM_date_DaysInNextPeriod " ${Period} " invalid PeriodLength : choose in *Y, *M, *D." |
---|
2460 | IGCM_debug_Verif_Exit ;; |
---|
2461 | esac |
---|
2462 | echo ${Length} |
---|
2463 | |
---|
2464 | IGCM_debug_PopStack "IGCM_date_DaysInNextPeriod" |
---|
2465 | } |
---|
2466 | |
---|
2467 | #D-#================================================================== |
---|
2468 | #D-function IGCM_date_DaysInCurrentPeriod () |
---|
2469 | #D-* Purpose: Give the numbers of days during the Current prd1 period from grg1 date |
---|
2470 | #D-* Usage: IGCM_date_DaysInCurrentPeriod grg1 prd1 |
---|
2471 | #D- where grg1 gregorian date is in the form yyyymmdd |
---|
2472 | #D- where prd1 period is in the form N[Yy], N[Mm], N[Dd]. N integer |
---|
2473 | #D- |
---|
2474 | function IGCM_date_DaysInCurrentPeriod { |
---|
2475 | IGCM_debug_PushStack "IGCM_date_DaysInCurrentPeriod" $@ |
---|
2476 | |
---|
2477 | typeset Length Period treatedYear PeriodLengthInYears PeriodLengthInMonths year0 i |
---|
2478 | |
---|
2479 | Period=${2} |
---|
2480 | case ${Period} in |
---|
2481 | *Y|*y) |
---|
2482 | PeriodLengthInYears=$( echo ${Period} | awk -F '[yY]' '{print $1}' ) |
---|
2483 | IGCM_date_GetYearMonth ${1} year month |
---|
2484 | year=$( IGCM_date_SupressZeros ${year} ) |
---|
2485 | month=$( IGCM_date_SupressZeros ${month} ) |
---|
2486 | Length=0 |
---|
2487 | # if starting after february and using leap calendar |
---|
2488 | # we need to add the number of days of the next year (potentially a leap year) |
---|
2489 | if [ ${month} -gt 2 ] ; then |
---|
2490 | (( year = year + 1 )) |
---|
2491 | fi |
---|
2492 | i=0 |
---|
2493 | until [ $i -ge $PeriodLengthInYears ] ; do |
---|
2494 | (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) |
---|
2495 | (( i = i + 1 )) |
---|
2496 | done |
---|
2497 | ;; |
---|
2498 | *M|*m) |
---|
2499 | PeriodLengthInMonths=$( echo ${Period} | awk -F '[mM]' '{print $1}' ) |
---|
2500 | IGCM_date_GetYearMonth ${1} year month |
---|
2501 | year=$( IGCM_date_SupressZeros ${year} ) |
---|
2502 | year0=year |
---|
2503 | treatedYear=0 |
---|
2504 | Length=0 |
---|
2505 | i=0 |
---|
2506 | for ((i = 0; i < ${PeriodLengthInMonths}; i += 1)) ; do |
---|
2507 | |
---|
2508 | (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 * treatedYear )) ) )) |
---|
2509 | |
---|
2510 | if [ $(( month + i )) -ge $(( 12 * (treatedYear + 1) )) ] ; then |
---|
2511 | (( year = year0 + 1 )) |
---|
2512 | (( treatedYear = treatedYear + 1 )) |
---|
2513 | fi |
---|
2514 | done |
---|
2515 | ;; |
---|
2516 | *D|*d) |
---|
2517 | Length=$( echo ${Period} | sed -e "s/[dD]//" ) ;; |
---|
2518 | *) |
---|
2519 | IGCM_debug_Exit "IGCM_date_DaysInCurrentPeriod " ${Period} " invalid PeriodLength : choose in *Y, *M, *D." |
---|
2520 | IGCM_debug_Verif_Exit ;; |
---|
2521 | esac |
---|
2522 | echo ${Length} |
---|
2523 | |
---|
2524 | IGCM_debug_PopStack "IGCM_date_DaysInCurrentPeriod" |
---|
2525 | } |
---|
2526 | |
---|
2527 | #D-#================================================================== |
---|
2528 | #D-function IGCM_date_Check |
---|
2529 | #D- * Purpose: Check the present file by comparison with a reference file |
---|
2530 | function IGCM_date_Check |
---|
2531 | { |
---|
2532 | #--------------------- |
---|
2533 | if [ ! -n "${libIGCM}" ] ; then |
---|
2534 | echo "Check libIGCM_date ...........................................[ FAILED ]" |
---|
2535 | echo "--Error--> libIGCM variable is not defined" |
---|
2536 | IGCM_debug_Exit "IGCM_date_Check" |
---|
2537 | fi |
---|
2538 | |
---|
2539 | #--------------------- |
---|
2540 | whence -v gawk > /dev/null 2>&1 |
---|
2541 | if [ ! $? -eq 0 ] ; then |
---|
2542 | echo "Check libIGCM_date ...........................................[ FAILED ]" |
---|
2543 | echo "--Error--> gawk command is not defined" |
---|
2544 | IGCM_debug_Exit "IGCM_date_Check" |
---|
2545 | fi |
---|
2546 | |
---|
2547 | #--------------------- |
---|
2548 | # No need to remove timestamps here |
---|
2549 | diff ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref <(${libIGCM}/libIGCM_date/IGCM_date_Test.ksh) > /dev/null 2>&1 |
---|
2550 | status=$? |
---|
2551 | |
---|
2552 | if [ ${status} -eq 0 ] ; then |
---|
2553 | echo "Check libIGCM_date ...............................................[ OK ]" |
---|
2554 | else |
---|
2555 | echo "Check libIGCM_date ...........................................[ FAILED ]" |
---|
2556 | echo "--Error--> Execution of ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh" |
---|
2557 | echo " has produced the file IGCM_date_Test.ref.failed" |
---|
2558 | echo " Please analyse differences with the reference file by typing:" |
---|
2559 | echo " diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref" |
---|
2560 | echo " Report errors to the author: Sebastien.Denvil@ipsl.jussieu.fr" |
---|
2561 | diff ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref <(${libIGCM}/libIGCM_date/IGCM_date_Test.ksh) |
---|
2562 | IGCM_debug_Exit "IGCM_date_Check" |
---|
2563 | fi |
---|
2564 | } |
---|
2565 | + dY=4 |
---|
2566 | + typeset -r dY |
---|
2567 | + pY=8 |
---|
2568 | + typeset -r pY |
---|
2569 | #------- |
---|
2570 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh |
---|
2571 | + . /ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM/libIGCM_sys/libIGCM_sys.ksh |
---|
2572 | #!/bin/ksh |
---|
2573 | |
---|
2574 | #************************************************************** |
---|
2575 | # Author: Martial Mancip |
---|
2576 | # Contact: Martial.Mancip__at__ipsl.jussieu.fr |
---|
2577 | # $Revision:: 1432 $ Revision of last commit |
---|
2578 | # $Author:: jgipsl $ Author of last commit |
---|
2579 | # $Date:: 2018-03-30 15:07:44 +0200 (Fri, 30 Mar 2018) $ Date of last commit |
---|
2580 | # IPSL (2006) |
---|
2581 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
2582 | # |
---|
2583 | #************************************************************** |
---|
2584 | |
---|
2585 | # bypass specific internationalization (for gawk) |
---|
2586 | export LC_ALL="C" |
---|
2587 | |
---|
2588 | # By default, all libIGCM_sys save functions will protect output datas (RUN execution mode) |
---|
2589 | # other values : DEB(ug), DEV(elopment). |
---|
2590 | JobType=${JobType:=RUN} |
---|
2591 | |
---|
2592 | #==================================================== |
---|
2593 | # set PackDefault false by default |
---|
2594 | PackDefault=false |
---|
2595 | |
---|
2596 | #==================================================== |
---|
2597 | # set BigBrother false by default |
---|
2598 | BigBrother=${BigBrother:=false} |
---|
2599 | |
---|
2600 | #==================================================== |
---|
2601 | # set BigBrother channel (AMQP or MAIL) |
---|
2602 | # only MAIL working at present due to firewall constraint |
---|
2603 | BigBrotherChannel=MAIL |
---|
2604 | |
---|
2605 | # no need to be so verbose in checking mode |
---|
2606 | if [ ! X${TaskType} = Xchecking ] ; then |
---|
2607 | echo |
---|
2608 | echo "====================================================" |
---|
2609 | echo "Where do we run ?" $( hostname ) |
---|
2610 | uname -a |
---|
2611 | echo "====================================================" |
---|
2612 | echo |
---|
2613 | fi |
---|
2614 | |
---|
2615 | if [ X${JobType} = XDEB ] ; then |
---|
2616 | echo "DEBUG mode : activation of 'set -vx' mode." |
---|
2617 | set -vx |
---|
2618 | DEBUG_debug=true |
---|
2619 | DEBUG_sys=true |
---|
2620 | fi |
---|
2621 | |
---|
2622 | #==================================================== |
---|
2623 | case $( hostname -s ) in |
---|
2624 | ada*) |
---|
2625 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for ada Intel X-64." |
---|
2626 | CENTER=IDRIS |
---|
2627 | SYSTEM=ada |
---|
2628 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_ada.ksh;; |
---|
2629 | curie*) |
---|
2630 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for curie Intel X-64." |
---|
2631 | CENTER=TGCC |
---|
2632 | SYSTEM=curie |
---|
2633 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_curie.ksh;; |
---|
2634 | irene*) |
---|
2635 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for irene Intel X-64 at TGCC" |
---|
2636 | CENTER=TGCC |
---|
2637 | SYSTEM=irene |
---|
2638 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_irene.ksh;; |
---|
2639 | airain*) |
---|
2640 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for airain Intel X-64." |
---|
2641 | CENTER=TGCC |
---|
2642 | SYSTEM=curie |
---|
2643 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_curie.ksh;; |
---|
2644 | asterix*|obelix*) |
---|
2645 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for obelix or asterix." |
---|
2646 | CENTER=LSCE |
---|
2647 | SYSTEM=lxiv8 |
---|
2648 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_obelix.ksh;; |
---|
2649 | ciclad*) |
---|
2650 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for ciclad for running at ciclad." |
---|
2651 | CENTER=IPSL-ciclad |
---|
2652 | SYSTEM=ifort_CICLAD |
---|
2653 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_ciclad.ksh;; |
---|
2654 | camelot*|loholt1*|loholt2*|merlin*) |
---|
2655 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for ciclad for running at climserv." |
---|
2656 | CENTER=IPSL-climserv |
---|
2657 | SYSTEM=ifort_CICLAD |
---|
2658 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_ciclad.ksh;; |
---|
2659 | iitm*) |
---|
2660 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for iitm." |
---|
2661 | CENTER=IITM |
---|
2662 | SYSTEM=iitm |
---|
2663 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_iitm.ksh;; |
---|
2664 | *) |
---|
2665 | [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for a default machine." |
---|
2666 | CENTER=DEFAULT |
---|
2667 | SYSTEM=default |
---|
2668 | . ${libIGCM}/libIGCM_sys/libIGCM_sys_default.ksh;; |
---|
2669 | esac |
---|
2670 | |
---|
2671 | # Set default umask (umask is 0027 on some machines : CCRT machine at least) |
---|
2672 | umask 0022 |
---|
2673 | |
---|
2674 | #D--------------------------------------------------------------------== |
---|
2675 | #D- |
---|
2676 | #D- Define IGCM_sys functions that are common on every systems |
---|
2677 | #D- |
---|
2678 | #D--------------------------------------------------------------------== |
---|
2679 | |
---|
2680 | #D-#================================================== |
---|
2681 | #D-function IGCM_sys_RshMaster |
---|
2682 | #D-* Purpose: Connection to frontend machine. |
---|
2683 | #D-* Examples: |
---|
2684 | #D- |
---|
2685 | function IGCM_sys_RshMaster { |
---|
2686 | IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ |
---|
2687 | OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <<-EOF |
---|
2688 | export libIGCM=${libIGCM} |
---|
2689 | export DEBUG_debug=${DEBUG_debug} |
---|
2690 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
2691 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
2692 | ${@} |
---|
2693 | EOF |
---|
2694 | if [ $? -gt 0 ] ; then |
---|
2695 | echo "IGCM_sys_RshMaster : erreur." |
---|
2696 | IGCM_debug_Exit "IGCM_sys_RshMaster" |
---|
2697 | fi |
---|
2698 | IGCM_debug_PopStack "IGCM_sys_RshMaster" |
---|
2699 | } |
---|
2700 | |
---|
2701 | #D-#================================================== |
---|
2702 | #D-function IGCM_sys_RshPost |
---|
2703 | #D-* Purpose: Post-process rsh command |
---|
2704 | #D-* Examples: |
---|
2705 | #D- |
---|
2706 | function IGCM_sys_RshPost { |
---|
2707 | IGCM_debug_PushStack "IGCM_sys_RshPost" $@ |
---|
2708 | if ( $DEBUG_sys ) ; then |
---|
2709 | echo "IGCM_sys_RshPost :" $@ |
---|
2710 | fi |
---|
2711 | # keep standard input (stdin) for the loop onto temporary file |
---|
2712 | cat >${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
2713 | |
---|
2714 | OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
2715 | if [ $? -gt 0 ] ; then |
---|
2716 | echo "IGCM_sys_RshPost : erreur." |
---|
2717 | IGCM_debug_Exit "IGCM_sys_RshPost" |
---|
2718 | fi |
---|
2719 | # delete temporary file |
---|
2720 | \rm ${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
2721 | |
---|
2722 | # ============ FRONTEND END ============ # |
---|
2723 | |
---|
2724 | # ============ CESIUM START ============ # |
---|
2725 | # typeset NB_ESSAI DELAI status i |
---|
2726 | # if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then |
---|
2727 | # #little hack so that rebuild submission is done on titane not an cesium |
---|
2728 | # |
---|
2729 | # libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) |
---|
2730 | # POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) |
---|
2731 | # sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt |
---|
2732 | # sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$ |
---|
2733 | # sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt |
---|
2734 | # sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ |
---|
2735 | # \mv tmp.txt tmp_IGCM_sys_RshPost_$$ |
---|
2736 | # |
---|
2737 | # echo cat tmp_IGCM_sys_RshPost_$$ AFTER |
---|
2738 | # cat tmp_IGCM_sys_RshPost_$$ |
---|
2739 | # |
---|
2740 | # /bin/ksh <tmp_IGCM_sys_RshPost_$$ |
---|
2741 | # if [ $? -gt 0 ] ; then |
---|
2742 | # echo "IGCM_sys_RshPost : erreur." |
---|
2743 | # IGCM_debug_Exit "IGCM_sys_RshPost" |
---|
2744 | # fi |
---|
2745 | # # delete temporary file |
---|
2746 | # \rm tmp_IGCM_sys_RshPost_$$ |
---|
2747 | # |
---|
2748 | # else |
---|
2749 | # # number of tentative |
---|
2750 | # NB_ESSAI=10 |
---|
2751 | # # time delay between tentative |
---|
2752 | # DELAI=10 |
---|
2753 | # i=0 |
---|
2754 | # while [ $i -ne $NB_ESSAI ] ; do |
---|
2755 | # ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ |
---|
2756 | # status=$? |
---|
2757 | # if [ ${status} -ne 0 ]; |
---|
2758 | # then |
---|
2759 | # sleep $DELAI |
---|
2760 | # else |
---|
2761 | # break |
---|
2762 | # fi |
---|
2763 | # let i=$i+1 |
---|
2764 | # done |
---|
2765 | # # delete temporary file |
---|
2766 | # \rm tmp_IGCM_sys_RshPost_$$ |
---|
2767 | # |
---|
2768 | # if [ ${status} -gt 0 ] ; then |
---|
2769 | # echo "IGCM_sys_RshPost : erreur." |
---|
2770 | # IGCM_debug_Exit "IGCM_sys_RshPost" |
---|
2771 | # fi |
---|
2772 | # fi |
---|
2773 | |
---|
2774 | # ============ CESIUM END ============ # |
---|
2775 | |
---|
2776 | IGCM_debug_PopStack "IGCM_sys_RshPost" |
---|
2777 | } |
---|
2778 | |
---|
2779 | #D-#================================================== |
---|
2780 | #D-function IGCM_sys_SendMail |
---|
2781 | #D-* Purpose: Send mail when simulation is over |
---|
2782 | #D-* Examples: |
---|
2783 | #D- |
---|
2784 | function IGCM_sys_SendMail { |
---|
2785 | IGCM_debug_PushStack "IGCM_sys_SendMail" $@ |
---|
2786 | if ( $DEBUG_sys ) ; then |
---|
2787 | echo "IGCM_sys_SendMail :" $@ |
---|
2788 | fi |
---|
2789 | |
---|
2790 | if [ X${1} = XAccounting ] ; then |
---|
2791 | status=Accounting |
---|
2792 | mailText=jobAccounting.mail |
---|
2793 | elif ( ${ExitFlag} ) ; then |
---|
2794 | status=failed |
---|
2795 | mailText=jobEnd.mail |
---|
2796 | else |
---|
2797 | status=completed |
---|
2798 | mailText=jobEnd.mail |
---|
2799 | fi |
---|
2800 | |
---|
2801 | # Update selected mail template |
---|
2802 | while read -r line; do |
---|
2803 | eval echo $line >> mail.txt ; |
---|
2804 | done < ${libIGCM}/libIGCM_sys/${mailText} |
---|
2805 | |
---|
2806 | if [ ! -z ${config_UserChoices_MailName} ] ; then |
---|
2807 | mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt |
---|
2808 | elif [ -f ~/.forward ] ; then |
---|
2809 | mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt |
---|
2810 | else |
---|
2811 | mail -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt |
---|
2812 | fi |
---|
2813 | |
---|
2814 | sleep 10 |
---|
2815 | rm -f mail.txt |
---|
2816 | |
---|
2817 | IGCM_debug_PopStack "IGCM_sys_SendMail" |
---|
2818 | } |
---|
2819 | |
---|
2820 | #D-#================================================== |
---|
2821 | #D-function IGCM_sys_Mkdir |
---|
2822 | #D-* Purpose: Master locale mkdir command |
---|
2823 | #D-* Examples: |
---|
2824 | #D- |
---|
2825 | function IGCM_sys_Mkdir { |
---|
2826 | IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ |
---|
2827 | if ( $DEBUG_sys ) ; then |
---|
2828 | echo "IGCM_sys_Mkdir :" $@ |
---|
2829 | fi |
---|
2830 | if [ ! -d ${1} ]; then |
---|
2831 | \mkdir -p $1 |
---|
2832 | if [ $? -gt 0 ] ; then |
---|
2833 | echo "IGCM_sys_Mkdir : erreur." |
---|
2834 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
2835 | fi |
---|
2836 | fi |
---|
2837 | # vérification : |
---|
2838 | if [ ! -d ${1} ] ; then |
---|
2839 | echo "IGCM_sys_Mkdir : erreur." |
---|
2840 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
2841 | fi |
---|
2842 | IGCM_debug_PopStack "IGCM_sys_Mkdir" |
---|
2843 | } |
---|
2844 | |
---|
2845 | #D-#================================================== |
---|
2846 | #D-function IGCM_sys_MkdirWork |
---|
2847 | #D-* Purpose: Mkdir on Work |
---|
2848 | #D-* Examples: |
---|
2849 | #D- |
---|
2850 | function IGCM_sys_MkdirWork { |
---|
2851 | IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ |
---|
2852 | if ( $DEBUG_sys ) ; then |
---|
2853 | echo "IGCM_sys_MkdirWork :" $@ |
---|
2854 | fi |
---|
2855 | #- creation de repertoire sur le serveur fichier |
---|
2856 | if [ ! -d ${1} ]; then |
---|
2857 | \mkdir -p $1 |
---|
2858 | if [ $? -gt 0 ] ; then |
---|
2859 | echo "IGCM_sys_MkdirWork : erreur." |
---|
2860 | IGCM_debug_Exit "IGCM_sys_MkdirWork" |
---|
2861 | fi |
---|
2862 | fi |
---|
2863 | IGCM_debug_PopStack "IGCM_sys_MkdirWork" |
---|
2864 | } |
---|
2865 | |
---|
2866 | #D-#================================================== |
---|
2867 | #D-function IGCM_sys_Cd |
---|
2868 | #D-* Purpose: master cd command |
---|
2869 | #D-* Examples: |
---|
2870 | #D- |
---|
2871 | function IGCM_sys_Cd { |
---|
2872 | IGCM_debug_PushStack "IGCM_sys_Cd" $@ |
---|
2873 | if ( $DEBUG_sys ) ; then |
---|
2874 | echo "IGCM_sys_Cd :" $@ |
---|
2875 | fi |
---|
2876 | \cd $1 |
---|
2877 | if [ $? -gt 0 ] ; then |
---|
2878 | echo "IGCM_sys_Cd : erreur." |
---|
2879 | IGCM_debug_Exit "IGCM_sys_Cd" |
---|
2880 | fi |
---|
2881 | IGCM_debug_PopStack "IGCM_sys_Cd" |
---|
2882 | } |
---|
2883 | |
---|
2884 | #D-#================================================== |
---|
2885 | #D-function IGCM_sys_Chmod |
---|
2886 | #D-* Purpose: Chmod |
---|
2887 | #D-* Examples: |
---|
2888 | #D- |
---|
2889 | function IGCM_sys_Chmod { |
---|
2890 | IGCM_debug_PushStack "IGCM_sys_Chmod" $@ |
---|
2891 | if ( $DEBUG_sys ) ; then |
---|
2892 | echo "IGCM_sys_Chmod :" $@ |
---|
2893 | fi |
---|
2894 | \chmod $@ |
---|
2895 | if [ $? -gt 0 ] ; then |
---|
2896 | echo "IGCM_sys_Chmod : erreur." |
---|
2897 | IGCM_debug_Exit "IGCM_sys_Chmod" |
---|
2898 | fi |
---|
2899 | IGCM_debug_PopStack "IGCM_sys_Chmod" |
---|
2900 | } |
---|
2901 | |
---|
2902 | #D-#================================================== |
---|
2903 | #D-function IGCM_sys_FileSize |
---|
2904 | #D-* Purpose: Filesize |
---|
2905 | #D-* Examples: |
---|
2906 | #D- |
---|
2907 | function IGCM_sys_FileSize { |
---|
2908 | IGCM_debug_PushStack "IGCM_sys_FileSize" $@ |
---|
2909 | |
---|
2910 | typeset sizeF |
---|
2911 | set +A sizeF -- $( ls -la ${1} ) |
---|
2912 | if [ $? -gt 0 ] ; then |
---|
2913 | IGCM_debug_Exit "IGCM_sys_FileSize" |
---|
2914 | fi |
---|
2915 | eval ${2}=${sizeF[4]} |
---|
2916 | |
---|
2917 | IGCM_debug_PopStack "IGCM_sys_FileSize" |
---|
2918 | } |
---|
2919 | |
---|
2920 | #D-#================================================== |
---|
2921 | #D-function IGCM_sys_TestDir |
---|
2922 | #D-* Purpose: Test Directory that must exists |
---|
2923 | #D-* Examples: |
---|
2924 | #D- |
---|
2925 | function IGCM_sys_TestDir { |
---|
2926 | IGCM_debug_PushStack "IGCM_sys_TestDir" $@ |
---|
2927 | if ( $DEBUG_sys ) ; then |
---|
2928 | echo "IGCM_sys_TestDir :" $@ |
---|
2929 | fi |
---|
2930 | typeset ExistFlag |
---|
2931 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
2932 | IGCM_debug_PopStack "IGCM_sys_TestDir" |
---|
2933 | |
---|
2934 | return ${ExistFlag} |
---|
2935 | } |
---|
2936 | |
---|
2937 | #D-#================================================== |
---|
2938 | #D-function IGCM_sys_TestFileBuffer |
---|
2939 | #D-* Purpose: Test file that must NOT EXISTS on Buffer |
---|
2940 | #D-* Examples: |
---|
2941 | #D- |
---|
2942 | function IGCM_sys_TestFileBuffer { |
---|
2943 | IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ |
---|
2944 | typeset ExistFlag |
---|
2945 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
2946 | IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" |
---|
2947 | |
---|
2948 | return ${ExistFlag} |
---|
2949 | } |
---|
2950 | |
---|
2951 | #D-#================================================== |
---|
2952 | #D-function IGCM_sys_CountFileBuffer |
---|
2953 | #D-* Purpose: Count files on Scratch filesystem |
---|
2954 | #D-* Examples: |
---|
2955 | #D- |
---|
2956 | function IGCM_sys_CountFileBuffer { |
---|
2957 | IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ |
---|
2958 | ls ${@} 2>/dev/null | wc -l |
---|
2959 | if [ $? -gt 0 ] ; then |
---|
2960 | echo "IGCM_sys_CountFileBuffer : erreur." |
---|
2961 | fi |
---|
2962 | IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" |
---|
2963 | } |
---|
2964 | |
---|
2965 | #D-#================================================== |
---|
2966 | #D-function IGCM_sys_Tar |
---|
2967 | #D-* Purpose: master tar command |
---|
2968 | #D-* Examples: |
---|
2969 | #D- |
---|
2970 | function IGCM_sys_Tar { |
---|
2971 | IGCM_debug_PushStack "IGCM_sys_Tar" $@ |
---|
2972 | if ( $DEBUG_sys ) ; then |
---|
2973 | echo "IGCM_sys_Tar :" $@ |
---|
2974 | fi |
---|
2975 | \tar cf $@ |
---|
2976 | if [ $? -gt 0 ] ; then |
---|
2977 | echo "IGCM_sys_Tar : erreur." |
---|
2978 | IGCM_debug_Exit "IGCM_sys_Tar" |
---|
2979 | fi |
---|
2980 | IGCM_debug_PopStack "IGCM_sys_Tar" |
---|
2981 | } |
---|
2982 | |
---|
2983 | #D-#================================================== |
---|
2984 | #D-function IGCM_sys_UnTar |
---|
2985 | #D-* Purpose: master un-tar command |
---|
2986 | #D-* Examples: |
---|
2987 | #D- |
---|
2988 | function IGCM_sys_UnTar { |
---|
2989 | IGCM_debug_PushStack "IGCM_sys_UnTar" $@ |
---|
2990 | if ( $DEBUG_sys ) ; then |
---|
2991 | echo "IGCM_sys_UnTar :" $@ |
---|
2992 | fi |
---|
2993 | \tar xvf $1 |
---|
2994 | if [ $? -gt 0 ] ; then |
---|
2995 | echo "IGCM_sys_UnTar : erreur." |
---|
2996 | IGCM_debug_Exit "IGCM_sys_UnTar" |
---|
2997 | fi |
---|
2998 | IGCM_debug_PopStack "IGCM_sys_UnTar" |
---|
2999 | } |
---|
3000 | |
---|
3001 | #D-************************* |
---|
3002 | #D- File transfer functions |
---|
3003 | #D-************************* |
---|
3004 | #D- |
---|
3005 | |
---|
3006 | #D-#================================================== |
---|
3007 | #D-function IGCM_sys_Rsync_out |
---|
3008 | #D-* Purpose: treat return val of rsync |
---|
3009 | #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync |
---|
3010 | #D- Error values and explanations can depend on your system version. |
---|
3011 | function IGCM_sys_Rsync_out { |
---|
3012 | IGCM_debug_PushStack "IGCM_sys_Rsync_out" $@ |
---|
3013 | if ( $DEBUG_sys ) ; then |
---|
3014 | echo "IGCM_sys_UnTar :" $@ |
---|
3015 | fi |
---|
3016 | |
---|
3017 | typeset status |
---|
3018 | status=$1 |
---|
3019 | |
---|
3020 | if [ ! $status ] ; then |
---|
3021 | IGCM_debug_Print 1 "IGCM_sys_Rsync_out need an argument" |
---|
3022 | IGCM_debug_PopStack "IGCM_sys_Rsync_out" |
---|
3023 | return |
---|
3024 | fi |
---|
3025 | |
---|
3026 | case $status in |
---|
3027 | 0) ;; |
---|
3028 | 1) IGCM_debug_Print 1 "rsync error RERR_SYNTAX : Syntax or usage error";; |
---|
3029 | 2) IGCM_debug_Print 1 "rsync error RERR_PROTOCOL : Protocol incompatibility";; |
---|
3030 | 3) IGCM_debug_Print 1 "rsync error RERR_FILESELECT : Errors selecting input/output files, dirs";; |
---|
3031 | 4) IGCM_debug_Print 1 "rsync error RERR_UNSUPPORTED : Requested action not supported." |
---|
3032 | IGCM_debug_Print 1 "An attempt was made to manipulate 64-bit files on a platform that cannot support them" |
---|
3033 | IGCM_debug_Print 1 "Or an option was specified that is supported by the client and not by the server.";; |
---|
3034 | 5) IGCM_debug_Print 1 "rsync error : Error starting client-server protocol";; |
---|
3035 | 10) IGCM_debug_Print 1 "rsync error RERR_SOCKETIO : Error in socket I/O";; |
---|
3036 | 11) IGCM_debug_Print 1 "rsync error RERR_FILEIO: Error in file I/O";; |
---|
3037 | 12) IGCM_debug_Print 1 "rsync error RERR_STREAMIO : Error in rsync protocol data stream";; |
---|
3038 | 13) IGCM_debug_Print 1 "rsync error RERR_MESSAGEIO : Errors with program diagnostics";; |
---|
3039 | 14) IGCM_debug_Print 1 "rsync error RERR_IPC : Error in IPC code";; |
---|
3040 | 20) IGCM_debug_Print 1 "rsync error RERR_SIGNAL : Received SIGUSR1 or SIGINT";; |
---|
3041 | 21) IGCM_debug_Print 1 "rsync error RERR_WAITCHILD : Some error returned by waitpid()";; |
---|
3042 | 22) IGCM_debug_Print 1 "rsync error RERR_MALLOC : Error allocating core memory buffers";; |
---|
3043 | 23) IGCM_debug_Print 1 "rsync error : Partial transfer due to error";; |
---|
3044 | 24) IGCM_debug_Print 1 "rsync error : Partial transfer due to vanished source files";; |
---|
3045 | 30) IGCM_debug_Print 1 "rsync error : Timeout in data send/receive";; |
---|
3046 | *) IGCM_debug_Print 1 "rsync error : return code of rsync unknown :" $status;; |
---|
3047 | esac |
---|
3048 | |
---|
3049 | IGCM_debug_PopStack "IGCM_sys_Rsync_out" |
---|
3050 | } |
---|
3051 | |
---|
3052 | #D-#================================================== |
---|
3053 | #D-function IGCM_sys_Miror_libIGCM |
---|
3054 | #D-* Purpose: Mirror libIGCM PATH and lib to frontend |
---|
3055 | #D-* Examples: |
---|
3056 | #D- |
---|
3057 | function IGCM_sys_Mirror_libIGCM { |
---|
3058 | IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" |
---|
3059 | if ( $DEBUG_sys ) ; then |
---|
3060 | echo "IGCM_sys_Mirror_libIGCM" |
---|
3061 | fi |
---|
3062 | |
---|
3063 | typeset status |
---|
3064 | |
---|
3065 | mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} |
---|
3066 | |
---|
3067 | echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3068 | ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3069 | status=$? |
---|
3070 | |
---|
3071 | if [ ${status} -gt 0 ] ; then |
---|
3072 | echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." |
---|
3073 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3074 | fi |
---|
3075 | IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" |
---|
3076 | } |
---|
3077 | |
---|
3078 | #D-#================================================== |
---|
3079 | #D-function IGCM_sys_Cp |
---|
3080 | #D-* Purpose: generic cp |
---|
3081 | #D-* Examples: |
---|
3082 | #D- |
---|
3083 | function IGCM_sys_Cp { |
---|
3084 | IGCM_debug_PushStack "IGCM_sys_Cp" $@ |
---|
3085 | if ( $DEBUG_sys ) ; then |
---|
3086 | echo "IGCM_sys_Cp :" $@ |
---|
3087 | fi |
---|
3088 | |
---|
3089 | typeset status |
---|
3090 | |
---|
3091 | echo cp $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3092 | \cp $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3093 | status=$? |
---|
3094 | |
---|
3095 | if [ ${status} -gt 0 ] ; then |
---|
3096 | echo "IGCM_sys_Cp : error code ${status}" |
---|
3097 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3098 | IGCM_debug_Exit "IGCM_sys_Cp" |
---|
3099 | else |
---|
3100 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3101 | fi |
---|
3102 | IGCM_debug_PopStack "IGCM_sys_Cp" |
---|
3103 | } |
---|
3104 | |
---|
3105 | #D-#================================================== |
---|
3106 | #D-function IGCM_sys_Rm |
---|
3107 | #D-* Purpose: generic rm |
---|
3108 | #D-* Examples: |
---|
3109 | #D- |
---|
3110 | function IGCM_sys_Rm { |
---|
3111 | IGCM_debug_PushStack "IGCM_sys_Rm" $@ |
---|
3112 | if ( $DEBUG_sys ) ; then |
---|
3113 | echo "IGCM_sys_Rm :" $@ |
---|
3114 | fi |
---|
3115 | |
---|
3116 | typeset status |
---|
3117 | |
---|
3118 | echo rm $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3119 | \rm $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3120 | status=$? |
---|
3121 | |
---|
3122 | if [ ${status} -gt 0 ] ; then |
---|
3123 | echo "IGCM_sys_Rm : error code ${status}" |
---|
3124 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3125 | IGCM_debug_Exit "IGCM_sys_Rm" |
---|
3126 | else |
---|
3127 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3128 | fi |
---|
3129 | IGCM_debug_PopStack "IGCM_sys_Rm" |
---|
3130 | } |
---|
3131 | |
---|
3132 | #D-#================================================== |
---|
3133 | #D-function IGCM_sys_Mv |
---|
3134 | #D-* Purpose: generic move |
---|
3135 | #D-* Examples: |
---|
3136 | #D- |
---|
3137 | function IGCM_sys_Mv { |
---|
3138 | IGCM_debug_PushStack "IGCM_sys_Mv" $@ |
---|
3139 | if ( $DEBUG_sys ) ; then |
---|
3140 | echo "IGCM_sys_Mv :" $@ |
---|
3141 | fi |
---|
3142 | |
---|
3143 | if [ $DRYRUN = 0 ]; then |
---|
3144 | |
---|
3145 | typeset status |
---|
3146 | |
---|
3147 | echo mv $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3148 | \mv $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3149 | status=$? |
---|
3150 | |
---|
3151 | if [ ${status} -gt 0 ] ; then |
---|
3152 | echo "IGCM_sys_Mv : error code ${status}" |
---|
3153 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3154 | IGCM_debug_Exit "IGCM_sys_Mv" |
---|
3155 | else |
---|
3156 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3157 | fi |
---|
3158 | fi |
---|
3159 | IGCM_debug_PopStack "IGCM_sys_Mv" |
---|
3160 | } |
---|
3161 | |
---|
3162 | #D-#================================================== |
---|
3163 | #D-function IGCM_sys_Get_Master |
---|
3164 | #D-* Purpose: Copy a complete directory from MASTER filesystem |
---|
3165 | #D-* Examples: |
---|
3166 | #D- |
---|
3167 | function IGCM_sys_Get_Master { |
---|
3168 | IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ |
---|
3169 | if ( $DEBUG_sys ) ; then |
---|
3170 | echo "IGCM_sys_Get_Master :" $@ |
---|
3171 | fi |
---|
3172 | if [ $DRYRUN = 0 ]; then |
---|
3173 | if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then |
---|
3174 | echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." |
---|
3175 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
3176 | return |
---|
3177 | fi |
---|
3178 | |
---|
3179 | typeset NB_ESSAI DELAI status i |
---|
3180 | # number of tentative |
---|
3181 | NB_ESSAI=3 |
---|
3182 | # time delay between tentative |
---|
3183 | DELAI=2 |
---|
3184 | |
---|
3185 | i=0 |
---|
3186 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3187 | \cp -urL $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3188 | status=$? |
---|
3189 | if [ ${status} -gt 0 ]; then |
---|
3190 | IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
3191 | IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." |
---|
3192 | sleep $DELAI |
---|
3193 | else |
---|
3194 | break |
---|
3195 | fi |
---|
3196 | (( i = i + 1 )) |
---|
3197 | done |
---|
3198 | |
---|
3199 | if [ ${status} -gt 0 ] ; then |
---|
3200 | echo "IGCM_sys_Get_Master : error." |
---|
3201 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3202 | IGCM_debug_Exit "IGCM_sys_Get_Master" |
---|
3203 | else |
---|
3204 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3205 | fi |
---|
3206 | fi |
---|
3207 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
3208 | } |
---|
3209 | |
---|
3210 | #==================================================== |
---|
3211 | #- Call IGCM_sys_Mirror_libIGCM now ! |
---|
3212 | if ( $MirrorlibIGCM ) ; then |
---|
3213 | IGCM_sys_Mirror_libIGCM |
---|
3214 | fi |
---|
3215 | |
---|
3216 | #D-#================================================== |
---|
3217 | #D-function IGCM_sys_PutBuffer_Rest |
---|
3218 | #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. |
---|
3219 | #D- File and target directory must exist. |
---|
3220 | #D-* Examples: |
---|
3221 | #D- |
---|
3222 | function IGCM_sys_PutBuffer_Rest { |
---|
3223 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ |
---|
3224 | if ( $DEBUG_sys ) ; then |
---|
3225 | echo "IGCM_sys_PutBuffer_Rest :" $@ |
---|
3226 | fi |
---|
3227 | if [ $DRYRUN = 0 ]; then |
---|
3228 | if [ ! -f ${1} ] ; then |
---|
3229 | echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." |
---|
3230 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
3231 | fi |
---|
3232 | |
---|
3233 | typeset status |
---|
3234 | # |
---|
3235 | # USUAL WAY |
---|
3236 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3237 | status=$? |
---|
3238 | |
---|
3239 | if [ ${status} -gt 0 ] ; then |
---|
3240 | echo "IGCM_sys_PutBuffer_Rest : error code ${status}" |
---|
3241 | [ -f ${2} ] && ls -l ${2} |
---|
3242 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
3243 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3244 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
3245 | else |
---|
3246 | |
---|
3247 | if [ X${JobType} = XRUN ] ; then |
---|
3248 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
3249 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
3250 | fi |
---|
3251 | |
---|
3252 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3253 | fi |
---|
3254 | fi |
---|
3255 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" |
---|
3256 | } |
---|
3257 | |
---|
3258 | #D-#================================================== |
---|
3259 | #D-function IGCM_sys_PrepareTaredRestart |
---|
3260 | #D-* Purpose: Prepare tared restart to be access by computing job. |
---|
3261 | #D-* Examples: |
---|
3262 | #D- |
---|
3263 | function IGCM_sys_PrepareTaredRestart { |
---|
3264 | IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@ |
---|
3265 | if [ $DRYRUN = 0 ]; then |
---|
3266 | [ ! -f $( basename $1 ) ] && IGCM_sys_Get $1 . |
---|
3267 | fi |
---|
3268 | IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart" |
---|
3269 | } |
---|
3270 | |
---|
3271 | #D-#================================================== |
---|
3272 | #D-function IGCM_sys_PutBuffer_Out |
---|
3273 | #D-* Purpose: Copy a file on the buffer filesystem after having chmod it in readonly |
---|
3274 | #D-* Examples: |
---|
3275 | #D- |
---|
3276 | function IGCM_sys_PutBuffer_Out { |
---|
3277 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ |
---|
3278 | if ( $DEBUG_sys ) ; then |
---|
3279 | echo "IGCM_sys_PutBuffer_Out :" $@ |
---|
3280 | fi |
---|
3281 | |
---|
3282 | typeset NB_ESSAI DELAI status i exist skip |
---|
3283 | typeset fileDeviceNumberInHex directoryDeviceNumberInHex |
---|
3284 | |
---|
3285 | # number of tentative |
---|
3286 | NB_ESSAI=3 |
---|
3287 | # time delay between tentative |
---|
3288 | DELAI=2 |
---|
3289 | |
---|
3290 | if [ $DRYRUN = 0 ]; then |
---|
3291 | if [ ! -f ${1} ] ; then |
---|
3292 | echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." |
---|
3293 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
3294 | return 1 |
---|
3295 | fi |
---|
3296 | # |
---|
3297 | IGCM_sys_Mkdir $( dirname $2 ) |
---|
3298 | # |
---|
3299 | |
---|
3300 | exist=false |
---|
3301 | skip=false |
---|
3302 | if [ -f $2 ] ; then |
---|
3303 | IGCM_debug_Print 1 "$2 already exist" |
---|
3304 | exist=true |
---|
3305 | if [ "X$( diff $1 $2 )" = X ] ; then |
---|
3306 | IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" |
---|
3307 | status=0 |
---|
3308 | skip=true |
---|
3309 | else |
---|
3310 | IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" |
---|
3311 | skip=false |
---|
3312 | fi |
---|
3313 | fi |
---|
3314 | # |
---|
3315 | if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then |
---|
3316 | IGCM_sys_Chmod u+w $2 |
---|
3317 | fi |
---|
3318 | |
---|
3319 | if [ X${skip} = Xfalse ] ; then |
---|
3320 | i=0 |
---|
3321 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3322 | # Identify file system |
---|
3323 | fileDeviceNumberInHex=$( stat -c %d $1 ) |
---|
3324 | status=$? |
---|
3325 | if [ ${status} -gt 0 ] ; then |
---|
3326 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" |
---|
3327 | fi |
---|
3328 | # Identify file system |
---|
3329 | directoryDeviceNumberInHex=$( stat -c %d $( dirname $2 ) ) |
---|
3330 | status=$? |
---|
3331 | if [ ${status} -gt 0 ] ; then |
---|
3332 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" |
---|
3333 | fi |
---|
3334 | |
---|
3335 | if [ ${fileDeviceNumberInHex} -ne ${directoryDeviceNumberInHex} ] ; then |
---|
3336 | # They are not on the same device. USUAL WAY |
---|
3337 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3338 | status=$? |
---|
3339 | else |
---|
3340 | # They are on the same device. USUAL WAY |
---|
3341 | \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3342 | status=$? |
---|
3343 | fi |
---|
3344 | if [ ${status} -gt 0 ]; then |
---|
3345 | IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
3346 | IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." |
---|
3347 | [ -f ${2} ] && ls -l ${2} |
---|
3348 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
3349 | sleep $DELAI |
---|
3350 | else |
---|
3351 | break |
---|
3352 | fi |
---|
3353 | (( i = i + 1 )) |
---|
3354 | done |
---|
3355 | fi |
---|
3356 | |
---|
3357 | if [ ${status} -gt 0 ] ; then |
---|
3358 | echo "IGCM_sys_PutBuffer_Out : error." |
---|
3359 | [ -f ${2} ] && ls -l ${2} |
---|
3360 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
3361 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3362 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" |
---|
3363 | else |
---|
3364 | |
---|
3365 | if [ X${JobType} = XRUN ] ; then |
---|
3366 | if [ X${3} = X ] ; then |
---|
3367 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
3368 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
3369 | fi |
---|
3370 | fi |
---|
3371 | |
---|
3372 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3373 | fi |
---|
3374 | fi |
---|
3375 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
3376 | return 0 |
---|
3377 | } |
---|
3378 | |
---|
3379 | #D-#================================================== |
---|
3380 | #D-function IGCM_sys_GetBuffer |
---|
3381 | #D-* Purpose: Get a file from ${SCRATCHDIR} |
---|
3382 | #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX |
---|
3383 | #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ |
---|
3384 | function IGCM_sys_GetBuffer { |
---|
3385 | IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ |
---|
3386 | |
---|
3387 | typeset DEST buf_liste target file_work |
---|
3388 | typeset NB_ESSAI DELAI status i |
---|
3389 | |
---|
3390 | if ( $DEBUG_sys ) ; then |
---|
3391 | echo "IGCM_sys_GetBuffer :" $@ |
---|
3392 | fi |
---|
3393 | |
---|
3394 | # number of tentative |
---|
3395 | NB_ESSAI=3 |
---|
3396 | # time delay between tentative |
---|
3397 | DELAI=2 |
---|
3398 | |
---|
3399 | if [ $DRYRUN -le 2 ]; then |
---|
3400 | if [ X${1} = X'/l' ] ; then |
---|
3401 | eval set +A buf_liste \${${2}} |
---|
3402 | else |
---|
3403 | eval set +A buf_liste ${1} |
---|
3404 | fi |
---|
3405 | eval DEST=\${${#}} |
---|
3406 | |
---|
3407 | #USUAL WAY |
---|
3408 | if [ X${1} = X'/l' ] ; then |
---|
3409 | for target in ${buf_liste[*]} ; do |
---|
3410 | local_file=$( basename ${target} ) |
---|
3411 | i=0 |
---|
3412 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3413 | \cp ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3414 | status=$? |
---|
3415 | if [ ${status} -gt 0 ]; then |
---|
3416 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
3417 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." |
---|
3418 | sleep $DELAI |
---|
3419 | else |
---|
3420 | break |
---|
3421 | fi |
---|
3422 | (( i = i + 1 )) |
---|
3423 | done |
---|
3424 | if [ ${status} -gt 0 ] ; then |
---|
3425 | echo "IGCM_sys_Get : error" |
---|
3426 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3427 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3428 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
3429 | else |
---|
3430 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3431 | fi |
---|
3432 | done |
---|
3433 | else |
---|
3434 | i=0 |
---|
3435 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3436 | \cp ${buf_liste} ${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3437 | status=$? |
---|
3438 | if [ ${status} -gt 0 ]; then |
---|
3439 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
3440 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." |
---|
3441 | sleep $DELAI |
---|
3442 | else |
---|
3443 | break |
---|
3444 | fi |
---|
3445 | (( i = i + 1 )) |
---|
3446 | done |
---|
3447 | if [ ${status} -gt 0 ] ; then |
---|
3448 | echo "IGCM_sys_Get : error" |
---|
3449 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3450 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3451 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
3452 | else |
---|
3453 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3454 | fi |
---|
3455 | fi |
---|
3456 | fi |
---|
3457 | IGCM_debug_PopStack "IGCM_sys_GetBuffer" |
---|
3458 | } |
---|
3459 | |
---|
3460 | #D-#================================================== |
---|
3461 | #D-function IGCM_sys_GetDate_FichWork |
---|
3462 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK |
---|
3463 | #D-* Examples: |
---|
3464 | #D- |
---|
3465 | function IGCM_sys_GetDate_FichWork { |
---|
3466 | IGCM_debug_PushStack "IGCM_sys_GetDate_FichWork" $@ |
---|
3467 | if ( $DEBUG_sys ) ; then |
---|
3468 | echo "IGCM_sys_GetDate_FichWork :" $@ |
---|
3469 | fi |
---|
3470 | |
---|
3471 | if [ $# -ge 3 ] ; then |
---|
3472 | mode=$3 |
---|
3473 | TimeStyle=$4 |
---|
3474 | else |
---|
3475 | mode="default" |
---|
3476 | TimeStyle="%Y%m%d%H%M%S" |
---|
3477 | fi |
---|
3478 | |
---|
3479 | typeset dateF |
---|
3480 | set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} ) |
---|
3481 | |
---|
3482 | case $mode in |
---|
3483 | "default") |
---|
3484 | eval ${2}=${dateF[5]} |
---|
3485 | ;; |
---|
3486 | "SplitFields") |
---|
3487 | eval ${2}="${dateF[5]}\ ${dateF[6]}" |
---|
3488 | ;; |
---|
3489 | esac |
---|
3490 | |
---|
3491 | # donne la date filesys d'un fichier sur la machine work |
---|
3492 | IGCM_debug_PopStack "IGCM_sys_GetDate_FichWork" |
---|
3493 | } |
---|
3494 | |
---|
3495 | #D-#================================================== |
---|
3496 | #D-function IGCM_sys_rebuild |
---|
3497 | #D-* Purpose: rebuild parallel files |
---|
3498 | #D-* Examples: |
---|
3499 | #D- |
---|
3500 | function IGCM_sys_rebuild { |
---|
3501 | IGCM_debug_PushStack "IGCM_sys_rebuild" $@ |
---|
3502 | if ( $DEBUG_sys ) ; then |
---|
3503 | echo "IGCM_sys_rebuild :" $@ |
---|
3504 | fi |
---|
3505 | |
---|
3506 | typeset NB_ESSAI DELAI status i firstArg |
---|
3507 | # number of tentative |
---|
3508 | NB_ESSAI=3 |
---|
3509 | # time delay between tentative |
---|
3510 | DELAI=2 |
---|
3511 | |
---|
3512 | i=0 |
---|
3513 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3514 | rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3515 | status=$? |
---|
3516 | if [ ${status} -gt 0 ] ; then |
---|
3517 | IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" |
---|
3518 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3519 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3520 | IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3521 | firstArg=${1} |
---|
3522 | \rm ${firstArg} |
---|
3523 | sleep $DELAI |
---|
3524 | else |
---|
3525 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3526 | break |
---|
3527 | fi |
---|
3528 | (( i = i + 1 )) |
---|
3529 | done |
---|
3530 | |
---|
3531 | if [ ${status} -gt 0 ] ; then |
---|
3532 | echo "IGCM_sys_rebuild : rebuild error code is ${status}" |
---|
3533 | IGCM_debug_Exit "rebuild" |
---|
3534 | fi |
---|
3535 | |
---|
3536 | IGCM_debug_PopStack "IGCM_sys_rebuild" |
---|
3537 | } |
---|
3538 | |
---|
3539 | #D-#================================================== |
---|
3540 | #D-function IGCM_sys_rebuild_station |
---|
3541 | #D-* Purpose: rebuild parallel files describing station |
---|
3542 | #D-* Examples: |
---|
3543 | #D- |
---|
3544 | function IGCM_sys_rebuild_station { |
---|
3545 | IGCM_debug_PushStack "IGCM_sys_rebuild_station" $@ |
---|
3546 | typeset i list_opt file_in file_out prefix_invert list_invert |
---|
3547 | if ( $DEBUG_sys ) ; then |
---|
3548 | echo "IGCM_sys_rebuild_station :" $@ |
---|
3549 | fi |
---|
3550 | |
---|
3551 | # Station re-ordering is too expansive to be run within libIGCM |
---|
3552 | # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. |
---|
3553 | # This re-ordering must be done "in memory" by the cmorization process |
---|
3554 | |
---|
3555 | # Only LMDZ text output contains the exact ordering of the station. |
---|
3556 | # We isolate this in the code below: |
---|
3557 | # 0 38 -157.5000000000000 70.98591549295774 |
---|
3558 | # 0 54 27.49999999999999 67.18309859154928 |
---|
3559 | # 0 56 -62.50000000000001 82.39436619718309 |
---|
3560 | # 0 79 12.49999999999999 78.59154929577466 |
---|
3561 | # 0 116 -165.0000000000000 76.05633802816901 |
---|
3562 | # 0 117 130.0000000000000 70.98591549295774 |
---|
3563 | # 0 118 110.0000000000000 87.46478873239437 |
---|
3564 | # 1 40 4.999999999999995 51.97183098591550 |
---|
3565 | |
---|
3566 | list_opt=$@ |
---|
3567 | |
---|
3568 | # Invert Axis : t,x -> x,t |
---|
3569 | # t,pres,x -> x,t,pres |
---|
3570 | # So that we can concatenate along x |
---|
3571 | i=0 |
---|
3572 | for file_in in ${list_opt} ; do |
---|
3573 | (( i = i + 1)) |
---|
3574 | [ ${i} = 1 ] && file_out=${file_in} && continue |
---|
3575 | # detect time counter and do the job only if present |
---|
3576 | var_unlim=$(ncdump -h ${file_in} | grep UNLIMITED | cut -d ' ' -f 1 | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') |
---|
3577 | if [ X${var_unlim} = Xtime_counter ] ; then |
---|
3578 | prefix_invert=$( basename ${file_in} .nc ) |
---|
3579 | IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc |
---|
3580 | list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc |
---|
3581 | fi |
---|
3582 | done |
---|
3583 | |
---|
3584 | # Concatenate |
---|
3585 | IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc |
---|
3586 | |
---|
3587 | # Re-ivert file |
---|
3588 | IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} |
---|
3589 | |
---|
3590 | IGCM_debug_PopStack "IGCM_sys_rebuild_station" |
---|
3591 | } |
---|
3592 | |
---|
3593 | ############################################################## |
---|
3594 | # NCO OPERATOR |
---|
3595 | |
---|
3596 | #D-#================================================== |
---|
3597 | #D-function IGCM_sys_ncap2 |
---|
3598 | #D-* Purpose: encapsulate ncap2 call so as to manage error code and retry |
---|
3599 | #D-* Examples: |
---|
3600 | #D- |
---|
3601 | function IGCM_sys_ncap2 { |
---|
3602 | IGCM_debug_PushStack "IGCM_sys_ncap2" $@ |
---|
3603 | if ( $DEBUG_sys ) ; then |
---|
3604 | echo "IGCM_sys_ncap2 :" $@ |
---|
3605 | fi |
---|
3606 | |
---|
3607 | typeset NB_ESSAI DELAI status i |
---|
3608 | # number of tentative |
---|
3609 | NB_ESSAI=3 |
---|
3610 | # time delay between tentative |
---|
3611 | DELAI=2 |
---|
3612 | |
---|
3613 | i=0 |
---|
3614 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3615 | ncap2 -C --buffer_size 838860800 "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3616 | status=$? |
---|
3617 | if [ ${status} -gt 0 ] ; then |
---|
3618 | IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}" |
---|
3619 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3620 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3621 | IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3622 | sleep $DELAI |
---|
3623 | else |
---|
3624 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3625 | break |
---|
3626 | fi |
---|
3627 | (( i = i + 1 )) |
---|
3628 | done |
---|
3629 | |
---|
3630 | if [ ${status} -gt 0 ] ; then |
---|
3631 | echo "IGCM_sys_ncap2 : ncap2 error" |
---|
3632 | IGCM_debug_Exit "ncap2" |
---|
3633 | fi |
---|
3634 | |
---|
3635 | IGCM_debug_PopStack "IGCM_sys_ncap2" |
---|
3636 | } |
---|
3637 | |
---|
3638 | #D-#================================================== |
---|
3639 | #D-function IGCM_sys_ncatted |
---|
3640 | #D-* Purpose: encapsulate ncatted call so as to manage error code and retry |
---|
3641 | #D-* Examples: |
---|
3642 | #D- |
---|
3643 | function IGCM_sys_ncatted { |
---|
3644 | IGCM_debug_PushStack "IGCM_sys_ncatted" $@ |
---|
3645 | if ( $DEBUG_sys ) ; then |
---|
3646 | echo "IGCM_sys_ncatted :" $@ |
---|
3647 | fi |
---|
3648 | |
---|
3649 | typeset NB_ESSAI DELAI status i |
---|
3650 | # number of tentative |
---|
3651 | NB_ESSAI=3 |
---|
3652 | # time delay between tentative |
---|
3653 | DELAI=2 |
---|
3654 | |
---|
3655 | i=0 |
---|
3656 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3657 | ncatted "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3658 | status=$? |
---|
3659 | if [ ${status} -gt 0 ] ; then |
---|
3660 | IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}" |
---|
3661 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3662 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3663 | IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3664 | sleep $DELAI |
---|
3665 | else |
---|
3666 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3667 | break |
---|
3668 | fi |
---|
3669 | (( i = i + 1 )) |
---|
3670 | done |
---|
3671 | |
---|
3672 | if [ ${status} -gt 0 ] ; then |
---|
3673 | echo "IGCM_sys_ncatted : ncatted error" |
---|
3674 | IGCM_debug_Exit "ncatted" |
---|
3675 | fi |
---|
3676 | |
---|
3677 | IGCM_debug_PopStack "IGCM_sys_ncatted" |
---|
3678 | } |
---|
3679 | |
---|
3680 | #D-#================================================== |
---|
3681 | #D-function IGCM_sys_ncbo |
---|
3682 | #D-* Purpose: encapsulate ncbo call so as to manage error code and retry |
---|
3683 | #D-* Examples: |
---|
3684 | #D- |
---|
3685 | function IGCM_sys_ncbo { |
---|
3686 | IGCM_debug_PushStack "IGCM_sys_ncbo" $@ |
---|
3687 | if ( $DEBUG_sys ) ; then |
---|
3688 | echo "IGCM_sys_ncbo :" $@ |
---|
3689 | fi |
---|
3690 | |
---|
3691 | typeset NB_ESSAI DELAI status i |
---|
3692 | # number of tentative |
---|
3693 | NB_ESSAI=3 |
---|
3694 | # time delay between tentative |
---|
3695 | DELAI=2 |
---|
3696 | |
---|
3697 | i=0 |
---|
3698 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3699 | ncbo -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3700 | status=$? |
---|
3701 | if [ ${status} -gt 0 ] ; then |
---|
3702 | IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}" |
---|
3703 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3704 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3705 | IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3706 | sleep $DELAI |
---|
3707 | else |
---|
3708 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3709 | break |
---|
3710 | fi |
---|
3711 | (( i = i + 1 )) |
---|
3712 | done |
---|
3713 | |
---|
3714 | if [ ${status} -gt 0 ] ; then |
---|
3715 | echo "IGCM_sys_ncbo : ncbo error" |
---|
3716 | IGCM_debug_Exit "ncbo" |
---|
3717 | fi |
---|
3718 | |
---|
3719 | IGCM_debug_PopStack "IGCM_sys_ncbo" |
---|
3720 | } |
---|
3721 | |
---|
3722 | #D-#================================================== |
---|
3723 | #D-function IGCM_sys_ncdif |
---|
3724 | #D-* Purpose: encapsulate ncdiff call so as to manage error code and retry |
---|
3725 | #D-* Examples: |
---|
3726 | #D- |
---|
3727 | function IGCM_sys_ncdiff { |
---|
3728 | IGCM_debug_PushStack "IGCM_sys_ncdiff" $@ |
---|
3729 | if ( $DEBUG_sys ) ; then |
---|
3730 | echo "IGCM_sys_ncdiff :" $@ |
---|
3731 | fi |
---|
3732 | |
---|
3733 | typeset NB_ESSAI DELAI status i |
---|
3734 | # number of tentative |
---|
3735 | NB_ESSAI=3 |
---|
3736 | # time delay between tentative |
---|
3737 | DELAI=2 |
---|
3738 | |
---|
3739 | i=0 |
---|
3740 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3741 | ncdiff -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3742 | status=$? |
---|
3743 | if [ ${status} -gt 0 ] ; then |
---|
3744 | IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}" |
---|
3745 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3746 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3747 | IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3748 | sleep $DELAI |
---|
3749 | else |
---|
3750 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3751 | break |
---|
3752 | fi |
---|
3753 | (( i = i + 1 )) |
---|
3754 | done |
---|
3755 | |
---|
3756 | if [ ${status} -gt 0 ] ; then |
---|
3757 | echo "IGCM_sys_ncdiff : ncdiff error" |
---|
3758 | IGCM_debug_Exit "ncdiff" |
---|
3759 | fi |
---|
3760 | |
---|
3761 | IGCM_debug_PopStack "IGCM_sys_ncdiff" |
---|
3762 | } |
---|
3763 | |
---|
3764 | #D-#================================================== |
---|
3765 | #D-function IGCM_sys_ncea |
---|
3766 | #D-* Purpose: encapsulate ncea call so as to manage error code and retry |
---|
3767 | #D-* Examples: |
---|
3768 | #D- |
---|
3769 | function IGCM_sys_ncea { |
---|
3770 | IGCM_debug_PushStack "IGCM_sys_ncea" $@ |
---|
3771 | if ( $DEBUG_sys ) ; then |
---|
3772 | echo "IGCM_sys_ncea :" $@ |
---|
3773 | fi |
---|
3774 | |
---|
3775 | typeset NB_ESSAI DELAI status i |
---|
3776 | # number of tentative |
---|
3777 | NB_ESSAI=3 |
---|
3778 | # time delay between tentative |
---|
3779 | DELAI=2 |
---|
3780 | |
---|
3781 | i=0 |
---|
3782 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3783 | ncea -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3784 | status=$? |
---|
3785 | if [ ${status} -gt 0 ] ; then |
---|
3786 | IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}" |
---|
3787 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3788 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3789 | IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3790 | sleep $DELAI |
---|
3791 | else |
---|
3792 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3793 | break |
---|
3794 | fi |
---|
3795 | (( i = i + 1 )) |
---|
3796 | done |
---|
3797 | |
---|
3798 | if [ ${status} -gt 0 ] ; then |
---|
3799 | echo "IGCM_sys_ncea : ncea error" |
---|
3800 | IGCM_debug_Exit "ncea" |
---|
3801 | fi |
---|
3802 | |
---|
3803 | IGCM_debug_PopStack "IGCM_sys_ncea" |
---|
3804 | } |
---|
3805 | |
---|
3806 | #D-#================================================== |
---|
3807 | #D-function IGCM_sys_ncecat |
---|
3808 | #D-* Purpose: encapsulate ncecat call so as to manage error code and retry |
---|
3809 | #D-* Examples: |
---|
3810 | #D- |
---|
3811 | function IGCM_sys_ncecat { |
---|
3812 | IGCM_debug_PushStack "IGCM_sys_ncecat" $@ |
---|
3813 | if ( $DEBUG_sys ) ; then |
---|
3814 | echo "IGCM_sys_ncecat :" $@ |
---|
3815 | fi |
---|
3816 | |
---|
3817 | typeset NB_ESSAI DELAI status i |
---|
3818 | # number of tentative |
---|
3819 | NB_ESSAI=3 |
---|
3820 | # time delay between tentative |
---|
3821 | DELAI=2 |
---|
3822 | |
---|
3823 | i=0 |
---|
3824 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3825 | ncecat -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3826 | status=$? |
---|
3827 | if [ ${status} -gt 0 ] ; then |
---|
3828 | IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}" |
---|
3829 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3830 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3831 | IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3832 | sleep $DELAI |
---|
3833 | else |
---|
3834 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3835 | break |
---|
3836 | fi |
---|
3837 | (( i = i + 1 )) |
---|
3838 | done |
---|
3839 | |
---|
3840 | if [ ${status} -gt 0 ] ; then |
---|
3841 | echo "IGCM_sys_ncecat : ncecat error" |
---|
3842 | IGCM_debug_Exit "ncecat" |
---|
3843 | fi |
---|
3844 | |
---|
3845 | IGCM_debug_PopStack "IGCM_sys_ncecat" |
---|
3846 | } |
---|
3847 | |
---|
3848 | #D-#================================================== |
---|
3849 | #D-function IGCM_sys_ncflint |
---|
3850 | #D-* Purpose: encapsulate ncflint call so as to manage error code and retry |
---|
3851 | #D-* Examples: |
---|
3852 | #D- |
---|
3853 | function IGCM_sys_ncflint { |
---|
3854 | IGCM_debug_PushStack "IGCM_sys_ncflint" $@ |
---|
3855 | if ( $DEBUG_sys ) ; then |
---|
3856 | echo "IGCM_sys_ncflint :" $@ |
---|
3857 | fi |
---|
3858 | |
---|
3859 | typeset NB_ESSAI DELAI status i |
---|
3860 | # number of tentative |
---|
3861 | NB_ESSAI=3 |
---|
3862 | # time delay between tentative |
---|
3863 | DELAI=2 |
---|
3864 | |
---|
3865 | i=0 |
---|
3866 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3867 | ncflint -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3868 | status=$? |
---|
3869 | if [ ${status} -gt 0 ] ; then |
---|
3870 | IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}" |
---|
3871 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3872 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3873 | IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3874 | sleep $DELAI |
---|
3875 | else |
---|
3876 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3877 | break |
---|
3878 | fi |
---|
3879 | (( i = i + 1 )) |
---|
3880 | done |
---|
3881 | |
---|
3882 | if [ ${status} -gt 0 ] ; then |
---|
3883 | echo "IGCM_sys_ncflint : ncflint error" |
---|
3884 | IGCM_debug_Exit "ncflint" |
---|
3885 | fi |
---|
3886 | |
---|
3887 | IGCM_debug_PopStack "IGCM_sys_ncflint" |
---|
3888 | } |
---|
3889 | |
---|
3890 | #D-#================================================== |
---|
3891 | #D-function IGCM_sys_ncks |
---|
3892 | #D-* Purpose: encapsulate ncks call so as to manage error code and retry |
---|
3893 | #D-* Examples: |
---|
3894 | #D- |
---|
3895 | function IGCM_sys_ncks { |
---|
3896 | IGCM_debug_PushStack "IGCM_sys_ncks" $@ |
---|
3897 | if ( $DEBUG_sys ) ; then |
---|
3898 | echo "IGCM_sys_ncks :" $@ |
---|
3899 | fi |
---|
3900 | |
---|
3901 | typeset NB_ESSAI DELAI status i |
---|
3902 | # number of tentative |
---|
3903 | NB_ESSAI=3 |
---|
3904 | # time delay between tentative |
---|
3905 | DELAI=2 |
---|
3906 | |
---|
3907 | i=0 |
---|
3908 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3909 | ncks -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3910 | status=$? |
---|
3911 | if [ ${status} -gt 0 ] ; then |
---|
3912 | IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}" |
---|
3913 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3914 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3915 | IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3916 | sleep $DELAI |
---|
3917 | else |
---|
3918 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3919 | break |
---|
3920 | fi |
---|
3921 | (( i = i + 1 )) |
---|
3922 | done |
---|
3923 | |
---|
3924 | if [ ${status} -gt 0 ] ; then |
---|
3925 | echo "IGCM_sys_ncks : ncks error" |
---|
3926 | IGCM_debug_Exit "ncks" |
---|
3927 | fi |
---|
3928 | |
---|
3929 | IGCM_debug_PopStack "IGCM_sys_ncks" |
---|
3930 | } |
---|
3931 | |
---|
3932 | #D-#================================================== |
---|
3933 | #D-function IGCM_sys_ncpdq |
---|
3934 | #D-* Purpose: encapsulate ncpdq call so as to manage error code and retry |
---|
3935 | #D-* Examples: |
---|
3936 | #D- |
---|
3937 | function IGCM_sys_ncpdq { |
---|
3938 | IGCM_debug_PushStack "IGCM_sys_ncpdq" $@ |
---|
3939 | if ( $DEBUG_sys ) ; then |
---|
3940 | echo "IGCM_sys_ncpdq :" $@ |
---|
3941 | fi |
---|
3942 | |
---|
3943 | typeset NB_ESSAI DELAI status i |
---|
3944 | # number of tentative |
---|
3945 | NB_ESSAI=3 |
---|
3946 | # time delay between tentative |
---|
3947 | DELAI=2 |
---|
3948 | |
---|
3949 | i=0 |
---|
3950 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3951 | ncpdq -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3952 | status=$? |
---|
3953 | if [ ${status} -gt 0 ] ; then |
---|
3954 | IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}" |
---|
3955 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3956 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3957 | IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
3958 | sleep $DELAI |
---|
3959 | else |
---|
3960 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3961 | break |
---|
3962 | fi |
---|
3963 | (( i = i + 1 )) |
---|
3964 | done |
---|
3965 | |
---|
3966 | if [ ${status} -gt 0 ] ; then |
---|
3967 | echo "IGCM_sys_ncpdq : ncpdq error" |
---|
3968 | IGCM_debug_Exit "ncpdq" |
---|
3969 | fi |
---|
3970 | |
---|
3971 | IGCM_debug_PopStack "IGCM_sys_ncpdq" |
---|
3972 | } |
---|
3973 | |
---|
3974 | #D-#================================================== |
---|
3975 | #D-function IGCM_sys_ncra |
---|
3976 | #D-* Purpose: encapsulate ncra call so as to manage error code and retry |
---|
3977 | #D-* Examples: |
---|
3978 | #D- |
---|
3979 | function IGCM_sys_ncra { |
---|
3980 | IGCM_debug_PushStack "IGCM_sys_ncra" $@ |
---|
3981 | if ( $DEBUG_sys ) ; then |
---|
3982 | echo "IGCM_sys_ncra :" $@ |
---|
3983 | fi |
---|
3984 | |
---|
3985 | typeset NB_ESSAI DELAI status i |
---|
3986 | # number of tentative |
---|
3987 | NB_ESSAI=3 |
---|
3988 | # time delay between tentative |
---|
3989 | DELAI=2 |
---|
3990 | |
---|
3991 | i=0 |
---|
3992 | while [ $i -lt $NB_ESSAI ] ; do |
---|
3993 | ncra -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
3994 | status=$? |
---|
3995 | if [ ${status} -gt 0 ] ; then |
---|
3996 | IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}" |
---|
3997 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3998 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
3999 | IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
4000 | sleep $DELAI |
---|
4001 | else |
---|
4002 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4003 | break |
---|
4004 | fi |
---|
4005 | (( i = i + 1 )) |
---|
4006 | done |
---|
4007 | |
---|
4008 | if [ ${status} -gt 0 ] ; then |
---|
4009 | echo "IGCM_sys_ncra : ncra error" |
---|
4010 | IGCM_debug_Exit "ncra" |
---|
4011 | fi |
---|
4012 | |
---|
4013 | IGCM_debug_PopStack "IGCM_sys_ncra" |
---|
4014 | } |
---|
4015 | |
---|
4016 | #D-#================================================== |
---|
4017 | #D-function IGCM_sys_ncrcat |
---|
4018 | #D-* Purpose: encapsulate ncrcat call so as to manage error code and retry |
---|
4019 | #D-* Examples: |
---|
4020 | #D- |
---|
4021 | function IGCM_sys_ncrcat { |
---|
4022 | IGCM_debug_PushStack "IGCM_sys_ncrcat" $@ |
---|
4023 | if ( $DEBUG_sys ) ; then |
---|
4024 | echo "IGCM_sys_ncrcat :" $@ |
---|
4025 | fi |
---|
4026 | |
---|
4027 | typeset NB_ESSAI DELAI status i lastArg |
---|
4028 | # number of tentative |
---|
4029 | NB_ESSAI=3 |
---|
4030 | # time delay between tentative |
---|
4031 | DELAI=2 |
---|
4032 | |
---|
4033 | i=0 |
---|
4034 | while [ $i -lt $NB_ESSAI ] ; do |
---|
4035 | ncrcat -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4036 | status=$? |
---|
4037 | if [ ${status} -gt 0 ] ; then |
---|
4038 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}" |
---|
4039 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4040 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4041 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
4042 | sleep $DELAI |
---|
4043 | elif ( [ ! "X$( grep "WARNING Intra-file non-monotonicity" ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ )" = "X" ] && [ X${config_Post_IgnoreNonMonotonic} = XFALSE ] ) ; then |
---|
4044 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" |
---|
4045 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4046 | # remove files having corrupted time axis |
---|
4047 | eval lastArg=\${$#} |
---|
4048 | IGCM_debug_Print 2 "Remove files having corrupted time axis" |
---|
4049 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" |
---|
4050 | \rm ${lastArg} |
---|
4051 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4052 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
4053 | sleep $DELAI |
---|
4054 | else |
---|
4055 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4056 | break |
---|
4057 | fi |
---|
4058 | (( i = i + 1 )) |
---|
4059 | done |
---|
4060 | |
---|
4061 | # Special case for spinup with cyclic time axis: change attribute calendar to none |
---|
4062 | if [ X${config_Post_IgnoreNonMonotonic} = XTRUE ] ; then |
---|
4063 | eval lastArg=\${$#} |
---|
4064 | echo "IGCM_sys_ncrcat : change attribute calendar to none in file:" ${lastArg} |
---|
4065 | IGCM_sys_ncatted -a calendar,time_counter,m,c,none ${lastArg} |
---|
4066 | fi |
---|
4067 | |
---|
4068 | if [ ${status} -gt 0 ] ; then |
---|
4069 | echo "IGCM_sys_ncrcat : ncrcat error" |
---|
4070 | #IGCM_debug_Exit "ncrcat" |
---|
4071 | fi |
---|
4072 | |
---|
4073 | IGCM_debug_PopStack "IGCM_sys_ncrcat" |
---|
4074 | } |
---|
4075 | |
---|
4076 | #D-#================================================== |
---|
4077 | #D-function IGCM_sys_ncrename |
---|
4078 | #D-* Purpose: encapsulate ncrename call so as to manage error code and retry |
---|
4079 | #D-* Examples: |
---|
4080 | #D- |
---|
4081 | function IGCM_sys_ncrename { |
---|
4082 | IGCM_debug_PushStack "IGCM_sys_ncrename" $@ |
---|
4083 | if ( $DEBUG_sys ) ; then |
---|
4084 | echo "IGCM_sys_ncrename :" $@ |
---|
4085 | fi |
---|
4086 | |
---|
4087 | typeset NB_ESSAI DELAI status i |
---|
4088 | # number of tentative |
---|
4089 | NB_ESSAI=3 |
---|
4090 | # time delay between tentative |
---|
4091 | DELAI=2 |
---|
4092 | |
---|
4093 | i=0 |
---|
4094 | while [ $i -lt $NB_ESSAI ] ; do |
---|
4095 | ncrename $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4096 | status=$? |
---|
4097 | if [ ${status} -gt 0 ] ; then |
---|
4098 | IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}" |
---|
4099 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4100 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4101 | IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
4102 | sleep $DELAI |
---|
4103 | else |
---|
4104 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4105 | break |
---|
4106 | fi |
---|
4107 | (( i = i + 1 )) |
---|
4108 | done |
---|
4109 | |
---|
4110 | if [ ${status} -gt 0 ] ; then |
---|
4111 | echo "IGCM_sys_ncrename : ncrename error" |
---|
4112 | IGCM_debug_Exit "ncrename" |
---|
4113 | fi |
---|
4114 | |
---|
4115 | IGCM_debug_PopStack "IGCM_sys_ncrename" |
---|
4116 | } |
---|
4117 | |
---|
4118 | #D-#================================================== |
---|
4119 | #D-function IGCM_sys_ncwa |
---|
4120 | #D-* Purpose: encapsulate ncwa call so as to manage error code and retry |
---|
4121 | #D-* Examples: |
---|
4122 | #D- |
---|
4123 | function IGCM_sys_ncwa { |
---|
4124 | IGCM_debug_PushStack "IGCM_sys_ncwa" $@ |
---|
4125 | if ( $DEBUG_sys ) ; then |
---|
4126 | echo "IGCM_sys_ncwa :" $@ |
---|
4127 | fi |
---|
4128 | |
---|
4129 | typeset NB_ESSAI DELAI status i |
---|
4130 | # number of tentative |
---|
4131 | NB_ESSAI=3 |
---|
4132 | # time delay between tentative |
---|
4133 | DELAI=2 |
---|
4134 | |
---|
4135 | i=0 |
---|
4136 | while [ $i -lt $NB_ESSAI ] ; do |
---|
4137 | ncwa -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4138 | status=$? |
---|
4139 | if [ ${status} -gt 0 ] ; then |
---|
4140 | IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}" |
---|
4141 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4142 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4143 | IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
4144 | sleep $DELAI |
---|
4145 | else |
---|
4146 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4147 | break |
---|
4148 | fi |
---|
4149 | (( i = i + 1 )) |
---|
4150 | done |
---|
4151 | |
---|
4152 | if [ ${status} -gt 0 ] ; then |
---|
4153 | echo "IGCM_sys_ncwa : ncwa error" |
---|
4154 | IGCM_debug_Exit "ncwa" |
---|
4155 | fi |
---|
4156 | |
---|
4157 | IGCM_debug_PopStack "IGCM_sys_ncwa" |
---|
4158 | } |
---|
4159 | |
---|
4160 | ############################################################## |
---|
4161 | # CDO OPERATOR |
---|
4162 | |
---|
4163 | #D-#================================================== |
---|
4164 | #D-function IGCM_sys_cdo |
---|
4165 | #D-* Purpose: encapsulate cdo call so as to manage error code and retry |
---|
4166 | #D-* Examples: |
---|
4167 | #D- |
---|
4168 | function IGCM_sys_cdo { |
---|
4169 | IGCM_debug_PushStack "IGCM_sys_cdo" $@ |
---|
4170 | if ( $DEBUG_sys ) ; then |
---|
4171 | echo "IGCM_sys_cdo :" $@ |
---|
4172 | fi |
---|
4173 | |
---|
4174 | typeset status |
---|
4175 | |
---|
4176 | \cdo $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4177 | status=$? |
---|
4178 | if [ ${status} -gt 0 ] ; then |
---|
4179 | echo "IGCM_sys_cdo : error code ${status}" |
---|
4180 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4181 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4182 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
4183 | return 1 |
---|
4184 | else |
---|
4185 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
4186 | return 0 |
---|
4187 | fi |
---|
4188 | |
---|
4189 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
4190 | } |
---|
4191 | |
---|
4192 | # |
---|
4193 | + LC_ALL=C |
---|
4194 | + export LC_ALL |
---|
4195 | + JobType=RUN |
---|
4196 | + PackDefault=false |
---|
4197 | + BigBrother=false |
---|
4198 | + BigBrotherChannel=MAIL |
---|
4199 | + [ ! Xpost-processing '=' Xchecking ] |
---|
4200 | + echo |
---|
4201 | |
---|
4202 | + echo '====================================================' |
---|
4203 | ==================================================== |
---|
4204 | + hostname |
---|
4205 | + echo 'Where do we run ?' curie1751 |
---|
4206 | Where do we run ? curie1751 |
---|
4207 | + uname -a |
---|
4208 | Linux curie1751 2.6.32-696.30.1.el6.Bull.140.x86_64 #1 SMP Thu May 31 01:41:35 CEST 2018 x86_64 x86_64 x86_64 GNU/Linux |
---|
4209 | + echo '====================================================' |
---|
4210 | ==================================================== |
---|
4211 | + echo |
---|
4212 | |
---|
4213 | + [ XRUN '=' XDEB ] |
---|
4214 | + hostname -s |
---|
4215 | + [ ! Xpost-processing '=' Xchecking ] |
---|
4216 | + echo 'Source machine dependent settings for curie Intel X-64.' |
---|
4217 | Source machine dependent settings for curie Intel X-64. |
---|
4218 | + CENTER=TGCC |
---|
4219 | + SYSTEM=curie |
---|
4220 | + . /ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh |
---|
4221 | #!/bin/ksh |
---|
4222 | |
---|
4223 | #************************************************************** |
---|
4224 | # Author: Sebastien Denvil, Martial Mancip, Arnaud Caubel |
---|
4225 | # Contact: Arnaud.Caubel__at__lsce.ipsl.fr |
---|
4226 | # $Revision:: 1455 $ Revision of last commit |
---|
4227 | # $Author:: sdipsl $ Author of last commit |
---|
4228 | # $Date:: 2018-06-21 15:21:06 +0200 (Thu, 21 Jun 2018) $ Date of last commit |
---|
4229 | # IPSL (2006) |
---|
4230 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
4231 | # |
---|
4232 | #************************************************************** |
---|
4233 | |
---|
4234 | #========================================================= |
---|
4235 | # The documentation of this file can be automatically generated |
---|
4236 | # if you use the prefix #D- for comments to be extracted. |
---|
4237 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
4238 | #========================================================= |
---|
4239 | |
---|
4240 | #D-#================================================== |
---|
4241 | #D-LibIGCM_sys for Curie |
---|
4242 | #D-#================================================== |
---|
4243 | #D- |
---|
4244 | #D- This ksh library if a layer under some usefull |
---|
4245 | #D-environment variables and shell commands. |
---|
4246 | #D-All those definitions depend on host particularities. |
---|
4247 | #D-It manages a stack mechanism and test validity of operations. |
---|
4248 | #D-All function described bellow must be prefixed by IGCM_sys. |
---|
4249 | |
---|
4250 | #==================================================== |
---|
4251 | # libIGCM_sys PARAMETERS |
---|
4252 | #==================================================== |
---|
4253 | |
---|
4254 | #==================================================== |
---|
4255 | # set DEBUG_sys to true to output calls of function |
---|
4256 | typeset -r DEBUG_sys=${DEBUG_sys:=true} |
---|
4257 | |
---|
4258 | #==================================================== |
---|
4259 | # Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get) |
---|
4260 | typeset -r DRYRUN=${DRYRUN:=0} |
---|
4261 | |
---|
4262 | # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! |
---|
4263 | # ------------------------------------------------------------------------------------- |
---|
4264 | # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | |
---|
4265 | # | | Cp/Exe/param/files | | | | |
---|
4266 | # | | Chmod Qsub | | | | |
---|
4267 | # ------------------------------------------------------------------------------------- |
---|
4268 | # | 0 | yes | yes | yes | yes | |
---|
4269 | # ------------------------------------------------------------------------------------- |
---|
4270 | # | 1 | yes | yes | yes | no | |
---|
4271 | # ------------------------------------------------------------------------------------- |
---|
4272 | # | 2 | yes | yes | no | no | |
---|
4273 | # ------------------------------------------------------------------------------------- |
---|
4274 | # | 3 | yes | no | no | no | |
---|
4275 | # ------------------------------------------------------------------------------------- |
---|
4276 | |
---|
4277 | #===================================================== |
---|
4278 | # Global Variables : |
---|
4279 | #===================================================== |
---|
4280 | # Language : "fr" or "en" |
---|
4281 | typeset -r MYLANG="fr" |
---|
4282 | |
---|
4283 | #===================================================== |
---|
4284 | # Host user names project maxCpuTime |
---|
4285 | # $hostname ou hostname |
---|
4286 | typeset HOST=${HOST:=$( hostname )} |
---|
4287 | # $username ou whoami |
---|
4288 | typeset LOGIN=${LOGIN:=$( whoami )} |
---|
4289 | # $hostname of the MASTER job |
---|
4290 | typeset MASTER=curie |
---|
4291 | # add default project on curie |
---|
4292 | typeset PROJECT=$(echo ${BRIDGE_MSUB_PROJECT:=gen0826} | cut -d@ -f1 ) |
---|
4293 | # jobWarningDelay in seconds |
---|
4294 | typeset jobWarningDelay=${BRIDGE_MSUB_MAXTIME} |
---|
4295 | |
---|
4296 | #D- |
---|
4297 | #D-#================================================== |
---|
4298 | #D-Program used in libIGCM |
---|
4299 | #D-#================================================== |
---|
4300 | |
---|
4301 | # Submit command |
---|
4302 | typeset SUBMIT=${SUBMIT:=ccc_msub} |
---|
4303 | # rsync with path |
---|
4304 | typeset -r RSYNC=/usr/bin/rsync |
---|
4305 | # RSYNC_opt args to rsync |
---|
4306 | typeset -r RSYNC_opt="-va" |
---|
4307 | # ie storage filesystem |
---|
4308 | typeset -r STOREHOST=${MASTER} |
---|
4309 | typeset -r REMOTE_RSYNC=/usr/bin/rsync |
---|
4310 | |
---|
4311 | #==================================================== |
---|
4312 | # Set environment tools (ferret, nco, cdo, rebuild, ...) |
---|
4313 | #==================================================== |
---|
4314 | if [ X${TaskType} = Xcomputing ] ; then |
---|
4315 | IGCM_debug_Print 1 "Module will be loaded once we know the compiler version" |
---|
4316 | else |
---|
4317 | module purge > /dev/null 2>&1 |
---|
4318 | ##. /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_intel17.0.2_curie > /dev/null 2>&1 |
---|
4319 | . $( ccc_home -u igcmg)/MachineEnvironment/curie/env_intel17.0.2_curie > /dev/null 2>&1 |
---|
4320 | ##. /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_netcdf4.3.3.1_curie > /dev/null 2>&1 |
---|
4321 | . $( ccc_home -u igcmg)/MachineEnvironment/curie/env_netcdf4.3.3.1_curie > /dev/null 2>&1 |
---|
4322 | ##. /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_atlas_curie > /dev/null 2>&1 |
---|
4323 | . $( ccc_home -u igcmg)/MachineEnvironment/curie/env_atlas_curie > /dev/null 2>&1 |
---|
4324 | export PCMDI_MP=/ccc/work/cont003/igcmg/igcmg/PCMDI-MP |
---|
4325 | export UVCDAT_ANONYMOUS_LOG=FALSE |
---|
4326 | fi |
---|
4327 | |
---|
4328 | # Use CMIP6 storage space when using CMIP6 cpu ressources |
---|
4329 | [[ X"$( echo ${PROJECT} | grep cmip6 )" != "X" && ! $(module list --terse 2>&1 | grep dfldatadir/gencmip6) ]] && module switch dfldatadir dfldatadir/gencmip6 |
---|
4330 | |
---|
4331 | # FYI |
---|
4332 | [ ! X${TaskType} = Xchecking ] && IGCM_debug_Print 1 "List of loaded modules:" |
---|
4333 | [ ! X${TaskType} = Xchecking ] && module list |
---|
4334 | |
---|
4335 | # for rebuild, AddNoise and AddPertu3DOCE |
---|
4336 | export PATH=${PATH}:$(ccc_home -u igcmg)/Tools/curie/bin |
---|
4337 | ##export PATH=${PATH}:/ccc/cont003/home/igcmg/igcmg/Tools/curie/bin |
---|
4338 | |
---|
4339 | #==================================================== |
---|
4340 | # Specific for ocean additionnal diagnostic |
---|
4341 | export FER_GO="$FER_GO /home/cont003/p86denv/IGCM_POST_UTIL/JNL /home/cont003/p86denv/GRAF /home/cont003/p86denv/GRAF/GO" |
---|
4342 | export FER_PALETTE="$FER_PALETTE /home/cont003/p86denv/GRAF/PALET" |
---|
4343 | |
---|
4344 | #==================================================== |
---|
4345 | # Host specific DIRECTORIES |
---|
4346 | #==================================================== |
---|
4347 | |
---|
4348 | # ============ CESIUM START ============ # |
---|
4349 | |
---|
4350 | #==================================================== |
---|
4351 | #- Mirror libIGCM from titane to cesium if needed |
---|
4352 | #ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' ) |
---|
4353 | #if [ ! ${ROOTSYS} = "home" ] ; then |
---|
4354 | # typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true} |
---|
4355 | #else |
---|
4356 | # typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} |
---|
4357 | #fi |
---|
4358 | |
---|
4359 | #==================================================== |
---|
4360 | #- libIGCM_POST |
---|
4361 | #if ( ${MirrorlibIGCM} ) ; then |
---|
4362 | # PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) |
---|
4363 | # typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM |
---|
4364 | #else |
---|
4365 | # typeset -r libIGCM_POST=${libIGCM} |
---|
4366 | #fi |
---|
4367 | |
---|
4368 | # ============ CESIUM END ============ # |
---|
4369 | |
---|
4370 | #==================================================== |
---|
4371 | #- MirrorlibIGCM for frontend |
---|
4372 | typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} |
---|
4373 | |
---|
4374 | #==================================================== |
---|
4375 | #- libIGCM_POST for frontend |
---|
4376 | typeset -r libIGCM_POST=${libIGCM} |
---|
4377 | |
---|
4378 | #==================================================== |
---|
4379 | #- R_EXE (==> BIN_DIR = ${MODIPSL}/bin ) |
---|
4380 | typeset -r R_EXE="${MODIPSL}/bin" |
---|
4381 | |
---|
4382 | #==================================================== |
---|
4383 | #- SUBMIT_DIR : submission dir |
---|
4384 | typeset -x SUBMIT_DIR=${SUBMIT_DIR:=${BRIDGE_MSUB_PWD}} |
---|
4385 | |
---|
4386 | #==================================================== |
---|
4387 | #- IN |
---|
4388 | typeset -r R_IN=${R_IN:=/ccc/work/cont003/igcmg/igcmg/IGCM} |
---|
4389 | typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ccc/work/cont003/dsm/p24data} |
---|
4390 | |
---|
4391 | #==================================================== |
---|
4392 | #- RUN_DIR_PATH : Temporary working directory (=> TMP) |
---|
4393 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/RUN_DIR/${BRIDGE_MSUB_JOBID}_${$}} |
---|
4394 | |
---|
4395 | #==================================================== |
---|
4396 | #- OUTCOMMAND_PATH : tmp place to store command lines standard error and outputs |
---|
4397 | typeset -r OUTCOMMAND_PATH=/tmp |
---|
4398 | |
---|
4399 | #==================================================== |
---|
4400 | #- HOST_MPIRUN_COMMAND |
---|
4401 | typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time ccc_mprun -E-K1 "} |
---|
4402 | |
---|
4403 | #==================================================== |
---|
4404 | #- Max number of arguments passed to nco operator or demigration command |
---|
4405 | UNIX_MAX_LIMIT=360 |
---|
4406 | |
---|
4407 | #==================================================== |
---|
4408 | #- set PackDefault to true on curie |
---|
4409 | PackDefault=true |
---|
4410 | |
---|
4411 | #==================================================== |
---|
4412 | #- Default number of MPI task for IPSL coupled model |
---|
4413 | #- required for backward compatibility |
---|
4414 | #- |
---|
4415 | DEFAULT_NUM_PROC_OCE=5 |
---|
4416 | DEFAULT_NUM_PROC_CPL=1 |
---|
4417 | (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) |
---|
4418 | |
---|
4419 | #==================================================== |
---|
4420 | #- Number of computing cores per node |
---|
4421 | #- |
---|
4422 | NB_CORE_PER_NODE=16 |
---|
4423 | |
---|
4424 | #D-#================================================== |
---|
4425 | #D-function IGCM_sys_defineArchives |
---|
4426 | #D-* Purpose: |
---|
4427 | #D-* Define ARCHIVE : Dedicated to large files |
---|
4428 | #D-* Define STORAGE : Dedicated to small/medium files |
---|
4429 | #D-* Define R_OUT : Output tree located on ARCHIVE |
---|
4430 | #D-* Define R_FIG : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files) |
---|
4431 | #D-* Define R_BUF : Output tree located on SCRATCHDIR hosting files waiting for rebuild or pack processes |
---|
4432 | #D-* if SpaceName=TEST everything is stored on SCRATCHDIR |
---|
4433 | #D-* Examples: |
---|
4434 | #D- |
---|
4435 | function IGCM_sys_defineArchives { |
---|
4436 | IGCM_debug_PushStack "IGCM_sys_defineArchives" |
---|
4437 | |
---|
4438 | if [ ! X${config_UserChoices_ARCHIVE} = X ]; then |
---|
4439 | #==================================================== |
---|
4440 | #- ARCHIVE (dedicated to large files) |
---|
4441 | ARCHIVE=${config_UserChoices_ARCHIVE} |
---|
4442 | else |
---|
4443 | #==================================================== |
---|
4444 | #- ARCHIVE (dedicated to large files) |
---|
4445 | ARCHIVE=${CCCSTOREDIR} |
---|
4446 | fi |
---|
4447 | |
---|
4448 | if [ ! X${config_UserChoices_STORAGE} = X ]; then |
---|
4449 | #==================================================== |
---|
4450 | #- STORAGE (dedicated to small/medium files) |
---|
4451 | STORAGE=${config_UserChoices_STORAGE} |
---|
4452 | else |
---|
4453 | #==================================================== |
---|
4454 | #- STORAGE (dedicated to small/medium files) |
---|
4455 | STORAGE=${CCCWORKDIR} |
---|
4456 | fi |
---|
4457 | |
---|
4458 | if [ X${config_UserChoices_SpaceName} = XTEST ]; then |
---|
4459 | #==================================================== |
---|
4460 | #- R_OUT |
---|
4461 | R_OUT=${SCRATCHDIR}/IGCM_OUT |
---|
4462 | |
---|
4463 | #==================================================== |
---|
4464 | #- R_FIG (hosting figures : monitoring and atlas, and/or small files) |
---|
4465 | R_FIG=${SCRATCHDIR}/IGCM_OUT |
---|
4466 | |
---|
4467 | IGCM_debug_Print 1 "SpaceName=TEST ==> OVERRULE destination path directories" |
---|
4468 | |
---|
4469 | else |
---|
4470 | #==================================================== |
---|
4471 | #- R_OUT |
---|
4472 | R_OUT=${ARCHIVE}/IGCM_OUT |
---|
4473 | |
---|
4474 | #==================================================== |
---|
4475 | #- R_FIG (hosting figures : monitoring and atlas, and/or small files) |
---|
4476 | R_FIG=${STORAGE}/IGCM_OUT |
---|
4477 | fi |
---|
4478 | |
---|
4479 | #==================================================== |
---|
4480 | #- CMIP6 (hosting CMIP6 files produced by XIOS2 and configured by dr2xml) |
---|
4481 | CMIP6_BUF=${STORAGE}/IGCM_OUT |
---|
4482 | |
---|
4483 | #==================================================== |
---|
4484 | #- R_BUF (ONLY FOR double copy an scratch) |
---|
4485 | R_BUF=${SCRATCHDIR}/IGCM_OUT |
---|
4486 | |
---|
4487 | IGCM_debug_Print 1 "R_OUT has been defined = ${R_OUT}" |
---|
4488 | IGCM_debug_Print 1 "R_BUF has been defined = ${R_BUF}" |
---|
4489 | IGCM_debug_Print 1 "R_FIG has been defined = ${R_FIG}" |
---|
4490 | |
---|
4491 | IGCM_debug_PopStack "IGCM_sys_defineArchives" |
---|
4492 | } |
---|
4493 | |
---|
4494 | #D-#================================================== |
---|
4495 | #D-function IGCM_sys_RshArchive |
---|
4496 | #D-* Purpose: Archive rsh command |
---|
4497 | #D-* Examples: |
---|
4498 | #D- |
---|
4499 | function IGCM_sys_RshArchive { |
---|
4500 | IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ |
---|
4501 | /bin/ksh <<-EOF |
---|
4502 | ${@} |
---|
4503 | EOF |
---|
4504 | status=$? |
---|
4505 | if [ ${status} -gt 0 ] ; then |
---|
4506 | IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" |
---|
4507 | IGCM_debug_Exit "IGCM_sys_RshArchive" |
---|
4508 | fi |
---|
4509 | IGCM_debug_PopStack "IGCM_sys_RshArchive" |
---|
4510 | } |
---|
4511 | |
---|
4512 | #D-#================================================== |
---|
4513 | #D-function IGCM_sys_RshArchive_NoError |
---|
4514 | #D-* Purpose: Archive rsh command, without error |
---|
4515 | #D-* used only in monitoring.job |
---|
4516 | #D-* Examples: |
---|
4517 | #D- |
---|
4518 | function IGCM_sys_RshArchive_NoError { |
---|
4519 | IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@ |
---|
4520 | /bin/ksh <<-EOF |
---|
4521 | ${@} 2> /dev/null |
---|
4522 | EOF |
---|
4523 | IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError" |
---|
4524 | } |
---|
4525 | |
---|
4526 | #D-#================================================== |
---|
4527 | #D-function IGCM_sys_MkdirArchive |
---|
4528 | #D-* Purpose: Mkdir on Archive |
---|
4529 | #D-* Examples: |
---|
4530 | #D- |
---|
4531 | function IGCM_sys_MkdirArchive { |
---|
4532 | IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ |
---|
4533 | if ( $DEBUG_sys ) ; then |
---|
4534 | echo "IGCM_sys_MkdirArchive :" $@ |
---|
4535 | fi |
---|
4536 | #- creation de repertoire sur le serveur fichier |
---|
4537 | if [ ! -d ${1} ]; then |
---|
4538 | \mkdir -p $1 |
---|
4539 | status=$? |
---|
4540 | |
---|
4541 | if [ ${status} -gt 0 ] ; then |
---|
4542 | IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" |
---|
4543 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
4544 | fi |
---|
4545 | fi |
---|
4546 | IGCM_debug_PopStack "IGCM_sys_MkdirArchive" |
---|
4547 | } |
---|
4548 | |
---|
4549 | #D-#================================================== |
---|
4550 | #D-function IGCM_sys_TestDirArchive |
---|
4551 | #D-* Purpose: Test Directory that must exists on Archive |
---|
4552 | #D-* Examples: |
---|
4553 | #D- |
---|
4554 | function IGCM_sys_TestDirArchive { |
---|
4555 | IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ |
---|
4556 | if ( $DEBUG_sys ) ; then |
---|
4557 | echo "IGCM_sys_TestDirArchive :" $@ |
---|
4558 | fi |
---|
4559 | typeset ExistFlag |
---|
4560 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
4561 | IGCM_debug_PopStack "IGCM_sys_TestDirArchive" |
---|
4562 | return ${ExistFlag} |
---|
4563 | } |
---|
4564 | |
---|
4565 | #D-#================================================== |
---|
4566 | #D-function IGCM_sys_IsFileArchived |
---|
4567 | #D-* Purpose: Test file that must NOT EXISTS on Archive based on filename only |
---|
4568 | #D-* Examples: |
---|
4569 | #D- |
---|
4570 | function IGCM_sys_IsFileArchived { |
---|
4571 | IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ |
---|
4572 | if ( $DEBUG_sys ) ; then |
---|
4573 | echo "IGCM_sys_IsFileArchived :" $@ |
---|
4574 | fi |
---|
4575 | typeset IsArchivedFlag |
---|
4576 | IsArchivedFlag=$( [ X$( echo $@ | grep ^\/ccc\/store ) != X ] && echo 0 || echo 1 ) |
---|
4577 | IGCM_debug_PopStack "IGCM_sys_IsFileArchived" |
---|
4578 | |
---|
4579 | return ${IsArchivedFlag} |
---|
4580 | } |
---|
4581 | |
---|
4582 | #D-#================================================== |
---|
4583 | #D-function IGCM_sys_TestFileArchive |
---|
4584 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
4585 | #D-* Examples: |
---|
4586 | #D- |
---|
4587 | function IGCM_sys_TestFileArchive { |
---|
4588 | IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ |
---|
4589 | typeset ExistFlag |
---|
4590 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
4591 | IGCM_debug_PopStack "IGCM_sys_TestFileArchive" |
---|
4592 | |
---|
4593 | return ${ExistFlag} |
---|
4594 | } |
---|
4595 | |
---|
4596 | #D-#================================================== |
---|
4597 | #D-function IGCM_sys_CountFileArchive |
---|
4598 | #D-* Purpose: Count files on Archive filesystem |
---|
4599 | #D-* Examples: |
---|
4600 | #D- |
---|
4601 | function IGCM_sys_CountFileArchive { |
---|
4602 | IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ |
---|
4603 | ls ${@} 2>/dev/null | wc -l |
---|
4604 | if [ $? -gt 0 ] ; then |
---|
4605 | echo "IGCM_sys_CountFileArchive : erreur." |
---|
4606 | fi |
---|
4607 | IGCM_debug_PopStack "IGCM_sys_CountFileArchive" |
---|
4608 | } |
---|
4609 | |
---|
4610 | #D-#================================================== |
---|
4611 | #D-function IGCM_sys_Tree |
---|
4612 | #D-* Purpose: Tree directories with files on ${ARCHIVE} |
---|
4613 | #D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT} |
---|
4614 | #D- |
---|
4615 | function IGCM_sys_Tree { |
---|
4616 | IGCM_debug_PushStack "IGCM_sys_Tree" $@ |
---|
4617 | if ( $DEBUG_sys ) ; then |
---|
4618 | echo "IGCM_sys_Tree :" $@ |
---|
4619 | fi |
---|
4620 | |
---|
4621 | \ls -lR ${@} |
---|
4622 | |
---|
4623 | IGCM_debug_PopStack "IGCM_sys_Tree" |
---|
4624 | } |
---|
4625 | |
---|
4626 | #D-#================================================== |
---|
4627 | #D-function IGCM_sys_Qsub |
---|
4628 | #D-* Purpose: Qsub new job |
---|
4629 | #D-* Examples: |
---|
4630 | #D- |
---|
4631 | function IGCM_sys_Qsub { |
---|
4632 | IGCM_debug_PushStack "IGCM_sys_Qsub" $@ |
---|
4633 | if ( $DEBUG_sys ) ; then |
---|
4634 | echo "IGCM_sys_Qsub :" $@ |
---|
4635 | fi |
---|
4636 | typeset options status |
---|
4637 | options="-o ${SUBMIT_DIR}/${Script_Output} -e ${SUBMIT_DIR}/${Script_Output}" |
---|
4638 | |
---|
4639 | /usr/bin/ccc_msub ${options} $1 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4640 | status=$? |
---|
4641 | |
---|
4642 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4643 | if [ ${status} -gt 0 ] ; then |
---|
4644 | IGCM_debug_Print 2 "IGCM_sys_Qsub ${options} $1 : error code ${status}" |
---|
4645 | IGCM_debug_Exit "IGCM_sys_Qsub" |
---|
4646 | else |
---|
4647 | JobID=$( gawk {'print $4'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ ) |
---|
4648 | fi |
---|
4649 | IGCM_debug_PopStack "IGCM_sys_Qsub" |
---|
4650 | } |
---|
4651 | |
---|
4652 | #D-#================================================== |
---|
4653 | #D-function IGCM_sys_QsubPost |
---|
4654 | #D-* Purpose: Qsub new job on scalaire |
---|
4655 | #D-* Examples: |
---|
4656 | #D- |
---|
4657 | function IGCM_sys_QsubPost { |
---|
4658 | IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ |
---|
4659 | if ( $DEBUG_sys ) ; then |
---|
4660 | echo "IGCM_sys_QsubPost :" $@ |
---|
4661 | fi |
---|
4662 | typeset options status |
---|
4663 | |
---|
4664 | # EASIER TO DO THIS INSTEAD OF DUPLICATING libIGCM_sys_curie.ksh |
---|
4665 | case $( hostname -s ) in |
---|
4666 | curie*) |
---|
4667 | options="-Q normal -A ${PROJECT} -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out";; |
---|
4668 | airain*) |
---|
4669 | options="-q ivybridge -A dsm -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out" |
---|
4670 | esac |
---|
4671 | |
---|
4672 | /usr/bin/ccc_msub ${options} ${libIGCM_POST}/$1.job > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4673 | status=$? |
---|
4674 | |
---|
4675 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4676 | if [ ${status} -gt 0 ] ; then |
---|
4677 | IGCM_debug_Print 2 "IGCM_sys_QsubPost ${options} ${libIGCM_POST}/$1.job : error code ${status}" |
---|
4678 | IGCM_debug_Exit "IGCM_sys_QsubPost" |
---|
4679 | else |
---|
4680 | JobID=$( gawk {'print $4'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ ) |
---|
4681 | fi |
---|
4682 | IGCM_debug_PopStack "IGCM_sys_QsubPost" |
---|
4683 | } |
---|
4684 | |
---|
4685 | #D-************************* |
---|
4686 | #D- File transfer functions |
---|
4687 | #D-************************* |
---|
4688 | #D- |
---|
4689 | |
---|
4690 | #D-#================================================== |
---|
4691 | #D-function IGCM_sys_RmRunDir |
---|
4692 | #D-* Purpose: rm tmpdir (dummy function most of the time batch |
---|
4693 | #D- scheduler will do the job) |
---|
4694 | #D-* Examples: |
---|
4695 | #D- |
---|
4696 | function IGCM_sys_RmRunDir { |
---|
4697 | IGCM_debug_PushStack "IGCM_sys_RmRunDir" $@ |
---|
4698 | if ( $DEBUG_sys ) ; then |
---|
4699 | echo "IGCM_sys_RmRunDir :" $@ |
---|
4700 | fi |
---|
4701 | |
---|
4702 | typeset status |
---|
4703 | |
---|
4704 | echo rm $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4705 | \rm $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4706 | status=$? |
---|
4707 | |
---|
4708 | if [ ${status} -gt 0 ] ; then |
---|
4709 | IGCM_debug_Print 1 "IGCM_sys_RmRunDir : rm error code is ${status}." |
---|
4710 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4711 | IGCM_debug_Exit "IGCM_sys_RmRunDir" |
---|
4712 | else |
---|
4713 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4714 | fi |
---|
4715 | IGCM_debug_PopStack "IGCM_sys_RmRunDir" |
---|
4716 | } |
---|
4717 | |
---|
4718 | #D-#================================================== |
---|
4719 | #D-function IGCM_sys_Put_Dir |
---|
4720 | #D-* Purpose: Copy a complete directory on $(ARCHIVE) |
---|
4721 | #D-* Examples: |
---|
4722 | #D- |
---|
4723 | function IGCM_sys_Put_Dir { |
---|
4724 | IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ |
---|
4725 | if ( $DEBUG_sys ) ; then |
---|
4726 | echo "IGCM_sys_Put_Dir :" $@ |
---|
4727 | fi |
---|
4728 | if [ $DRYRUN = 0 ]; then |
---|
4729 | if [ ! -d ${1} ] ; then |
---|
4730 | echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." |
---|
4731 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
4732 | return |
---|
4733 | fi |
---|
4734 | |
---|
4735 | typeset status |
---|
4736 | |
---|
4737 | # Only if we use rsync |
---|
4738 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
4739 | # |
---|
4740 | #USUAL WAY |
---|
4741 | \cp -r $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4742 | status=$? |
---|
4743 | |
---|
4744 | if [ ${status} -gt 0 ] ; then |
---|
4745 | IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" |
---|
4746 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4747 | IGCM_debug_Exit "IGCM_sys_Put_Dir" |
---|
4748 | else |
---|
4749 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4750 | fi |
---|
4751 | fi |
---|
4752 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
4753 | } |
---|
4754 | |
---|
4755 | #D-#================================================== |
---|
4756 | #D-function IGCM_sys_Get_Dir |
---|
4757 | #D-* Purpose: Copy a complete directory from ${ARCHIVE} |
---|
4758 | #D-* Examples: |
---|
4759 | #D- |
---|
4760 | function IGCM_sys_Get_Dir { |
---|
4761 | IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ |
---|
4762 | if ( $DEBUG_sys ) ; then |
---|
4763 | echo "IGCM_sys_Get_Dir :" $@ |
---|
4764 | fi |
---|
4765 | if [ $DRYRUN = 0 ]; then |
---|
4766 | typeset NB_ESSAI DELAI status i |
---|
4767 | # number of tentative |
---|
4768 | NB_ESSAI=3 |
---|
4769 | # time delay between tentative |
---|
4770 | DELAI=2 |
---|
4771 | |
---|
4772 | # |
---|
4773 | # USUAL WAY |
---|
4774 | # add 'ccc_hsm get' (to demigrate all offline files) to reduce time of this command : |
---|
4775 | ccc_hsm get -r $1 |
---|
4776 | |
---|
4777 | i=0 |
---|
4778 | while [ $i -lt $NB_ESSAI ] ; do |
---|
4779 | \cp -ur $1 $2 >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4780 | status=$? |
---|
4781 | if [ ${status} -gt 0 ] ; then |
---|
4782 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
4783 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." |
---|
4784 | sleep $DELAI |
---|
4785 | else |
---|
4786 | break |
---|
4787 | fi |
---|
4788 | (( i = i + 1 )) |
---|
4789 | done |
---|
4790 | |
---|
4791 | if [ ${status} -gt 0 ] ; then |
---|
4792 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" |
---|
4793 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4794 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
4795 | else |
---|
4796 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4797 | fi |
---|
4798 | fi |
---|
4799 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
4800 | } |
---|
4801 | |
---|
4802 | #D-#================================================== |
---|
4803 | #D-function IGCM_sys_Put_Rest |
---|
4804 | #D-* Purpose: Put computied restarts on ${ARCHIVE}. |
---|
4805 | #D- File and target directory must exist. |
---|
4806 | #D-* Examples: |
---|
4807 | #D- |
---|
4808 | function IGCM_sys_Put_Rest { |
---|
4809 | IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ |
---|
4810 | if ( $DEBUG_sys ) ; then |
---|
4811 | echo "IGCM_sys_Put_Rest :" $@ |
---|
4812 | fi |
---|
4813 | if [ $DRYRUN = 0 ]; then |
---|
4814 | if [ ! -f ${1} ] ; then |
---|
4815 | echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." |
---|
4816 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
4817 | fi |
---|
4818 | |
---|
4819 | typeset status |
---|
4820 | # |
---|
4821 | # USUAL WAY |
---|
4822 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4823 | status=$? |
---|
4824 | |
---|
4825 | # #RSYNC WITH NETWORK SSH CALL |
---|
4826 | # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4827 | # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4828 | |
---|
4829 | # #RSYNC WITH NFS USE |
---|
4830 | # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4831 | # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4832 | |
---|
4833 | # status=$? |
---|
4834 | # IGCM_sys_Rsync_out $status |
---|
4835 | |
---|
4836 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4837 | # (( status=status+$? )) |
---|
4838 | |
---|
4839 | if [ ${status} -gt 0 ] ; then |
---|
4840 | IGCM_debug_Print 2 "IGCM_sys_Put_Rest : cp failed error code ${status}" |
---|
4841 | [ -f ${1} ] && ls -l ${1} |
---|
4842 | [ -f ${2} ] && ls -l ${2} |
---|
4843 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
4844 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4845 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
4846 | else |
---|
4847 | |
---|
4848 | if [ X${JobType} = XRUN ] ; then |
---|
4849 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
4850 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
4851 | fi |
---|
4852 | |
---|
4853 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4854 | fi |
---|
4855 | fi |
---|
4856 | IGCM_debug_PopStack "IGCM_sys_Put_Rest" |
---|
4857 | } |
---|
4858 | |
---|
4859 | #D-#================================================== |
---|
4860 | #D-function IGCM_sys_Put_Out |
---|
4861 | #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly |
---|
4862 | #D-* Examples: |
---|
4863 | #D- |
---|
4864 | function IGCM_sys_Put_Out { |
---|
4865 | IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ |
---|
4866 | if ( $DEBUG_sys ) ; then |
---|
4867 | echo "IGCM_sys_Put_Out :" $@ |
---|
4868 | fi |
---|
4869 | |
---|
4870 | typeset NB_ESSAI DELAI status i exist skip |
---|
4871 | typeset fileDeviceNumberInHex directoryDeviceNumberInHex |
---|
4872 | |
---|
4873 | # number of tentative |
---|
4874 | NB_ESSAI=3 |
---|
4875 | # time delay between tentative |
---|
4876 | DELAI=2 |
---|
4877 | |
---|
4878 | if [ $DRYRUN = 0 ]; then |
---|
4879 | if [ ! -f ${1} ] ; then |
---|
4880 | echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." |
---|
4881 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
4882 | return 1 |
---|
4883 | fi |
---|
4884 | # |
---|
4885 | IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
4886 | # |
---|
4887 | exist=false |
---|
4888 | skip=false |
---|
4889 | if [ -f $2 ] ; then |
---|
4890 | IGCM_debug_Print 1 "$2 already exist" |
---|
4891 | ccc_hsm get $2 |
---|
4892 | exist=true |
---|
4893 | if [ "X$( diff $1 $2 )" = X ] ; then |
---|
4894 | IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" |
---|
4895 | skip=true |
---|
4896 | else |
---|
4897 | IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" |
---|
4898 | skip=false |
---|
4899 | fi |
---|
4900 | fi |
---|
4901 | # |
---|
4902 | if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then |
---|
4903 | IGCM_sys_Chmod u+w $2 |
---|
4904 | fi |
---|
4905 | |
---|
4906 | if [ X${skip} = Xfalse ] ; then |
---|
4907 | i=0 |
---|
4908 | while [ $i -lt $NB_ESSAI ] ; do |
---|
4909 | # Identify file system |
---|
4910 | fileDeviceNumberInHex=$( stat -c %d $1 ) |
---|
4911 | status=$? |
---|
4912 | if [ ${status} -gt 0 ] ; then |
---|
4913 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
4914 | fi |
---|
4915 | # Identify file system |
---|
4916 | directoryDeviceNumberInHex=$( stat -c %d $( dirname $2 ) ) |
---|
4917 | status=$? |
---|
4918 | if [ ${status} -gt 0 ] ; then |
---|
4919 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
4920 | fi |
---|
4921 | |
---|
4922 | if ( [ ${fileDeviceNumberInHex} -ne ${directoryDeviceNumberInHex} ] || [ X$3 = XNOMOVE ] ) ; then |
---|
4923 | # They are not on the same device. USUAL WAY |
---|
4924 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4925 | status=$? |
---|
4926 | else |
---|
4927 | # They are on the same device. NOT SO USUAL WAY |
---|
4928 | \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4929 | status=$? |
---|
4930 | fi |
---|
4931 | if [ ${status} -gt 0 ]; then |
---|
4932 | IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
4933 | IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." |
---|
4934 | [ -f ${1} ] && ls -l ${1} |
---|
4935 | [ -f ${2} ] && ls -l ${2} |
---|
4936 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
4937 | sleep $DELAI |
---|
4938 | else |
---|
4939 | break |
---|
4940 | fi |
---|
4941 | (( i = i + 1 )) |
---|
4942 | done |
---|
4943 | fi |
---|
4944 | |
---|
4945 | # #RSYNC WITH NETWORK SSH CALL |
---|
4946 | # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4947 | # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4948 | |
---|
4949 | # #RSYNC WITH NFS USE |
---|
4950 | # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4951 | # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
4952 | |
---|
4953 | # status=$? |
---|
4954 | # IGCM_sys_Rsync_out $status |
---|
4955 | |
---|
4956 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4957 | # (( status=status+$? )) |
---|
4958 | |
---|
4959 | if [ ${status} -gt 0 ] ; then |
---|
4960 | IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status}" |
---|
4961 | [ -f ${1} ] && ls -l ${1} |
---|
4962 | [ -f ${2} ] && ls -l ${2} |
---|
4963 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
4964 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4965 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
4966 | else |
---|
4967 | |
---|
4968 | if [ X${JobType} = XRUN ] ; then |
---|
4969 | if [ X${3} = X ] ; then |
---|
4970 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
4971 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
4972 | fi |
---|
4973 | fi |
---|
4974 | |
---|
4975 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
4976 | fi |
---|
4977 | fi |
---|
4978 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
4979 | return 0 |
---|
4980 | } |
---|
4981 | |
---|
4982 | #D-#================================================== |
---|
4983 | #D-function IGCM_sys_Get |
---|
4984 | #D-* Purpose: Get a file from ${ARCHIVE} |
---|
4985 | #D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX |
---|
4986 | #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ |
---|
4987 | function IGCM_sys_Get { |
---|
4988 | IGCM_debug_PushStack "IGCM_sys_Get" $@ |
---|
4989 | |
---|
4990 | typeset DEST dm_liste target file_work |
---|
4991 | typeset NB_ESSAI DELAI status i |
---|
4992 | |
---|
4993 | if ( $DEBUG_sys ) ; then |
---|
4994 | echo "IGCM_sys_Get :" $@ |
---|
4995 | fi |
---|
4996 | |
---|
4997 | # number of tentative |
---|
4998 | NB_ESSAI=3 |
---|
4999 | # time delay between tentative |
---|
5000 | DELAI=2 |
---|
5001 | |
---|
5002 | if [ $DRYRUN -le 2 ]; then |
---|
5003 | if [ X${1} = X'/l' ] ; then |
---|
5004 | eval set +A dm_liste \${${2}} |
---|
5005 | else |
---|
5006 | eval set +A dm_liste ${1} |
---|
5007 | fi |
---|
5008 | eval DEST=\${${#}} |
---|
5009 | ccc_hsm get ${dm_liste[*]} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5010 | status=$? |
---|
5011 | if [ ${status} -gt 0 ] ; then |
---|
5012 | echo "WARNING IGCM_sys_Get : error code ${status}" |
---|
5013 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5014 | echo "WARNING IGCM_sys_Get : will stop later if the cp fails." |
---|
5015 | fi |
---|
5016 | |
---|
5017 | #if [ ${status} -gt 0 ] ; then |
---|
5018 | # if [ ! "X$( grep "Lost dmusrcmd connection" ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ )" = "X" ] ; then |
---|
5019 | # cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5020 | # echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " |
---|
5021 | # sleep 30 |
---|
5022 | # echo "We try another time" |
---|
5023 | ## dmget ${dm_liste[*]} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5024 | # ccc_hsm get ${dm_liste[*]} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5025 | # status=$? |
---|
5026 | # if [ ${status} -gt 0 ] ; then |
---|
5027 | # echo "ERROR IGCM_sys_Get : again demigration error :" |
---|
5028 | # cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5029 | # IGCM_debug_Exit "IGCM_sys_Get" |
---|
5030 | # fi |
---|
5031 | # else |
---|
5032 | # echo "ERROR IGCM_sys_Get : demigration error :" |
---|
5033 | # cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5034 | # IGCM_debug_Exit "IGCM_sys_Get" |
---|
5035 | # fi |
---|
5036 | #fi |
---|
5037 | |
---|
5038 | # #RSYNC WITH NETWORK SSH CALL |
---|
5039 | # echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5040 | # ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5041 | |
---|
5042 | # #RSYNC WITH NFS USE |
---|
5043 | # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5044 | # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5045 | |
---|
5046 | # status=$? |
---|
5047 | # IGCM_sys_Rsync_out $status |
---|
5048 | |
---|
5049 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5050 | # (( status=status+$? )) |
---|
5051 | |
---|
5052 | #USUAL WAY |
---|
5053 | if [ X${1} = X'/l' ] ; then |
---|
5054 | for target in ${dm_liste[*]} ; do |
---|
5055 | local_file=$( basename ${target} ) |
---|
5056 | # test if the target file is present before the loop |
---|
5057 | IGCM_sys_TestFileArchive ${target} |
---|
5058 | status=$? |
---|
5059 | if [ ${status} -gt 0 ] ; then |
---|
5060 | echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ." |
---|
5061 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
5062 | else |
---|
5063 | i=0 |
---|
5064 | while [ $i -lt $NB_ESSAI ] ; do |
---|
5065 | #if [ X${DoLink} = Xtrue ] ; then |
---|
5066 | # \ln -s ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5067 | # status=$? |
---|
5068 | # else |
---|
5069 | # \cp ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5070 | # status=$? |
---|
5071 | #fi |
---|
5072 | \ln -s ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5073 | status=$? |
---|
5074 | if [ ${status} -gt 0 ]; then |
---|
5075 | IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
5076 | IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." |
---|
5077 | sleep $DELAI |
---|
5078 | else |
---|
5079 | break |
---|
5080 | fi |
---|
5081 | (( i = i + 1 )) |
---|
5082 | done |
---|
5083 | if [ ${status} -gt 0 ] ; then |
---|
5084 | echo "IGCM_sys_Get : error" |
---|
5085 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5086 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5087 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
5088 | else |
---|
5089 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5090 | fi |
---|
5091 | fi |
---|
5092 | done |
---|
5093 | else |
---|
5094 | i=0 |
---|
5095 | while [ $i -lt $NB_ESSAI ] ; do |
---|
5096 | \cp ${dm_liste} ${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
5097 | status=$? |
---|
5098 | if [ ${status} -gt 0 ]; then |
---|
5099 | IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
5100 | IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." |
---|
5101 | sleep $DELAI |
---|
5102 | else |
---|
5103 | break |
---|
5104 | fi |
---|
5105 | (( i = i + 1 )) |
---|
5106 | done |
---|
5107 | if [ ${status} -gt 0 ] ; then |
---|
5108 | echo "IGCM_sys_Get : error" |
---|
5109 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5110 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5111 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
5112 | else |
---|
5113 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
5114 | fi |
---|
5115 | fi |
---|
5116 | fi |
---|
5117 | IGCM_debug_PopStack "IGCM_sys_Get" |
---|
5118 | } |
---|
5119 | |
---|
5120 | #D-#================================================== |
---|
5121 | #D-function IGCM_sys_GetDate_Monitoring |
---|
5122 | #D-* Purpose: get the last year for which the monitoring has been computed |
---|
5123 | #D-* Examples: |
---|
5124 | #D- |
---|
5125 | function IGCM_sys_GetDate_Monitoring { |
---|
5126 | IGCM_debug_PushStack "IGCM_sys_GetDate_Monitoring" $@ |
---|
5127 | if ( $DEBUG_sys ) ; then |
---|
5128 | echo "IGCM_sys_GetDate_Monitoring :" $@ |
---|
5129 | fi |
---|
5130 | |
---|
5131 | eval ${2}=$( cdo showyear ${1} 2> /dev/null | gawk '{ print $NF }' ) |
---|
5132 | |
---|
5133 | IGCM_debug_PopStack "IGCM_sys_GetDate_Monitoring" |
---|
5134 | } |
---|
5135 | |
---|
5136 | #D-#================================================== |
---|
5137 | #D-function IGCM_sys_Dods_Rm |
---|
5138 | #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. |
---|
5139 | #D-* Examples: |
---|
5140 | #D- |
---|
5141 | function IGCM_sys_Dods_Rm { |
---|
5142 | if ( $DEBUG_sys ) ; then |
---|
5143 | echo "IGCM_sys_Dods_Rm :" $@ |
---|
5144 | fi |
---|
5145 | typeset status |
---|
5146 | if [ $DRYRUN = 0 ]; then |
---|
5147 | |
---|
5148 | # if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then |
---|
5149 | # echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ." |
---|
5150 | # echo "Nothing has been done." |
---|
5151 | # return |
---|
5152 | # fi |
---|
5153 | |
---|
5154 | if [ "$#" -eq 1 ]; then |
---|
5155 | $(ccc_home -u igcmg)/Tools/curie/bin/thredds_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 |
---|
5156 | ## /ccc/cont003/home/igcmg/igcmg/Tools/curie/bin/thredds_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 |
---|
5157 | status=$? |
---|
5158 | else |
---|
5159 | $(ccc_home -u igcmg)/Tools/curie/bin/thredds_rm public/${LOGIN}/${R_DODS} # > out_dods_rm 2>&1 |
---|
5160 | ## /ccc/cont003/home/igcmg/igcmg/Tools/curie/bin/thredds_rm public/${LOGIN}/${R_DODS} # > out_dods_rm 2>&1 |
---|
5161 | status=$? |
---|
5162 | fi |
---|
5163 | |
---|
5164 | # if [ ${status} -gt 0 ] ; then |
---|
5165 | # echo "IGCM_sys_Dods_Rm : error." |
---|
5166 | # cat out_dods_rm |
---|
5167 | # IGCM_debug_Exit "IGCM_sys_Dods_Rm" |
---|
5168 | # else |
---|
5169 | # rm out_dods_rm |
---|
5170 | # fi |
---|
5171 | |
---|
5172 | fi |
---|
5173 | return $status |
---|
5174 | } |
---|
5175 | |
---|
5176 | #D-#================================================== |
---|
5177 | #D-function IGCM_sys_Dods_Cp |
---|
5178 | #D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. |
---|
5179 | #D-* Examples: |
---|
5180 | #D- |
---|
5181 | function IGCM_sys_Dods_Cp { |
---|
5182 | if ( $DEBUG_sys ) ; then |
---|
5183 | echo "IGCM_sys_Dods_Cp :" $@ |
---|
5184 | fi |
---|
5185 | typeset status |
---|
5186 | if [ $DRYRUN = 0 ]; then |
---|
5187 | |
---|
5188 | # if [ ! -d ${R_SAVE}/${1} ] ; then |
---|
5189 | # echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ." |
---|
5190 | # echo "Nothing has been done." |
---|
5191 | # return |
---|
5192 | # fi |
---|
5193 | |
---|
5194 | $(ccc_home -u igcmg)/Tools/curie/bin/thredds_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 |
---|
5195 | ## /ccc/cont003/home/igcmg/igcmg/Tools/curie/bin/thredds_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 |
---|
5196 | status=$? |
---|
5197 | |
---|
5198 | # if [ ${status} -gt 0 ] ; then |
---|
5199 | # echo "IGCM_sys_Dods_Cp : error." |
---|
5200 | # cat out_dods_cp |
---|
5201 | # IGCM_debug_Exit "IGCM_sys_Dods_Cp" |
---|
5202 | # else |
---|
5203 | # rm out_dods_cp |
---|
5204 | # fi |
---|
5205 | |
---|
5206 | fi |
---|
5207 | return $status |
---|
5208 | } |
---|
5209 | |
---|
5210 | #D-#================================================== |
---|
5211 | #D-function IGCM_sys_Put_Dods |
---|
5212 | #D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. |
---|
5213 | #D-* Examples: |
---|
5214 | #D- |
---|
5215 | function IGCM_sys_Put_Dods { |
---|
5216 | IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ |
---|
5217 | if ( $DEBUG_sys ) ; then |
---|
5218 | echo "IGCM_sys_Put_Dods :" $@ |
---|
5219 | fi |
---|
5220 | typeset status |
---|
5221 | if [ $DRYRUN = 0 ]; then |
---|
5222 | if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then |
---|
5223 | echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should." |
---|
5224 | echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} DOES NOT EXIST." |
---|
5225 | echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} DOES NOT EXIST." |
---|
5226 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
5227 | return |
---|
5228 | fi |
---|
5229 | |
---|
5230 | if ( [ -d ${R_SAVE}/${1} ] && [ -d ${R_FIGR}/${1} ] ) ; then |
---|
5231 | echo "WARNING IGCM_sys_Put_Dods : Both of the following directories exist. Exactly one should." |
---|
5232 | echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} EXISTS." |
---|
5233 | echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} EXISTS." |
---|
5234 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
5235 | return |
---|
5236 | fi |
---|
5237 | # |
---|
5238 | if [ -d ${R_SAVE}/${1} ] ; then |
---|
5239 | cd ${R_SAVE} |
---|
5240 | elif [ -d ${R_FIGR}/${1} ] ; then |
---|
5241 | cd ${R_FIGR} |
---|
5242 | fi |
---|
5243 | |
---|
5244 | IGCM_sys_Dods_Rm ${1} |
---|
5245 | IGCM_sys_Dods_Cp ${1} |
---|
5246 | status=0 |
---|
5247 | |
---|
5248 | if [ ${status} -gt 0 ] ; then |
---|
5249 | echo "IGCM_sys_Put_Dods : error." |
---|
5250 | IGCM_debug_Exit "IGCM_sys_Put_Dods" |
---|
5251 | fi |
---|
5252 | fi |
---|
5253 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
5254 | } |
---|
5255 | |
---|
5256 | ############################################################## |
---|
5257 | # REBUILD OPERATOR |
---|
5258 | |
---|
5259 | #D-#================================================== |
---|
5260 | #D-function IGCM_sys_sync |
---|
5261 | #D-* Purpose: flush buffer on disk |
---|
5262 | #D-* Examples: |
---|
5263 | #D- |
---|
5264 | function IGCM_sys_sync { |
---|
5265 | IGCM_debug_PushStack "IGCM_sys_sync" $@ |
---|
5266 | if ( $DEBUG_sys ) ; then |
---|
5267 | echo "IGCM_sys_sync :" $@ |
---|
5268 | fi |
---|
5269 | |
---|
5270 | /bin/sync |
---|
5271 | |
---|
5272 | IGCM_debug_PopStack "IGCM_sys_sync" |
---|
5273 | } |
---|
5274 | |
---|
5275 | ############################################################ |
---|
5276 | # Activate Running Environnment Variables |
---|
5277 | |
---|
5278 | #D-#================================================== |
---|
5279 | #D-function IGCM_sys_activ_variables |
---|
5280 | #D-* Purpose: set environement variables prior to execution |
---|
5281 | #D-* Examples: |
---|
5282 | #D- |
---|
5283 | function IGCM_sys_activ_variables { |
---|
5284 | IGCM_debug_PushStack "IGCM_sys_activ_variables" |
---|
5285 | if ( $DEBUG_sys ) ; then |
---|
5286 | echo "IGCM_sys_activ_variables" |
---|
5287 | fi |
---|
5288 | |
---|
5289 | # -------------------------------------------------------------------- |
---|
5290 | #D- MODULE specifications |
---|
5291 | # -------------------------------------------------------------------- |
---|
5292 | module purge > /dev/null 2>&1 |
---|
5293 | if [ X${compilerVersion} = XV17 ] ; then |
---|
5294 | . $(ccc_home -u igcmg)/MachineEnvironment/curie/env_intel17.0.2_curie > /dev/null 2>&1 |
---|
5295 | ##. /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_intel17.0.2_curie > /dev/null 2>&1 |
---|
5296 | elif [ X${compilerVersion} = XV14 ] ; then |
---|
5297 | . $(ccc_home -u igcmg)/MachineEnvironment/curie/env_intel14.0.3_curie > /dev/null 2>&1 |
---|
5298 | ##. /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_intel14.0.3_curie > /dev/null 2>&1 |
---|
5299 | else |
---|
5300 | IGCM_debug_Exit "This compiler version is not yet supported : ${compilerVersion}" |
---|
5301 | fi |
---|
5302 | . $(ccc_home -u igcmg)/MachineEnvironment/curie/env_netcdf4.3.3.1_curie > /dev/null 2>&1 |
---|
5303 | ##. /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_netcdf4.3.3.1_curie > /dev/null 2>&1 |
---|
5304 | |
---|
5305 | # Keep track of this |
---|
5306 | [ ! X${TaskType} = Xchecking ] && IGCM_debug_Print 1 "List of loaded modules:" |
---|
5307 | [ ! X${TaskType} = Xchecking ] && module list |
---|
5308 | |
---|
5309 | # -------------------------------------------------------------------- |
---|
5310 | #D- MPI specifications |
---|
5311 | # -------------------------------------------------------------------- |
---|
5312 | |
---|
5313 | # -------------------------------------------------------------------- |
---|
5314 | #D- Other specifications |
---|
5315 | # -------------------------------------------------------------------- |
---|
5316 | |
---|
5317 | ulimit -s unlimited |
---|
5318 | |
---|
5319 | IGCM_debug_PopStack "IGCM_sys_activ_variables" |
---|
5320 | } |
---|
5321 | |
---|
5322 | ############################################################ |
---|
5323 | # Desactivate Running Environnment Variables |
---|
5324 | |
---|
5325 | #D-#================================================== |
---|
5326 | #D-function IGCM_sys_desactiv_variables |
---|
5327 | #D-* Purpose: unset environement variables after execution |
---|
5328 | #D-* Examples: |
---|
5329 | #D- |
---|
5330 | function IGCM_sys_desactiv_variables { |
---|
5331 | IGCM_debug_PushStack "IGCM_sys_desactiv_variables" |
---|
5332 | if ( $DEBUG_sys ) ; then |
---|
5333 | echo "IGCM_sys_desactiv_variables" |
---|
5334 | fi |
---|
5335 | # -------------------------------------------------------------------- |
---|
5336 | #D- MPI specifications |
---|
5337 | # -------------------------------------------------------------------- |
---|
5338 | |
---|
5339 | # -------------------------------------------------------------------- |
---|
5340 | #D- Other specifications |
---|
5341 | # -------------------------------------------------------------------- |
---|
5342 | |
---|
5343 | IGCM_debug_PopStack "IGCM_sys_desactiv_variables" |
---|
5344 | } |
---|
5345 | |
---|
5346 | ############################################################ |
---|
5347 | # Update job headers to be used by the scheduler |
---|
5348 | |
---|
5349 | #D-#================================================== |
---|
5350 | #D-function IGCM_sys_updateHeaders |
---|
5351 | #D-* Purpose: Update job headers to be used by the scheduler |
---|
5352 | #D-* Examples: IGCM_sys_updateHeaders /path/to/Job_MYEXP |
---|
5353 | #D- |
---|
5354 | function IGCM_sys_updateHeaders { |
---|
5355 | IGCM_debug_PushStack "IGCM_sys_updateHeaders" |
---|
5356 | if ( $DEBUG_sys ) ; then |
---|
5357 | echo "IGCM_sys_updateHeaders" |
---|
5358 | fi |
---|
5359 | typeset file |
---|
5360 | file=$1 |
---|
5361 | |
---|
5362 | if [ ${executionType} -eq 1 ] ; then |
---|
5363 | # MPMD + MPI |
---|
5364 | sed -e "/::openMPthreads::/d" \ |
---|
5365 | -e "s/::JobNumProcTot::/${coreNumber}/" \ |
---|
5366 | -e "/#MSUB -x/d" \ |
---|
5367 | -e "/--cpu_bind=none/d" \ |
---|
5368 | ${file} > ${file}.tmp |
---|
5369 | |
---|
5370 | elif [ ${executionType} -eq 2 ] ; then |
---|
5371 | # MPMD + MPI + OMP : mpirun/ccc_mprun/error |
---|
5372 | if ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "X" ] || [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xmpirun" ] ) ; then |
---|
5373 | sed -e "/::openMPthreads::/d" \ |
---|
5374 | -e "s/::JobNumProcTot::/${coreNumber}/" \ |
---|
5375 | ${file} > ${file}.tmp |
---|
5376 | elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xccc_mprun" ] ) ; then |
---|
5377 | sed -e "/::openMPthreads::/d" \ |
---|
5378 | -e "s/::JobNumProcTot::/${coreNumber}/" \ |
---|
5379 | -e "/--cpu_bind=none/d" \ |
---|
5380 | ${file} > ${file}.tmp |
---|
5381 | else |
---|
5382 | IGCM_debug_Print 1 "You have to set ExecutionModeOnCurie=ccc_mprun or mpirun in config.card" |
---|
5383 | IGCM_debug_Exit "IGCM_sys_updateHeaders" |
---|
5384 | fi |
---|
5385 | elif [ ${executionType} -eq 3 ] ; then |
---|
5386 | # SPMD + MPI/OMP |
---|
5387 | sed -e "s/::openMPthreads::/${openMPthreads}/" \ |
---|
5388 | -e "s/::JobNumProcTot::/${mpiTasks}/" \ |
---|
5389 | -e "/#MSUB -x/d" \ |
---|
5390 | -e "/--cpu_bind=none/d" \ |
---|
5391 | ${file} > ${file}.tmp |
---|
5392 | |
---|
5393 | elif [ ${executionType} -eq 4 ] ; then |
---|
5394 | # SPMD + MPI only |
---|
5395 | sed -e "s/::JobNumProcTot::/${mpiTasks}/" \ |
---|
5396 | -e "/::openMPthreads::/d" \ |
---|
5397 | -e "/#MSUB -x/d" \ |
---|
5398 | -e "/--cpu_bind=none/d" \ |
---|
5399 | ${file} > ${file}.tmp |
---|
5400 | |
---|
5401 | elif [ ${executionType} -eq 5 ] ; then |
---|
5402 | # SPMD + OMP only |
---|
5403 | sed -e "s/::openMPthreads::/${openMPthreads}/" \ |
---|
5404 | -e "/::JobNumProcTot::/d" \ |
---|
5405 | -e "/#MSUB -x/d" \ |
---|
5406 | -e "/--cpu_bind=none/d" \ |
---|
5407 | ${file} > ${file}.tmp |
---|
5408 | |
---|
5409 | elif [ ${executionType} -eq 6 ] ; then |
---|
5410 | # SEQUENTIAL THEN |
---|
5411 | sed -e "s/::JobNumProcTot::/1/" \ |
---|
5412 | -e "/::openMPthreads::/d" \ |
---|
5413 | -e "/#MSUB -x/d" \ |
---|
5414 | -e "/--cpu_bind=none/d" \ |
---|
5415 | ${file} > ${file}.tmp |
---|
5416 | |
---|
5417 | fi |
---|
5418 | |
---|
5419 | IGCM_sys_Mv ${file}.tmp ${file} |
---|
5420 | |
---|
5421 | IGCM_debug_PopStack "IGCM_sys_updateHeaders" |
---|
5422 | } |
---|
5423 | |
---|
5424 | ############################################################ |
---|
5425 | # Build MPI/OMP scripts run file (dummy function) |
---|
5426 | |
---|
5427 | #D-#================================================== |
---|
5428 | #D-function IGCM_sys_build_run_file |
---|
5429 | #D-* Purpose: build run file (deprecated) |
---|
5430 | #D-* Examples: |
---|
5431 | #D- |
---|
5432 | function IGCM_sys_build_run_file { |
---|
5433 | IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " |
---|
5434 | } |
---|
5435 | |
---|
5436 | ############################################################ |
---|
5437 | # Build MPI/OMP scripts |
---|
5438 | |
---|
5439 | #D-#================================================== |
---|
5440 | #D-function IGCM_sys_build_execution_scripts |
---|
5441 | #D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} |
---|
5442 | #D-* Examples: |
---|
5443 | #D- |
---|
5444 | function IGCM_sys_build_execution_scripts |
---|
5445 | { |
---|
5446 | IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ |
---|
5447 | if ( $DEBUG_sys ) ; then |
---|
5448 | echo "IGCM_sys_build_execution_scripts " $@ |
---|
5449 | fi |
---|
5450 | |
---|
5451 | EXECUTION=${HOST_MPIRUN_COMMAND} |
---|
5452 | |
---|
5453 | if ( ${OK_PARA_MPMD} ) ; then |
---|
5454 | |
---|
5455 | # MPMD mode |
---|
5456 | # 1 MPI only |
---|
5457 | # 2 MPI/OpenMP mpirun method |
---|
5458 | # 3 MPI/OpenMP ccc_mprun method |
---|
5459 | |
---|
5460 | if [ -f run_file ] ; then |
---|
5461 | IGCM_sys_Rm -f run_file |
---|
5462 | fi |
---|
5463 | touch run_file |
---|
5464 | |
---|
5465 | # case 1 : Only MPI (MPMD) |
---|
5466 | if ( ! ${OK_PARA_OMP} ) ; then |
---|
5467 | |
---|
5468 | # Build run_file |
---|
5469 | |
---|
5470 | # First loop on the components for the coupler ie oasis (only if oasis3) |
---|
5471 | # the coupler ie oasis3 must be the first one |
---|
5472 | for comp in ${config_ListOfComponents[*]} ; do |
---|
5473 | |
---|
5474 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
5475 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
5476 | |
---|
5477 | # for CPL component only |
---|
5478 | if [ "X${comp}" = "XCPL" ] && [ "X${ExeNameOut}" != X\"\" ] ; then |
---|
5479 | |
---|
5480 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
5481 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
5482 | echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file |
---|
5483 | fi |
---|
5484 | done |
---|
5485 | |
---|
5486 | # Then second loop on the components |
---|
5487 | for comp in ${config_ListOfComponents[*]} ; do |
---|
5488 | |
---|
5489 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
5490 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
5491 | |
---|
5492 | # Only if we really have an executable for the component and not the coupler ie oasis: |
---|
5493 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then |
---|
5494 | |
---|
5495 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
5496 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
5497 | echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file |
---|
5498 | fi |
---|
5499 | done |
---|
5500 | |
---|
5501 | EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" |
---|
5502 | |
---|
5503 | IGCM_sys_Chmod u+x run_file |
---|
5504 | if ( $DEBUG_sys ) ; then |
---|
5505 | echo "run_file contains : " |
---|
5506 | cat run_file |
---|
5507 | fi |
---|
5508 | |
---|
5509 | elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "X" ] || [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xmpirun" ] ) ; then |
---|
5510 | |
---|
5511 | # 2 MPI/OpenMP mpirun method |
---|
5512 | |
---|
5513 | # Use of mpirun instead of ccc_mprun |
---|
5514 | EXECUTION="time mpirun" |
---|
5515 | |
---|
5516 | # Hosts treatment |
---|
5517 | ${EXECUTION} hostname | sort | uniq > hosts.tmp |
---|
5518 | |
---|
5519 | i=0 |
---|
5520 | rm -f hosts rankfile |
---|
5521 | IGCM_debug_Print 1 "sys Curie, Hosts available :" |
---|
5522 | for nodes in `cat hosts.tmp` |
---|
5523 | do |
---|
5524 | host[$i]=$nodes |
---|
5525 | echo "${host[$i]}" >> hosts |
---|
5526 | IGCM_debug_Print 1 ${host[$i]} |
---|
5527 | i=$((i+1)) |
---|
5528 | done |
---|
5529 | rm -f hosts.tmp |
---|
5530 | |
---|
5531 | listnodes=${host[*]} |
---|
5532 | |
---|
5533 | EXECUTION="${EXECUTION} -hostfile hosts -rankfile rankfile" |
---|
5534 | |
---|
5535 | # Initialisation |
---|
5536 | rank=0 |
---|
5537 | current_core=0 |
---|
5538 | init_exec=n |
---|
5539 | |
---|
5540 | # Loop on the components |
---|
5541 | for comp in ${config_ListOfComponents[*]} ; do |
---|
5542 | |
---|
5543 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
5544 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
5545 | |
---|
5546 | # Not possible if oasis has an executable (i.e old version of oasis3) |
---|
5547 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" = "XCPL" ] ) ; then |
---|
5548 | IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version" |
---|
5549 | IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler" |
---|
5550 | IGCM_debug_Verif_Exit |
---|
5551 | fi |
---|
5552 | |
---|
5553 | # Only if we really have an executable for the component : |
---|
5554 | if [ "X${ExeNameOut}" != X\"\" ] ; then |
---|
5555 | |
---|
5556 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
5557 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
5558 | eval comp_proc_nod_loc=\${${comp}_PROC_NOD} |
---|
5559 | |
---|
5560 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
5561 | echo "" >> script_${ExeNameOut}.ksh |
---|
5562 | if [ ${comp_proc_omp_loc} -gt 1 ] ; then |
---|
5563 | |
---|
5564 | # Check if the number of threads is correct |
---|
5565 | case ${comp_proc_omp_loc} in |
---|
5566 | 2|4|8|16) |
---|
5567 | IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" |
---|
5568 | ;; |
---|
5569 | *) |
---|
5570 | IGCM_debug_Exit "ERROR with OMP parameters !" |
---|
5571 | IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" |
---|
5572 | IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible " |
---|
5573 | IGCM_debug_Verif_Exit |
---|
5574 | ;; |
---|
5575 | esac |
---|
5576 | echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh |
---|
5577 | echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh |
---|
5578 | echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh |
---|
5579 | echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh |
---|
5580 | fi |
---|
5581 | |
---|
5582 | #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
5583 | echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK )) " >> script_${ExeNameOut}.ksh |
---|
5584 | echo "MYMPIRANK=\$(printf '%3.3d\n' \${MYMPIRANK})" >> script_${ExeNameOut}.ksh |
---|
5585 | echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh |
---|
5586 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
5587 | |
---|
5588 | if [ ${init_exec} = y ] ; then |
---|
5589 | EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" |
---|
5590 | else |
---|
5591 | EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" |
---|
5592 | init_exec=y |
---|
5593 | fi |
---|
5594 | |
---|
5595 | # Build rankfile : method used to assign cores and nodes for the MPI process |
---|
5596 | # Ex : |
---|
5597 | #rank 0=curie5296 slot=0,1,2,3 |
---|
5598 | #rank 1=curie5296 slot=4,5,6,7 |
---|
5599 | # Example of final command : |
---|
5600 | # mpirun -hostfile hosts -rankfile rankfile -np 27 ./script_lmdz.x.ksh : -np 5 ./script_opa.xx.ksh |
---|
5601 | # with script_lmdz.x.ksh : |
---|
5602 | # #!/bin/ksh |
---|
5603 | #export KMP_STACKSIZE=3g |
---|
5604 | #export KMP_LIBRARY=turnaround |
---|
5605 | #export MKL_SERIAL=YES |
---|
5606 | #OMP_NUM_THREADS=4 |
---|
5607 | #./lmdz.x |
---|
5608 | if [ ${comp_proc_nod_loc} -gt 1 ] ; then |
---|
5609 | (( offset_comp_proc_loc = NB_CORE_PER_NODE / (comp_proc_mpi_loc / comp_proc_nod_loc) )) |
---|
5610 | else |
---|
5611 | (( offset_comp_proc_loc = comp_proc_omp_loc )) |
---|
5612 | fi |
---|
5613 | for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do |
---|
5614 | (( index_host = current_core / NB_CORE_PER_NODE )) |
---|
5615 | host_value=${host[${index_host}]} |
---|
5616 | (( slot = current_core % NB_CORE_PER_NODE )) |
---|
5617 | virg="," |
---|
5618 | string_final="" |
---|
5619 | for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do |
---|
5620 | string=$index$virg |
---|
5621 | string_final=$string_final$string |
---|
5622 | done |
---|
5623 | string_final=$( echo $string_final | sed "s/.$//" ) |
---|
5624 | echo "rank $rank=$host_value slot=$string_final" >> rankfile |
---|
5625 | (( rank = rank + 1 )) |
---|
5626 | (( current_core = current_core + offset_comp_proc_loc )) |
---|
5627 | done |
---|
5628 | fi |
---|
5629 | done |
---|
5630 | |
---|
5631 | elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xccc_mprun" ] ) ; then |
---|
5632 | |
---|
5633 | # 3 MPI/OpenMP ccc_mprun method |
---|
5634 | |
---|
5635 | # MPI-OpenMP (MPMD) |
---|
5636 | # example of run_file |
---|
5637 | # 71-8 env OMP_NUM_THREADS=8 ./script_lmdz.x.ksh |
---|
5638 | # 480-1 env OMP_NUM_THREADS=1 ./script_opa.xx.ksh |
---|
5639 | # 1-1 env OMP_NUM_THREADS=1 ./script_xios.x.ksh |
---|
5640 | |
---|
5641 | # Loop on the components |
---|
5642 | for comp in ${config_ListOfComponents[*]} ; do |
---|
5643 | |
---|
5644 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
5645 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
5646 | |
---|
5647 | # Not possible if oasis has an executable (i.e old version of oasis3) |
---|
5648 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" = "XCPL" ] ) ; then |
---|
5649 | IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version" |
---|
5650 | IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler" |
---|
5651 | IGCM_debug_Verif_Exit |
---|
5652 | fi |
---|
5653 | |
---|
5654 | # Only if we really have an executable for the component : |
---|
5655 | if [ "X${ExeNameOut}" != X\"\" ] ; then |
---|
5656 | |
---|
5657 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
5658 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
5659 | |
---|
5660 | # Build script files |
---|
5661 | |
---|
5662 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
5663 | echo "" >> script_${ExeNameOut}.ksh |
---|
5664 | if [ ${comp_proc_omp_loc} -gt 1 ] ; then |
---|
5665 | |
---|
5666 | # Check if the number of threads is correct |
---|
5667 | case ${comp_proc_omp_loc} in |
---|
5668 | 2|4|8|16) |
---|
5669 | IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" |
---|
5670 | ;; |
---|
5671 | *) |
---|
5672 | IGCM_debug_Exit "ERROR with OMP parameters !" |
---|
5673 | IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" |
---|
5674 | IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible " |
---|
5675 | IGCM_debug_Verif_Exit |
---|
5676 | ;; |
---|
5677 | esac |
---|
5678 | ### only for LMDZ? |
---|
5679 | echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh |
---|
5680 | echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh |
---|
5681 | echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh |
---|
5682 | echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh |
---|
5683 | |
---|
5684 | fi |
---|
5685 | |
---|
5686 | # to have out/err per process on different files |
---|
5687 | echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${SLURM_PROCID} 2>out_${ExeNameOut}.err.\${SLURM_PROCID}" >> script_${ExeNameOut}.ksh |
---|
5688 | #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
5689 | |
---|
5690 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
5691 | |
---|
5692 | # Complete run_file |
---|
5693 | |
---|
5694 | echo "${comp_proc_mpi_loc}-${comp_proc_omp_loc} env OMP_NUM_THREADS=${comp_proc_omp_loc} ./script_${ExeNameOut}.ksh " >>run_file |
---|
5695 | |
---|
5696 | fi |
---|
5697 | done |
---|
5698 | |
---|
5699 | ## variable added to stop after 60s instead of 600s by default. |
---|
5700 | ## This is used when no error comes from executables and when something stopped an executable without notice. |
---|
5701 | export SLURM_WAIT=60 |
---|
5702 | |
---|
5703 | ## module advised by TGCC (instead of 2 variables) |
---|
5704 | module load feature/bridge/heterogenous_mpmd |
---|
5705 | |
---|
5706 | # set EXECUTION for ccc_mprun case (similar to #1 : MPI only MPMD method) |
---|
5707 | |
---|
5708 | EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" |
---|
5709 | |
---|
5710 | IGCM_sys_Chmod u+x run_file |
---|
5711 | if ( $DEBUG_sys ) ; then |
---|
5712 | echo "run_file contains : " |
---|
5713 | cat run_file |
---|
5714 | fi |
---|
5715 | |
---|
5716 | else |
---|
5717 | |
---|
5718 | IGCM_debug_Print 1 "sys Curie : choose mpirun or ccc_mprun in config.card for ExecutionModeOnCurie" |
---|
5719 | |
---|
5720 | fi # 1 2 or 3 if ${OK_PARA_MPMD} |
---|
5721 | |
---|
5722 | else |
---|
5723 | # Only one executable (SPMD mode). |
---|
5724 | |
---|
5725 | for comp in ${config_ListOfComponents[*]} ; do |
---|
5726 | |
---|
5727 | # Only if we really have an executable for the component : |
---|
5728 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
5729 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then |
---|
5730 | |
---|
5731 | # Build script files |
---|
5732 | |
---|
5733 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
5734 | echo "" >> script_${ExeNameOut}.ksh |
---|
5735 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
5736 | |
---|
5737 | if ( ${OK_PARA_OMP} ) ; then |
---|
5738 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
5739 | echo "" >> script_${ExeNameOut}.ksh |
---|
5740 | echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh |
---|
5741 | echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh |
---|
5742 | echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh |
---|
5743 | echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh |
---|
5744 | fi |
---|
5745 | |
---|
5746 | if ( ${OK_PARA_MPI} ) ; then |
---|
5747 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
5748 | # Default : ccc_mprun used if nb_proc gt 1 |
---|
5749 | # to have out/err per process on different files |
---|
5750 | echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${SLURM_PROCID} 2>out_${ExeNameOut}.err.\${SLURM_PROCID}" >> script_${ExeNameOut}.ksh |
---|
5751 | #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
5752 | EXECUTION="${HOST_MPIRUN_COMMAND} -n ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" |
---|
5753 | else |
---|
5754 | # Default : ccc_mprun is NOT used if nb_proc eq 1 |
---|
5755 | # to have out/err per process on different files |
---|
5756 | echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh |
---|
5757 | #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
5758 | EXECUTION="/usr/bin/time ./script_${ExeNameOut}.ksh" |
---|
5759 | fi |
---|
5760 | |
---|
5761 | IGCM_debug_Print 1 "sys Curie : script_${ExeNameOut}.ksh contains" |
---|
5762 | cat script_${ExeNameOut}.ksh |
---|
5763 | |
---|
5764 | fi |
---|
5765 | |
---|
5766 | done |
---|
5767 | |
---|
5768 | fi # ${OK_PARA_MPMD} |
---|
5769 | |
---|
5770 | IGCM_debug_Print 1 "sys Curie : execution command is " |
---|
5771 | IGCM_debug_Print 1 "$EXECUTION" |
---|
5772 | |
---|
5773 | IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" |
---|
5774 | } |
---|
5775 | |
---|
5776 | #D-#================================================== |
---|
5777 | #D-function IGCM_sys_check_path |
---|
5778 | #D-* Purpose: check that RUN_DIR_PATH that will be removed on some machine |
---|
5779 | #D-* do not point to an important use directory. Stop immediately in that case. |
---|
5780 | #D-* Examples: |
---|
5781 | #D- |
---|
5782 | function IGCM_sys_check_path { |
---|
5783 | IGCM_debug_PushStack "IGCM_sys_check_path" |
---|
5784 | if ( $DEBUG_sys ) ; then |
---|
5785 | echo "IGCM_sys_check_path" |
---|
5786 | fi |
---|
5787 | |
---|
5788 | if ( [ X${RUN_DIR_PATH} = X${HOME} ] || [ X${RUN_DIR_PATH} = X${WORKDIR} ] || [ X${RUN_DIR_PATH} = X${SCRATCHDIR} ] || [ X${RUN_DIR_PATH} = X${CCCWORKDIR} ] || [ X${RUN_DIR_PATH} = X${CCCSTOREDIR} ] ) ; then |
---|
5789 | IGCM_debug_Print 1 "Variable RUN_DIR_PATH is pointing to an important directory : ${RUN_DIR_PATH}" |
---|
5790 | IGCM_debug_Print 1 "Please check the RUN_DIR_PATH definition in your Job : Job_${config_UserChoices_JobName}" |
---|
5791 | IGCM_debug_Exit "This will stop the job" |
---|
5792 | fi |
---|
5793 | IGCM_debug_PopStack "IGCM_sys_check_path" |
---|
5794 | } |
---|
5795 | |
---|
5796 | #D-#================================================== |
---|
5797 | #D-function IGCM_sys_check_quota |
---|
5798 | #D-* Purpose: check user quota. Stop the simulation if quota above 90% |
---|
5799 | #D-* Examples: |
---|
5800 | #D- |
---|
5801 | function IGCM_sys_check_quota { |
---|
5802 | IGCM_debug_PushStack "IGCM_sys_check_quota" |
---|
5803 | if ( $DEBUG_sys ) ; then |
---|
5804 | echo "IGCM_sys_check_quota" |
---|
5805 | fi |
---|
5806 | # Limit of quota (in %) |
---|
5807 | limit_quota=90 |
---|
5808 | |
---|
5809 | # Check of the volume |
---|
5810 | volume_quota=$(ccc_quota | grep ' scratch' | gawk '{print $2}') |
---|
5811 | volume_avail=$(ccc_quota | grep ' scratch' | gawk '{print $3}') |
---|
5812 | |
---|
5813 | if ( [ ! X${volume_quota} = X ] && [ ! ${volume_quota} = "-" ] ) ; then |
---|
5814 | |
---|
5815 | unit_avail=${volume_avail: -1} |
---|
5816 | unit_quota=${volume_quota: -1} |
---|
5817 | |
---|
5818 | if [ "${unit_quota}" = "*" ] ; then |
---|
5819 | IGCM_debug_Print 1 "Please, check your quota of volume on scratch" |
---|
5820 | IGCM_debug_Print 1 "More than 100% of your quota is used" |
---|
5821 | IGCM_debug_Print 1 "Use the ccc_quota command to check" |
---|
5822 | IGCM_debug_Print 1 "You must have more than 10% available to run" |
---|
5823 | IGCM_debug_Exit "Not enough space to run ! STOP HERE" |
---|
5824 | IGCM_debug_Verif_Exit |
---|
5825 | fi |
---|
5826 | |
---|
5827 | temp_avail=${volume_avail%%${volume_avail: -1}*} |
---|
5828 | temp_quota=${volume_quota%%${volume_quota: -1}*} |
---|
5829 | |
---|
5830 | if [ ! ${unit_avail} = ${unit_quota} ] ; then |
---|
5831 | |
---|
5832 | # Convertion |
---|
5833 | if [ ${volume_avail: -1} = "T" ] ; then |
---|
5834 | (( temp_avail = temp_avail * 1000000000000 )) |
---|
5835 | elif [ ${volume_avail: -1} = "G" ] ; then |
---|
5836 | (( temp_avail = temp_avail * 1000000000 )) |
---|
5837 | elif [ ${volume_avail: -1} = "M" ] ; then |
---|
5838 | (( temp_avail = temp_avail * 1000000 )) |
---|
5839 | elif [ ${volume_avail: -1} = "k" ] ; then |
---|
5840 | (( temp_avail = temp_avail * 1000 )) |
---|
5841 | else |
---|
5842 | (( temp_avail = volume_avail )) |
---|
5843 | fi |
---|
5844 | if [ ${volume_quota: -1} = "T" ] ; then |
---|
5845 | (( temp_quota = temp_quota * 1000000000000 )) |
---|
5846 | elif [ ${volume_quota: -1} = "G" ] ; then |
---|
5847 | (( temp_quota = temp_quota * 1000000000 )) |
---|
5848 | elif [ ${volume_quota: -1} = "M" ] ; then |
---|
5849 | (( temp_quota = temp_quota * 1000000 )) |
---|
5850 | elif [ ${volume_quota: -1} = "k" ] ; then |
---|
5851 | (( temp_quota = temp_quota * 1000 )) |
---|
5852 | else |
---|
5853 | (( temp_quota = volume_quota )) |
---|
5854 | fi |
---|
5855 | fi |
---|
5856 | |
---|
5857 | quota_volume=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc) |
---|
5858 | # echo "volume ratio is " $quota_volume |
---|
5859 | |
---|
5860 | if [ ${quota_volume} -ge ${limit_quota} ] ; then |
---|
5861 | IGCM_debug_Print 1 "Please, check your quota of volume on scratch" |
---|
5862 | IGCM_debug_Print 1 "${quota_volume}% of your quota is used" |
---|
5863 | IGCM_debug_Print 1 "Use the ccc_quota command to check" |
---|
5864 | IGCM_debug_Print 1 "You must have more than 10% available to run" |
---|
5865 | IGCM_debug_Exit "Not enough space to run ! STOP HERE" |
---|
5866 | IGCM_debug_Verif_Exit |
---|
5867 | fi |
---|
5868 | |
---|
5869 | fi |
---|
5870 | |
---|
5871 | # Check of the number of inodes |
---|
5872 | |
---|
5873 | inode_quota=$(ccc_quota | grep ' scratch' | gawk '{print $6}') |
---|
5874 | inode_avail=$(ccc_quota | grep ' scratch' | gawk '{print $7}') |
---|
5875 | |
---|
5876 | if ( [ ! X${inode_quota} = X ] && [ ! ${inode_quota} = "-" ] ) ; then |
---|
5877 | |
---|
5878 | unit_avail=${inode_avail: -1} |
---|
5879 | unit_quota=${inode_quota: -1} |
---|
5880 | |
---|
5881 | if [ "${unit_quota}" = "*" ] ; then |
---|
5882 | IGCM_debug_Print 1 "Please, check your quota of inode on scratch" |
---|
5883 | IGCM_debug_Print 1 "More than 100% of your quota is used" |
---|
5884 | IGCM_debug_Print 1 "Use the ccc_quota command to check" |
---|
5885 | IGCM_debug_Print 1 "You must have more than 10% available to run" |
---|
5886 | IGCM_debug_Exit "Not enough space to run ! STOP HERE" |
---|
5887 | IGCM_debug_Verif_Exit |
---|
5888 | fi |
---|
5889 | |
---|
5890 | temp_avail=${inode_avail%%${inode_avail: -1}*} |
---|
5891 | temp_quota=${inode_quota%%${inode_quota: -1}*} |
---|
5892 | |
---|
5893 | if [ ! ${unit_avail} = ${unit_quota} ] ; then |
---|
5894 | |
---|
5895 | # Convertion |
---|
5896 | if [ ${inode_avail: -1} = "T" ] ; then |
---|
5897 | (( temp_avail = temp_avail * 1000000000000 )) |
---|
5898 | elif [ ${inode_avail: -1} = "G" ] ; then |
---|
5899 | (( temp_avail = temp_avail * 1000000000 )) |
---|
5900 | elif [ ${inode_avail: -1} = "M" ] ; then |
---|
5901 | (( temp_avail = temp_avail * 1000000 )) |
---|
5902 | elif [ ${inode_avail: -1} = "k" ] ; then |
---|
5903 | (( temp_avail = temp_avail * 1000 )) |
---|
5904 | else |
---|
5905 | (( temp_avail = inode_avail )) |
---|
5906 | fi |
---|
5907 | |
---|
5908 | if [ ${inode_quota: -1} = "T" ] ; then |
---|
5909 | (( temp_quota = temp_quota * 1000000000000 )) |
---|
5910 | elif [ ${inode_quota: -1} = "G" ] ; then |
---|
5911 | (( temp_quota = temp_quota * 1000000000 )) |
---|
5912 | elif [ ${inode_quota: -1} = "M" ] ; then |
---|
5913 | (( temp_quota = temp_quota * 1000000 )) |
---|
5914 | elif [ ${inode_quota: -1} = "k" ] ; then |
---|
5915 | (( temp_quota = temp_quota * 1000 )) |
---|
5916 | else |
---|
5917 | (( temp_quota = inode_quota )) |
---|
5918 | fi |
---|
5919 | fi |
---|
5920 | quota_inode=$(echo "scale=2 ; $temp_quota/$temp_avail*100" | bc) |
---|
5921 | # echo "inode ratio is " $quota_inode |
---|
5922 | |
---|
5923 | if [ ${quota_inode} -ge ${limit_quota} ] ; then |
---|
5924 | IGCM_debug_Print 1 "Please, check your quota of inode on scratch" |
---|
5925 | IGCM_debug_Print 1 "${quota_inode}% of your quota is used" |
---|
5926 | IGCM_debug_Print 1 "Use the ccc_quota command to check" |
---|
5927 | IGCM_debug_Print 1 "You must have more than 10% available to run" |
---|
5928 | IGCM_debug_Exit "Not enough space to run ! STOP HERE" |
---|
5929 | IGCM_debug_Verif_Exit |
---|
5930 | fi |
---|
5931 | fi |
---|
5932 | IGCM_debug_PopStack "IGCM_sys_check_quota" |
---|
5933 | } |
---|
5934 | |
---|
5935 | #D-#================================================== |
---|
5936 | #D-function IGCM_sys_projectAccounting |
---|
5937 | #D-* Purpose: store project accounting information in a file |
---|
5938 | #D-* Examples: |
---|
5939 | #D- |
---|
5940 | function IGCM_sys_projectAccounting { |
---|
5941 | IGCM_debug_PushStack "IGCM_sys_projectAccounting" |
---|
5942 | if ( $DEBUG_sys ) ; then |
---|
5943 | echo "IGCM_sys_check_quota" |
---|
5944 | fi |
---|
5945 | |
---|
5946 | ssh curie91 /usr/bin/ccc_myproject > $1 |
---|
5947 | |
---|
5948 | IGCM_debug_PopStack "IGCM_sys_projectAccounting" |
---|
5949 | } |
---|
5950 | |
---|
5951 | #D-#================================================== |
---|
5952 | #D-function IGCM_sys_getJobSchedulerID |
---|
5953 | #D-* Purpose: Get the job ID during execution |
---|
5954 | #D-* Examples: IGCM_sys_getJobSchedulerID jobSchedulerID |
---|
5955 | #D- |
---|
5956 | function IGCM_sys_getJobSchedulerID { |
---|
5957 | IGCM_debug_PushStack "IGCM_sys_getJobSchedulerID" |
---|
5958 | if ( $DEBUG_sys ) ; then |
---|
5959 | echo "IGCM_sys_getJobSchedulerID" |
---|
5960 | fi |
---|
5961 | |
---|
5962 | eval ${1}=${BRIDGE_MSUB_JOBID} |
---|
5963 | |
---|
5964 | IGCM_debug_PopStack "IGCM_sys_getJobSchedulerID" |
---|
5965 | } |
---|
5966 | |
---|
5967 | #D-#================================================== |
---|
5968 | #D-function IGCM_sys_GetJobID |
---|
5969 | #D-* Purpose: Get the job ID from the JobName |
---|
5970 | #D-* Examples: IGCM_sys_GetJobID ${JobName} ${TargetUsr} JobID |
---|
5971 | #D- |
---|
5972 | function IGCM_sys_GetJobID { |
---|
5973 | IGCM_debug_PushStack "IGCM_sys_GetJobID" |
---|
5974 | if ( $DEBUG_sys ) ; then |
---|
5975 | echo "IGCM_sys_GetJobID" |
---|
5976 | fi |
---|
5977 | |
---|
5978 | # With -f option, the full job name is given in the last column |
---|
5979 | ID=$( ccc_mstat -f -u $2 | \ |
---|
5980 | gawk -v JobName=$1 '( $NF ~ JobName ) { print $1 }' ) |
---|
5981 | |
---|
5982 | eval ${3}=${ID} |
---|
5983 | IGCM_debug_PopStack "IGCM_sys_GetJobID" |
---|
5984 | } |
---|
5985 | |
---|
5986 | #D-#================================================== |
---|
5987 | #D-function IGCM_sys_CountJobInQueue |
---|
5988 | #D-* Purpose: Count number of users job |
---|
5989 | #D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun |
---|
5990 | #D- |
---|
5991 | function IGCM_sys_CountJobInQueue { |
---|
5992 | IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" |
---|
5993 | if ( $DEBUG_sys ) ; then |
---|
5994 | echo "IGCM_sys_CountJobInQueue" |
---|
5995 | fi |
---|
5996 | |
---|
5997 | # With -f option, the full job name is given in the last column |
---|
5998 | NbRun=$( ccc_mstat -f | gawk -v JobName=$1 'BEGIN { x=0 } ( $NF ~ JobName ) { x=x+1 } END { print x }' ) |
---|
5999 | |
---|
6000 | eval ${2}=${NbRun} |
---|
6001 | |
---|
6002 | IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" |
---|
6003 | } |
---|
6004 | |
---|
6005 | #D-#================================================== |
---|
6006 | #D-function IGCM_sys_ListJobInQueue |
---|
6007 | #D-* Purpose: Produce a list of users computing jobs (excluding post-processing) |
---|
6008 | #D-* Examples: IGCM_sys_ListJobInQueue ${User} JobNameList |
---|
6009 | #D- |
---|
6010 | function IGCM_sys_ListJobInQueue { |
---|
6011 | IGCM_debug_PushStack "IGCM_sys_ListJobInQueue" |
---|
6012 | if ( $DEBUG_sys ) ; then |
---|
6013 | echo "IGCM_sys_ListJobInQueue" |
---|
6014 | fi |
---|
6015 | |
---|
6016 | # With -f option, the full job name is given in the last column |
---|
6017 | set -A JobList $( ccc_mstat -f | gawk -v User=$1 \ |
---|
6018 | '( $2 == User && \ |
---|
6019 | $NF != /TS/ && \ |
---|
6020 | $NF !~ /PACK/ && \ |
---|
6021 | $NF !~ /REBUILD/ && \ |
---|
6022 | $NF !~ /pack/ ) \ |
---|
6023 | { print $NF }' | sed -e "s/\(.*\)\.[0-9]*/\1/" ) |
---|
6024 | |
---|
6025 | eval set -A ${2} ${JobList[*]} |
---|
6026 | |
---|
6027 | IGCM_debug_PopStack "IGCM_sys_ListJobInQueue" |
---|
6028 | } |
---|
6029 | |
---|
6030 | #D-#================================================== |
---|
6031 | #D-function IGCM_sys_atlas |
---|
6032 | #D-* Purpose: encapsulate atlas call so as to manage error code and curie specificity |
---|
6033 | #D-* Examples: |
---|
6034 | #D- |
---|
6035 | function IGCM_sys_atlas { |
---|
6036 | IGCM_debug_PushStack "IGCM_sys_atlas" $@ |
---|
6037 | if ( $DEBUG_sys ) ; then |
---|
6038 | echo "IGCM_sys_atlas :" $@ |
---|
6039 | fi |
---|
6040 | |
---|
6041 | typeset status |
---|
6042 | |
---|
6043 | \ccc_mprun atlas $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
6044 | status=$? |
---|
6045 | if [ ${status} -gt 0 ] ; then |
---|
6046 | echo "IGCM_sys_atlas : error code ${status}" |
---|
6047 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
6048 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
6049 | IGCM_debug_PopStack "IGCM_sys_atlas" |
---|
6050 | return 1 |
---|
6051 | else |
---|
6052 | IGCM_debug_PopStack "IGCM_sys_atlas" |
---|
6053 | return 0 |
---|
6054 | fi |
---|
6055 | |
---|
6056 | IGCM_debug_PopStack "IGCM_sys_atlas" |
---|
6057 | } |
---|
6058 | |
---|
6059 | #D-#================================================== |
---|
6060 | #D-function IGCM_sys_rebuild_nemo |
---|
6061 | #D-* Purpose: rebuild nemo parallel files with nemo specific rebuild on curie |
---|
6062 | #D-* Examples: |
---|
6063 | #D- |
---|
6064 | |
---|
6065 | function IGCM_sys_rebuild_nemo { |
---|
6066 | IGCM_debug_PushStack "IGCM_sys_rebuild_nemo" $@ |
---|
6067 | if ( $DEBUG_sys ) ; then |
---|
6068 | echo "IGCM_sys_rebuild_nemo :" $@ |
---|
6069 | fi |
---|
6070 | |
---|
6071 | $( ccc_home -u igcmg)/Tools/curie/bin/rebuild_nemo ${1} ${2} |
---|
6072 | |
---|
6073 | IGCM_debug_PopStack "IGCM_sys_rebuild_nemo" |
---|
6074 | } |
---|
6075 | |
---|
6076 | + DEBUG_sys=true |
---|
6077 | + typeset -r DEBUG_sys |
---|
6078 | + DRYRUN=0 |
---|
6079 | + typeset -r DRYRUN |
---|
6080 | + MYLANG=fr |
---|
6081 | + typeset -r MYLANG |
---|
6082 | + hostname |
---|
6083 | + HOST=curie1751 |
---|
6084 | + typeset HOST |
---|
6085 | + whoami |
---|
6086 | + LOGIN=oboucher |
---|
6087 | + typeset LOGIN |
---|
6088 | + MASTER=curie |
---|
6089 | + typeset MASTER |
---|
6090 | + echo dekcmip6@standard |
---|
6091 | + cut -d@ -f1 |
---|
6092 | + PROJECT=dekcmip6 |
---|
6093 | + typeset PROJECT |
---|
6094 | + jobWarningDelay=80000 |
---|
6095 | + typeset jobWarningDelay |
---|
6096 | + SUBMIT=ccc_msub |
---|
6097 | + typeset SUBMIT |
---|
6098 | + RSYNC=/usr/bin/rsync |
---|
6099 | + typeset -r RSYNC |
---|
6100 | + RSYNC_opt=-va |
---|
6101 | + typeset -r RSYNC_opt |
---|
6102 | + STOREHOST=curie |
---|
6103 | + typeset -r STOREHOST |
---|
6104 | + REMOTE_RSYNC=/usr/bin/rsync |
---|
6105 | + typeset -r REMOTE_RSYNC |
---|
6106 | + [ Xpost-processing '=' Xcomputing ] |
---|
6107 | + module purge |
---|
6108 | # only redirect module from stderr to stdout in interactive mode |
---|
6109 | # to avoid breaking non interactive session (scp, sftp, etc) |
---|
6110 | if [[ $- =~ i ]]; then |
---|
6111 | moduleraw() { eval `/usr/bin/tclsh /usr/share/modules-tcl/libexec/modulecmd.tcl ksh $*`; } |
---|
6112 | module() { moduleraw $* 2>&1 ; } |
---|
6113 | else |
---|
6114 | module() { eval `/usr/bin/tclsh /usr/share/modules-tcl/libexec/modulecmd.tcl ksh $*`; } |
---|
6115 | fi |
---|
6116 | |
---|
6117 | + [[ hvxB == ~(E)i ]] |
---|
6118 | # define function to switch between C and Tcl versions of Modules |
---|
6119 | switchml() { |
---|
6120 | # determine currently used module version |
---|
6121 | typeset currel=`module --version 2>&1 | grep -E '^(Modules|VERSION=)'` |
---|
6122 | if [[ "$currel" =~ 'Tcl' ]]; then |
---|
6123 | typeset mlver='Tcl' |
---|
6124 | typeset curpath='' |
---|
6125 | typeset curmanpath='' |
---|
6126 | elif [[ "$currel" =~ 'VERSION' ]]; then |
---|
6127 | typeset mlver='C' |
---|
6128 | typeset curpath='' |
---|
6129 | typeset curmanpath='' |
---|
6130 | fi |
---|
6131 | |
---|
6132 | # remove specific paths set by current module version |
---|
6133 | if [ -n "$PATH" -a "${curpath:-}" != '' ]; then |
---|
6134 | PATH=${PATH/:$curpath/} |
---|
6135 | PATH=${PATH/$curpath:/} |
---|
6136 | fi |
---|
6137 | if [ -n "$MANPATH" -a "${curmanpath:-}" != '' ]; then |
---|
6138 | MANPATH=${MANPATH/:$curmanpath/} |
---|
6139 | MANPATH=${MANPATH/$curmanpath:/} |
---|
6140 | fi |
---|
6141 | |
---|
6142 | # switch module version |
---|
6143 | if [ "$mlver" = 'Tcl' ]; then |
---|
6144 | if [ -d /usr/share/Modules/init ]; then |
---|
6145 | echo 'Switching to Modules C version' |
---|
6146 | source /usr/share/Modules/init/sh |
---|
6147 | else |
---|
6148 | echo 'Cannot find Modules C version' |
---|
6149 | return 1 |
---|
6150 | fi |
---|
6151 | else |
---|
6152 | echo 'Switching to Modules Tcl version' |
---|
6153 | source /usr/share/modules-tcl/init/ksh |
---|
6154 | fi |
---|
6155 | } |
---|
6156 | |
---|
6157 | # setup ENV variables to get module defined in sub-shells (works for 'sh' |
---|
6158 | # and 'ksh' in interactive mode and 'sh' (zsh-compat), 'bash' and 'ksh' |
---|
6159 | # (zsh-compat) in non-interactive mode. |
---|
6160 | ENV=/usr/share/modules-tcl/init/profile.sh; export ENV |
---|
6161 | + ENV=/usr/share/modules-tcl/init/profile.sh |
---|
6162 | + export ENV |
---|
6163 | BASH_ENV=/usr/share/modules-tcl/init/bash; export BASH_ENV |
---|
6164 | |
---|
6165 | + BASH_ENV=/usr/share/modules-tcl/init/bash |
---|
6166 | + export BASH_ENV |
---|
6167 | # setup FPATH to get module defined in 'ksh' interactive and non-interactive |
---|
6168 | # sub-shells. only set in ksh init script to avoid side effect default FPATH |
---|
6169 | # set for 'zsh' shell when it starts. |
---|
6170 | if [[ ! ":$FPATH:" =~ ':/usr/share/modules-tcl/init/ksh-functions:' ]]; then |
---|
6171 | FPATH+="${FPATH:+:}/usr/share/modules-tcl/init/ksh-functions"; export FPATH |
---|
6172 | fi |
---|
6173 | |
---|
6174 | + [[ ! :/usr/share/modules-tcl/init/ksh-functions: == ~(E):/usr/share/modules-tcl/init/ksh-functions: ]] |
---|
6175 | MODULESHOME=/usr/share/modules-tcl; export MODULESHOME |
---|
6176 | |
---|
6177 | + MODULESHOME=/usr/share/modules-tcl |
---|
6178 | + export MODULESHOME |
---|
6179 | if [[ ! ":$PATH:" =~ ':/usr/bin:' ]]; then |
---|
6180 | PATH=/usr/bin${PATH:+:}$PATH; export PATH |
---|
6181 | fi |
---|
6182 | |
---|
6183 | + [[ ! :/ccc/cont003/home/igcmg/igcmg/Tools/atlas:/ccc/cont003/home/igcmg/igcmg/Tools/fast:/ccc/products/ghostscript-9.04/default/bin:/ccc/products/netcdf-4.3.3.1_hdf5_parallel/default/bin:/ccc/products/ccc_python/2.7.12_201610/bin:/opt/mpi/bullxmpi/1.2.8.4/bin:/ccc/products/icc-17.0.2.174/default/17.0.2.174/bin/intel64:/ccc/cont003/home/igcmg/igcmg/Tools/fcm/bin:/ccc/cont003/home/igcmg/igcmg/Tools/curie/bin:/ccc/cont003/home/igcmg/igcmg/bin:/ccc/cont003/home/igcmg/igcmg/Tools/atlas:/ccc/cont003/home/igcmg/igcmg/Tools/fast:.:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/ccc/products/ccc_users_env/bin:/ccc/products/ifort-17.0.2.174/default/17.0.2.174/bin/intel64:/ccc/products/gsl-2.1/default/bin:/ccc/products/netcdf-utils-4.3.3.1_hdf5/default/bin:/ccc/products/cdo-1.6.7/netcdf-4.3.2_hdf5/bin:/ccc/products/ferret-6.9.3/default/bin:/ccc/cont003/home/igcmg/igcmg/Tools/curie/bin: == ~(E):/usr/bin: ]] |
---|
6184 | manpath=`manpath 2>/dev/null` |
---|
6185 | manpath 2>/dev/null |
---|
6186 | + manpath |
---|
6187 | + 2> /dev/null |
---|
6188 | + manpath=/ccc/products/ghostscript-9.04/default/share/man:/ccc/products/netcdf-4.3.3.1_hdf5_parallel/default/share/man:/ccc/products/ccc_python/2.7.12_201610/share/man:/opt/mpi/bullxmpi/1.2.8.4/man:/ccc/products/icc-17.0.2.174/default/17.0.2.174/man/common:/usr/local/share/man:/usr/share/man/en:/usr/share/man:/ccc/products/ccc_users_env/man/en:/ccc/products/ifort-17.0.2.174/default/17.0.2.174/man/common:/ccc/products/gsl-2.1/default/share/man:/ccc/products/netcdf-utils-4.3.3.1_hdf5/default/share/man |
---|
6189 | if [[ ! ":$manpath:" =~ ':/usr/share/man:' ]]; then |
---|
6190 | MANPATH=/usr/share/man${manpath:+:}$manpath; export MANPATH |
---|
6191 | fi |
---|
6192 | |
---|
6193 | + [[ ! :/ccc/products/ghostscript-9.04/default/share/man:/ccc/products/netcdf-4.3.3.1_hdf5_parallel/default/share/man:/ccc/products/ccc_python/2.7.12_201610/share/man:/opt/mpi/bullxmpi/1.2.8.4/man:/ccc/products/icc-17.0.2.174/default/17.0.2.174/man/common:/usr/local/share/man:/usr/share/man/en:/usr/share/man:/ccc/products/ccc_users_env/man/en:/ccc/products/ifort-17.0.2.174/default/17.0.2.174/man/common:/ccc/products/gsl-2.1/default/share/man:/ccc/products/netcdf-utils-4.3.3.1_hdf5/default/share/man: == ~(E):/usr/share/man: ]] |
---|
6194 | if [ "${MODULEPATH:-}" = '' ]; then |
---|
6195 | if [ -r /usr/share/modules-tcl/init/.modulespath ]; then |
---|
6196 | MODULEPATH=`sed -n 's/[ #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' \ |
---|
6197 | /usr/share/modules-tcl/init/.modulespath`; export MODULEPATH |
---|
6198 | else |
---|
6199 | MODULEPATH=; export MODULEPATH |
---|
6200 | fi |
---|
6201 | fi |
---|
6202 | |
---|
6203 | + [ /opt/Modules/default/modulefiles/applications:/opt/Modules/default/modulefiles/environment:/opt/Modules/default/modulefiles/tools:/opt/Modules/default/modulefiles/graphics:/opt/Modules/default/modulefiles/parallel:/opt/Modules/default/modulefiles/libraries:/opt/Modules/default/modulefiles/compilers '=' '' ] |
---|
6204 | if [ "${LOADEDMODULES:-}" = '' ]; then |
---|
6205 | LOADEDMODULES=; export LOADEDMODULES |
---|
6206 | fi |
---|
6207 | |
---|
6208 | + [ ccc:licsrv/standard:c/intel/17.0.2.174:licsrv/intel:c++/intel/17.0.2.174:fortran/intel/17.0.2.174:mkl/17.0.2.174:intel/17.0.2.174:mpi/bullxmpi/1.2.8.4:python/2.7.12:netcdf/4.3.3.1_hdf5_parallel:gsl/2.1:nco/4.4.8:cdo/1.6.7_netcdf-4.3.2_hdf5:ghostscript/9.04:ferret/6.9.3:datadir/gencmip6:dfldatadir/gencmip6 '=' '' ] |
---|
6209 | # initialize default environment if no environment loaded yet |
---|
6210 | if [ "$MODULEPATH" = '' -a "$LOADEDMODULES" = '' ]; then |
---|
6211 | # run default environment init |
---|
6212 | if [ -e /usr/share/modules-tcl/default/load/init.sh ]; then |
---|
6213 | source /usr/share/modules-tcl/default/load/init.sh |
---|
6214 | fi |
---|
6215 | # if session is interactive |
---|
6216 | if [[ $- =~ i ]]; then |
---|
6217 | # run interactive-specific env init if it exists |
---|
6218 | if [ -e /usr/share/modules-tcl/default/load/interactive.sh ]; then |
---|
6219 | source /usr/share/modules-tcl/default/load/interactive.sh |
---|
6220 | fi |
---|
6221 | else |
---|
6222 | # run non-interactive-specific env init if it exists |
---|
6223 | if [ -e /usr/share/modules-tcl/default/load/non-interactive.sh ]; then |
---|
6224 | source /usr/share/modules-tcl/default/load/non-interactive.sh |
---|
6225 | fi |
---|
6226 | fi |
---|
6227 | fi |
---|
6228 | + [ /opt/Modules/default/modulefiles/applications:/opt/Modules/default/modulefiles/environment:/opt/Modules/default/modulefiles/tools:/opt/Modules/default/modulefiles/graphics:/opt/Modules/default/modulefiles/parallel:/opt/Modules/default/modulefiles/libraries:/opt/Modules/default/modulefiles/compilers '=' '' -a ccc:licsrv/standard:c/intel/17.0.2.174:licsrv/intel:c++/intel/17.0.2.174:fortran/intel/17.0.2.174:mkl/17.0.2.174:intel/17.0.2.174:mpi/bullxmpi/1.2.8.4:python/2.7.12:netcdf/4.3.3.1_hdf5_parallel:gsl/2.1:nco/4.4.8:cdo/1.6.7_netcdf-4.3.2_hdf5:ghostscript/9.04:ferret/6.9.3:datadir/gencmip6:dfldatadir/gencmip6 '=' '' ] |
---|
6229 | + 1> /dev/null 2>& 1 |
---|
6230 | + ccc_home -u igcmg |
---|
6231 | + . /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_intel17.0.2_curie |
---|
6232 | + 1> /dev/null 2>& 1 |
---|
6233 | + ccc_home -u igcmg |
---|
6234 | + . /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_netcdf4.3.3.1_curie |
---|
6235 | + 1> /dev/null 2>& 1 |
---|
6236 | + ccc_home -u igcmg |
---|
6237 | + . /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/curie/env_atlas_curie |
---|
6238 | + 1> /dev/null 2>& 1 |
---|
6239 | + PCMDI_MP=/ccc/work/cont003/igcmg/igcmg/PCMDI-MP |
---|
6240 | + export PCMDI_MP |
---|
6241 | + UVCDAT_ANONYMOUS_LOG=FALSE |
---|
6242 | + export UVCDAT_ANONYMOUS_LOG |
---|
6243 | + echo dekcmip6 |
---|
6244 | + grep cmip6 |
---|
6245 | + [[ Xdekcmip6 != X ]] |
---|
6246 | + module list --terse |
---|
6247 | + 2>& 1 |
---|
6248 | + grep dfldatadir/gencmip6 |
---|
6249 | + [[ ! -n dfldatadir/gencmip6 ]] |
---|
6250 | + [ ! Xpost-processing '=' Xchecking ] |
---|
6251 | + IGCM_debug_Print 1 'List of loaded modules:' |
---|
6252 | 2018-07-27 12:34:15 --Debug1--> List of loaded modules: |
---|
6253 | + [ ! Xpost-processing '=' Xchecking ] |
---|
6254 | + module list |
---|
6255 | /usr/bin/tclsh /usr/share/modules-tcl/libexec/modulecmd.tcl ksh $* |
---|
6256 | + /usr/bin/tclsh /usr/share/modules-tcl/libexec/modulecmd.tcl ksh list |
---|
6257 | Currently Loaded Modulefiles: |
---|
6258 | 1) ccc 10) intel/17.0.2.174 |
---|
6259 | 2) datadir/gencmip6 11) mpi/bullxmpi/1.2.8.4(default) |
---|
6260 | 3) dfldatadir/gencmip6 12) python/2.7.12 |
---|
6261 | 4) licsrv/standard 13) netcdf/4.3.3.1_hdf5_parallel |
---|
6262 | 5) c/intel/17.0.2.174 14) gsl/2.1 |
---|
6263 | 6) licsrv/intel 15) nco/4.4.8 |
---|
6264 | 7) c++/intel/17.0.2.174 16) cdo/1.6.7_netcdf-4.3.2_hdf5 |
---|
6265 | 8) fortran/intel/17.0.2.174 17) ghostscript/9.04 |
---|
6266 | 9) mkl/17.0.2.174 18) ferret/6.9.3 |
---|
6267 | + eval |
---|
6268 | + ccc_home -u igcmg |
---|
6269 | + PATH=/ccc/cont003/home/igcmg/igcmg/Tools/atlas:/ccc/cont003/home/igcmg/igcmg/Tools/fast:/ccc/products/ghostscript-9.04/default/bin:/ccc/products/netcdf-4.3.3.1_hdf5_parallel/default/bin:/ccc/products/ccc_python/2.7.12_201610/bin:/opt/mpi/bullxmpi/1.2.8.4/bin:/ccc/products/icc-17.0.2.174/default/17.0.2.174/bin/intel64:/ccc/cont003/home/igcmg/igcmg/Tools/atlas:/ccc/cont003/home/igcmg/igcmg/Tools/fast:/ccc/cont003/home/igcmg/igcmg/Tools/fcm/bin:/ccc/cont003/home/igcmg/igcmg/Tools/curie/bin:/ccc/cont003/home/igcmg/igcmg/bin:/ccc/cont003/home/igcmg/igcmg/Tools/atlas:/ccc/cont003/home/igcmg/igcmg/Tools/fast:.:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/ccc/products/ccc_users_env/bin:/ccc/cont003/home/igcmg/igcmg/Tools/curie/bin:/ccc/products/ifort-17.0.2.174/default/17.0.2.174/bin/intel64:/ccc/products/gsl-2.1/default/bin:/ccc/products/netcdf-utils-4.3.3.1_hdf5/default/bin:/ccc/products/cdo-1.6.7/netcdf-4.3.2_hdf5/bin:/ccc/products/ferret-6.9.3/default/bin:/ccc/cont003/home/igcmg/igcmg/Tools/curie/bin |
---|
6270 | + export PATH |
---|
6271 | + FER_GO='/ccc/cont003/home/igcmg/igcmg/Tools/fast . /ccc/products/ferret-6.9.3/default/go /ccc/products/ferret-6.9.3/default/examples /ccc/products/ferret-6.9.3/default/contrib /ccc/cont003/home/igcmg/igcmg/Tools/atlas /home/cont003/p86denv/IGCM_POST_UTIL/JNL /home/cont003/p86denv/GRAF /home/cont003/p86denv/GRAF/GO' |
---|
6272 | + export FER_GO |
---|
6273 | + FER_PALETTE='. /ccc/products/ferret-6.9.3/default/ppl /ccc/cont003/home/igcmg/igcmg/Tools/fast /ccc/cont003/home/igcmg/igcmg/Tools/atlas /home/cont003/p86denv/GRAF/PALET' |
---|
6274 | + export FER_PALETTE |
---|
6275 | + MirrorlibIGCM=false |
---|
6276 | + typeset -r MirrorlibIGCM |
---|
6277 | + libIGCM_POST=/ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM |
---|
6278 | + typeset -r libIGCM_POST |
---|
6279 | + R_EXE=/bin |
---|
6280 | + typeset -r R_EXE |
---|
6281 | + SUBMIT_DIR=/ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030 |
---|
6282 | + typeset -x SUBMIT_DIR |
---|
6283 | + R_IN=/ccc/work/cont003/igcmg/igcmg/IGCM |
---|
6284 | + typeset -r R_IN |
---|
6285 | + R_IN_ECMWF=/ccc/work/cont003/dsm/p24data |
---|
6286 | + typeset -r R_IN_ECMWF |
---|
6287 | + RUN_DIR_PATH=/ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313 |
---|
6288 | + typeset -r RUN_DIR_PATH |
---|
6289 | + OUTCOMMAND_PATH=/tmp |
---|
6290 | + typeset -r OUTCOMMAND_PATH |
---|
6291 | + HOST_MPIRUN_COMMAND='/usr/bin/time ccc_mprun -E-K1 ' |
---|
6292 | + typeset -r HOST_MPIRUN_COMMAND |
---|
6293 | + UNIX_MAX_LIMIT=360 |
---|
6294 | + PackDefault=true |
---|
6295 | + DEFAULT_NUM_PROC_OCE=5 |
---|
6296 | + DEFAULT_NUM_PROC_CPL=1 |
---|
6297 | + (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) |
---|
6298 | + NB_CORE_PER_NODE=16 |
---|
6299 | + umask 0022 |
---|
6300 | + false |
---|
6301 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
6302 | + . /ccc/cont003/dsku/perle2/home/app/gencmip6/oboucher/IPSLCM613/modipsl/libIGCM/libIGCM_config/libIGCM_config.ksh |
---|
6303 | #!/bin/ksh |
---|
6304 | |
---|
6305 | #************************************************************** |
---|
6306 | # Author: Sebastien Denvil, Martial Mancip |
---|
6307 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr Martial.Mancip__at__ipsl.jussieu.fr |
---|
6308 | # $Revision:: 1431 $ Revision of last commit |
---|
6309 | # $Author:: sdipsl $ Author of last commit |
---|
6310 | # $Date:: 2018-03-20 16:34:45 +0100 (Tue, 20 Mar 2018) $ Date of last commit |
---|
6311 | # IPSL (2006) |
---|
6312 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
6313 | # |
---|
6314 | #************************************************************** |
---|
6315 | |
---|
6316 | #=================================== |
---|
6317 | function IGCM_config_CommonConfiguration |
---|
6318 | { |
---|
6319 | IGCM_debug_PushStack "IGCM_config_CommonConfiguration" $@ |
---|
6320 | |
---|
6321 | # Debug Print : |
---|
6322 | [ ${Verbosity} -gt 0 ] && echo |
---|
6323 | IGCM_debug_Print 1 "IGCM_config_CommonConfiguration" $@ |
---|
6324 | |
---|
6325 | # config.card path |
---|
6326 | configCardPath=$1 |
---|
6327 | |
---|
6328 | #================================== |
---|
6329 | typeset option auxprint |
---|
6330 | |
---|
6331 | #================================== |
---|
6332 | # Read UserChoices section: |
---|
6333 | [ ${Verbosity} -gt 0 ] && echo |
---|
6334 | IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" |
---|
6335 | |
---|
6336 | IGCM_card_DefineArrayFromSection ${configCardPath} UserChoices |
---|
6337 | for option in ${config_UserChoices[*]} ; do |
---|
6338 | IGCM_card_DefineVariableFromOption ${configCardPath} UserChoices ${option} |
---|
6339 | eval auxprint=\${config_UserChoices_${option}} |
---|
6340 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
6341 | done |
---|
6342 | |
---|
6343 | #================================== |
---|
6344 | # Read Ensemble section: |
---|
6345 | [ ${Verbosity} -gt 0 ] && echo |
---|
6346 | IGCM_debug_Print 1 "DefineArrayFromOption : config_Ensemble" |
---|
6347 | |
---|
6348 | IGCM_card_DefineArrayFromSection ${configCardPath} Ensemble |
---|
6349 | for option in ${config_Ensemble[*]} ; do |
---|
6350 | IGCM_card_DefineVariableFromOption ${configCardPath} Ensemble ${option} |
---|
6351 | eval auxprint=\${config_Ensemble_${option}} |
---|
6352 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
6353 | done |
---|
6354 | |
---|
6355 | #================================== |
---|
6356 | # Read Post section: |
---|
6357 | [ ${Verbosity} -gt 0 ] && echo |
---|
6358 | IGCM_debug_Print 1 "DefineArrayFromOption : config_Post" |
---|
6359 | |
---|
6360 | IGCM_card_DefineArrayFromSection ${configCardPath} Post |
---|
6361 | for option in ${config_Post[*]} ; do |
---|
6362 | IGCM_card_DefineVariableFromOption ${configCardPath} Post ${option} |
---|
6363 | eval auxprint=\${config_Post_${option}} |
---|
6364 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
6365 | done |
---|
6366 | [ ${Verbosity} -gt 0 ] && echo |
---|
6367 | |
---|
6368 | #================================== |
---|
6369 | # Define default value to keep compatibility with previous card: means before changes due to TGCC |
---|
6370 | # Apply some overrules to ensure proper usage of computing centres resources |
---|
6371 | # |
---|
6372 | if [ X${PackDefault} = Xtrue ] ; then |
---|
6373 | if [ X${config_UserChoices_SpaceName} = XTEST ]; then |
---|
6374 | # TEST simulations will not be packed and will stay on SCRATCHDIR filesystem |
---|
6375 | IGCM_debug_Print 1 "SpaceName=TEST. OVERRULE PackFrequency to NONE" |
---|
6376 | config_Post_PackFrequency=NONE |
---|
6377 | else |
---|
6378 | # Default to RebuildFrequency if nothing has been set up related to PackFrequency |
---|
6379 | [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency} |
---|
6380 | fi |
---|
6381 | else |
---|
6382 | # If we DO NOT apply pack in this computing center |
---|
6383 | config_Post_PackFrequency=NONE |
---|
6384 | fi |
---|
6385 | |
---|
6386 | #==================================================== |
---|
6387 | # Define ARCHIVE : Dedicated to large files |
---|
6388 | # Define STORAGE : Dedicated to small/medium files |
---|
6389 | # Define R_OUT : Output tree located on ARCHIVE |
---|
6390 | # Define R_BUF : Output tree located on STORAGE (files waiting treatment, or file lcoation when SpaceName=!PROD) |
---|
6391 | # Define R_FIG : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files) |
---|
6392 | # Define R_TMP : A temporary space used by IGCM_debug_send_AMQP_msg__MAILTUNNEL. Must be persistent in between jobs |
---|
6393 | IGCM_sys_defineArchives |
---|
6394 | |
---|
6395 | #==================================================== |
---|
6396 | # R_SAVE : Job output directory |
---|
6397 | # R_BUFR : Job output buffered directory |
---|
6398 | # R_CMIP : Job output directory for CMIP6 standard files |
---|
6399 | |
---|
6400 | if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then |
---|
6401 | FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) |
---|
6402 | if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then |
---|
6403 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName} |
---|
6404 | R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName} |
---|
6405 | R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName} |
---|
6406 | R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName} |
---|
6407 | R_CMIP=${CMIP6_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName} |
---|
6408 | else |
---|
6409 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
6410 | R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
6411 | R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
6412 | R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
6413 | R_CMIP=${CMIP6_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
6414 | fi |
---|
6415 | else |
---|
6416 | if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then |
---|
6417 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName} |
---|
6418 | R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName} |
---|
6419 | R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName} |
---|
6420 | R_DODS=${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName} |
---|
6421 | else |
---|
6422 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
6423 | R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
6424 | R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
6425 | R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
6426 | fi |
---|
6427 | fi |
---|
6428 | |
---|
6429 | #==================================================== |
---|
6430 | # Define R_OUT_KSH : Storage place for job output |
---|
6431 | # Define R_OUT_EXE : Storage place for binary used during simulation |
---|
6432 | R_OUT_KSH=${R_SAVE}/Out |
---|
6433 | R_OUT_EXE=${R_SAVE}/Exe |
---|
6434 | |
---|
6435 | #==================================================== |
---|
6436 | # Define R_BUF_KSH : Buffer place for job output |
---|
6437 | # Define R_BUF_EXE : Buffer place for binary used during simulation |
---|
6438 | R_BUF_KSH=${R_BUFR}/Out |
---|
6439 | R_BUF_EXE=${R_BUFR}/Exe |
---|
6440 | |
---|
6441 | #==================================================== |
---|
6442 | # Define REBUILD_DIR : where we store files needing rebuild process |
---|
6443 | REBUILD_DIR=${R_BUFR}/REBUILD |
---|
6444 | if [ ! X${TaskType} = Xchecking ] ; then |
---|
6445 | IGCM_sys_MkdirWork ${REBUILD_DIR} |
---|
6446 | fi |
---|
6447 | |
---|
6448 | #==================================================== |
---|
6449 | # DodsCopy : apply default value if not defined |
---|
6450 | if ( [ X${config_Post_DodsCopy} = X${NULL_STR} ] || [ X${config_Post_DodsCopy} = X ] ) ; then |
---|
6451 | config_Post_DodsCopy=TRUE |
---|
6452 | fi |
---|
6453 | |
---|
6454 | #==================================================== |
---|
6455 | # AtlasIPSL : apply default value if not defined |
---|
6456 | if ( [ X${config_Post_AtlasIPSL} = X${NULL_STR} ] || [ X${config_Post_AtlasIPSL} = X ] ) ; then |
---|
6457 | config_Post_AtlasIPSL=TRUE |
---|
6458 | fi |
---|
6459 | |
---|
6460 | #==================================================== |
---|
6461 | # ParserXIOS : apply default value if not defined |
---|
6462 | if ( [ X${config_Post_ParserXIOS} = X${NULL_STR} ] || [ X${config_Post_ParserXIOS} = X ] ) ; then |
---|
6463 | config_Post_ParserXIOS=FALSE |
---|
6464 | fi |
---|
6465 | |
---|
6466 | #==================================================== |
---|
6467 | # MetricsPCMDI : apply default value if not defined |
---|
6468 | if ( [ X${config_Post_MetricsPCMDI} = X${NULL_STR} ] || [ X${config_Post_MetricsPCMDI} = X ] ) ; then |
---|
6469 | config_Post_MetricsPCMDI=FALSE |
---|
6470 | fi |
---|
6471 | |
---|
6472 | #==================================================== |
---|
6473 | # IgnoreNonMonotonic : apply default value if not defined |
---|
6474 | if ( [ X${config_Post_IgnoreNonMonotonic} = X${NULL_STR} ] || [ X${config_Post_IgnoreNonMonotonic} = X ] ) ; then |
---|
6475 | config_Post_IgnoreNonMonotonic=FALSE |
---|
6476 | fi |
---|
6477 | |
---|
6478 | #==================================================== |
---|
6479 | # LightRestartPack : apply default value if not defined |
---|
6480 | if ( [ X${config_Post_LightRestartPack} = X${NULL_STR} ] || [ X${config_Post_LightRestartPack} = X ] ) ; then |
---|
6481 | config_Post_LightRestartPack=FALSE |
---|
6482 | fi |
---|
6483 | |
---|
6484 | #==================================================== |
---|
6485 | # Define StackFileLocation : directory where we store stack files |
---|
6486 | # Define StackFileName : stack file containing call tree and instrumentation |
---|
6487 | # Stack file containing call tree will be stored there. |
---|
6488 | if ( $DEBUG_debug ) ; then |
---|
6489 | StackFileLocation=${StackFileLocation:=${R_BUF_KSH}} |
---|
6490 | [ ! -d ${StackFileLocation} ] && mkdir -p ${StackFileLocation} |
---|
6491 | if [ X${TaskType} = Xcomputing ]; then |
---|
6492 | StackFileName=computing.stack.$$ |
---|
6493 | elif [ X${TaskType} = Xpost-processing ]; then |
---|
6494 | StackFileName=${Script_Post_Output}.stack.$$ |
---|
6495 | elif [ X${TaskType} = Xchecking ]; then |
---|
6496 | StackFileName=checking.stack.$$ |
---|
6497 | else |
---|
6498 | IGCM_debug_Exit "IGCM_config_CommonConfiguration unknown TaskType : ${TaskType}" |
---|
6499 | IGCM_debug_Verif_Exit |
---|
6500 | fi |
---|
6501 | |
---|
6502 | # This boolean will trigger the filling of the stack |
---|
6503 | # Only now we know where things should be ... |
---|
6504 | # We don't fill the stack when we perform checking task |
---|
6505 | if [ ! X${TaskType} = Xchecking ] ; then |
---|
6506 | ActivateStackFilling=true |
---|
6507 | fi |
---|
6508 | fi |
---|
6509 | |
---|
6510 | IGCM_debug_PopStack "IGCM_config_CommonConfiguration" |
---|
6511 | } |
---|
6512 | |
---|
6513 | #=================================== |
---|
6514 | function IGCM_config_Initialize |
---|
6515 | { |
---|
6516 | IGCM_debug_PushStack "IGCM_config_Initialize" |
---|
6517 | |
---|
6518 | # Debug Print : |
---|
6519 | echo |
---|
6520 | IGCM_debug_Print 1 "IGCM_config_Initialize" |
---|
6521 | |
---|
6522 | # Test modipsl tree existence. |
---|
6523 | IGCM_sys_TestDir ${MODIPSL} |
---|
6524 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
6525 | IGCM_sys_TestDir ${libIGCM} |
---|
6526 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
6527 | IGCM_sys_TestDir ${R_EXE} |
---|
6528 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
6529 | IGCM_sys_TestDir ${SUBMIT_DIR} |
---|
6530 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
6531 | |
---|
6532 | if ( $DEBUG_debug ) ; then |
---|
6533 | echo "Keep trace of inital SUBMIT_DIR : " |
---|
6534 | ls -lta ${SUBMIT_DIR} |
---|
6535 | fi |
---|
6536 | |
---|
6537 | #================================== |
---|
6538 | # Read ListOfComponents section: |
---|
6539 | echo |
---|
6540 | IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents" |
---|
6541 | |
---|
6542 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents |
---|
6543 | for comp in ${config_ListOfComponents[*]} ; do |
---|
6544 | IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} |
---|
6545 | done |
---|
6546 | IGCM_debug_Print 3 ${config_ListOfComponents[*]} |
---|
6547 | |
---|
6548 | #================================== |
---|
6549 | # Read Executable section: |
---|
6550 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Executable |
---|
6551 | |
---|
6552 | #================================== |
---|
6553 | # Read Restarts section: |
---|
6554 | # Restarts : Gerneral rule or local for each component. |
---|
6555 | echo |
---|
6556 | IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts" |
---|
6557 | |
---|
6558 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts |
---|
6559 | for option in ${config_Restarts[*]} ; do |
---|
6560 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option} |
---|
6561 | eval auxprint=\${config_Restarts_${option}} |
---|
6562 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
6563 | done |
---|
6564 | |
---|
6565 | #================================== |
---|
6566 | # Define Job Outputs Name |
---|
6567 | echo |
---|
6568 | IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output" |
---|
6569 | Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} |
---|
6570 | IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" |
---|
6571 | Exe_Output=out_execution |
---|
6572 | IGCM_debug_Print 3 "Exe_Output = ${Exe_Output}" |
---|
6573 | |
---|
6574 | #===================================================================# |
---|
6575 | # Prepare variables available for ${COMP}.card and ${COMP}.driver # |
---|
6576 | # But available to any son functions # |
---|
6577 | #===================================================================# |
---|
6578 | |
---|
6579 | # Convert yyyy-mm-dd date to gregorian yyyymmdd |
---|
6580 | DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) |
---|
6581 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
6582 | |
---|
6583 | # Period Length In Days between DateBegin and DateEnd |
---|
6584 | (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) |
---|
6585 | if [ ${ExperienceLengthInDays} -lt 0 ] ; then |
---|
6586 | IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that." |
---|
6587 | IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates." |
---|
6588 | IGCM_debug_Verif_Exit |
---|
6589 | fi |
---|
6590 | |
---|
6591 | # Day and Year of Initial State (Given in julian format) |
---|
6592 | InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 )) |
---|
6593 | InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 )) |
---|
6594 | |
---|
6595 | #================================================================# |
---|
6596 | # Test and Prepare directories # |
---|
6597 | #================================================================# |
---|
6598 | |
---|
6599 | # ==> 4 kinds of input files : |
---|
6600 | # 1) R_INIT : Initial State Files (Etat0, carteveg) |
---|
6601 | # 2) R_BC : Boundary Conditions (Forcages, lai) |
---|
6602 | # 3) Parameters files (allready define through ${SUBMIT_DIR}) |
---|
6603 | # 4) Restarts files (allready define in IGCM_config_Initialize) |
---|
6604 | |
---|
6605 | # Here we offer the possibility to redefine R_INIT, R_BC |
---|
6606 | # and PeriodNb through config.card |
---|
6607 | R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT} |
---|
6608 | echo |
---|
6609 | IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb" |
---|
6610 | IGCM_debug_Print 3 "R_IN=${R_IN}" |
---|
6611 | IGCM_debug_Print 3 "R_INIT=${R_INIT}" |
---|
6612 | R_BC=${config_UserChoices_R_BC:=${R_IN}/BC} |
---|
6613 | IGCM_debug_Print 3 "R_BC=${R_BC}" |
---|
6614 | PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}} |
---|
6615 | IGCM_debug_Print 3 "Loop in main Job with ${PeriodNb} period(s)" |
---|
6616 | |
---|
6617 | # SD ADA SPECIFIC # |
---|
6618 | # TO FIX # |
---|
6619 | #IGCM_sys_TestDirArchive ${R_IN} |
---|
6620 | #[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
6621 | |
---|
6622 | if ( ${FirstInitialize} ) ; then |
---|
6623 | IGCM_sys_MkdirArchive ${R_SAVE} |
---|
6624 | [ ! ${config_Post_PackFrequency} = NONE ] && IGCM_sys_Mkdir ${R_BUFR} |
---|
6625 | else |
---|
6626 | IGCM_sys_TestDirArchive ${R_SAVE} |
---|
6627 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive ${R_SAVE}" |
---|
6628 | |
---|
6629 | if [ ! ${config_Post_PackFrequency} = NONE ] ; then |
---|
6630 | IGCM_sys_TestDir ${R_BUFR} |
---|
6631 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir ${R_BUFR}" |
---|
6632 | fi |
---|
6633 | |
---|
6634 | # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal" |
---|
6635 | IGCM_config_StateCheck |
---|
6636 | |
---|
6637 | # And EXIT if not OK |
---|
6638 | IGCM_debug_Verif_Exit |
---|
6639 | fi |
---|
6640 | |
---|
6641 | #==================================================== |
---|
6642 | # Experience type : DEB(ug), DEV(elopment), RUN |
---|
6643 | if [ X${JobType} != XRUN ] ; then |
---|
6644 | echo |
---|
6645 | echo "====================================================" |
---|
6646 | echo "libIGCM JOB is NOT in RUN type mode." |
---|
6647 | echo "!! OUTPUT files will NOT be PROTECTED !!" |
---|
6648 | echo "Be carefull : you can ERASE the result of this job !" |
---|
6649 | |
---|
6650 | case ${JobType} in |
---|
6651 | DEB) |
---|
6652 | echo "DEBUG mode : activation of 'set -vx' mode." |
---|
6653 | echo "DEBUG mode : no protection for output files." |
---|
6654 | echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency." |
---|
6655 | ;; |
---|
6656 | DEV) |
---|
6657 | echo "DEVelopment mode : no protection for output files." |
---|
6658 | echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency." |
---|
6659 | ;; |
---|
6660 | esac |
---|
6661 | |
---|
6662 | if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then |
---|
6663 | if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then |
---|
6664 | echo "------------" |
---|
6665 | echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency" |
---|
6666 | echo " to PeriodLength : ${config_UserChoices_PeriodLength}" |
---|
6667 | echo "------------" |
---|
6668 | config_Post_RebuildFrequency=${config_UserChoices_PeriodLength} |
---|
6669 | fi |
---|
6670 | fi |
---|
6671 | echo "====================================================" |
---|
6672 | echo |
---|
6673 | fi |
---|
6674 | |
---|
6675 | IGCM_debug_PopStack "IGCM_config_Initialize" |
---|
6676 | } |
---|
6677 | |
---|
6678 | #=================================== |
---|
6679 | function IGCM_config_DaysInPeriodLength |
---|
6680 | { |
---|
6681 | IGCM_debug_PushStack "IGCM_config_DaysInPeriodLength" |
---|
6682 | |
---|
6683 | typeset i |
---|
6684 | |
---|
6685 | # Determine number of day(s) in PeriodLength : |
---|
6686 | case ${config_UserChoices_PeriodLength} in |
---|
6687 | *Y|*y) |
---|
6688 | PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) |
---|
6689 | echo |
---|
6690 | IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}" |
---|
6691 | PeriodLengthInDays=0 |
---|
6692 | i=0 |
---|
6693 | until [ $i -ge $PeriodLengthInYears ] ; do |
---|
6694 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) |
---|
6695 | (( i=i+1 )) |
---|
6696 | done |
---|
6697 | ;; |
---|
6698 | *M|*m) |
---|
6699 | PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) |
---|
6700 | echo |
---|
6701 | IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}" |
---|
6702 | PeriodLengthInDays=0 |
---|
6703 | i=0 |
---|
6704 | until [ $i -ge $PeriodLengthInMonths ] ; do |
---|
6705 | if [ $(( 10#${month} + ${i} )) -lt 13 ] ; then |
---|
6706 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( 10#${month} + ${i} )) ) )) |
---|
6707 | else |
---|
6708 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( 10#${month} + ${i} - 12 )) ) )) |
---|
6709 | fi |
---|
6710 | (( i=i+1 )) |
---|
6711 | done |
---|
6712 | ;; |
---|
6713 | *D|*d) |
---|
6714 | PeriodLengthInMonths=0 |
---|
6715 | PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' ) |
---|
6716 | echo |
---|
6717 | IGCM_debug_Print 2 "Number of days for PeriodLength : ${PeriodLengthInDays}";; |
---|
6718 | *) |
---|
6719 | IGCM_debug_Exit "IGCM_config_DaysInPeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." |
---|
6720 | IGCM_debug_Verif_Exit ;; |
---|
6721 | esac |
---|
6722 | |
---|
6723 | IGCM_debug_PopStack "IGCM_config_DaysInPeriodLength" |
---|
6724 | } |
---|
6725 | |
---|
6726 | #=================================== |
---|
6727 | function IGCM_config_DateCoherency |
---|
6728 | { |
---|
6729 | IGCM_debug_PushStack "IGCM_config_DateCoherency" |
---|
6730 | |
---|
6731 | echo |
---|
6732 | IGCM_debug_Print 1 "IGCM_config_DateCoherency" |
---|
6733 | echo |
---|
6734 | |
---|
6735 | typeset Length VerifiedPeriodDateBegin VerifiedPeriodDateEnd |
---|
6736 | |
---|
6737 | # check coherency between (PeriodDateBegin, PeriodDateEnd) and (DateBegin, CumulPeriod, PeriodLength) |
---|
6738 | # DateBegin + CumulPeriod*PeriodLength = PeriodDateBegin |
---|
6739 | echo |
---|
6740 | |
---|
6741 | case ${config_UserChoices_PeriodLength} in |
---|
6742 | *Y|*y) |
---|
6743 | Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInYears} ))Y ) |
---|
6744 | ;; |
---|
6745 | *M|*m) |
---|
6746 | Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInMonths} ))M ) |
---|
6747 | ;; |
---|
6748 | *D|*d) |
---|
6749 | Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInDays} ))D ) |
---|
6750 | ;; |
---|
6751 | esac |
---|
6752 | VerifiedPeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${Length}-1 ) |
---|
6753 | |
---|
6754 | if [ ${VerifiedPeriodDateEnd} != ${PeriodDateEnd} ] ; then |
---|
6755 | IGCM_debug_Print 1 "From run.card PeriodDateEnd is not consistent with DateBegin and CumulPeriod." |
---|
6756 | IGCM_debug_Print 1 "We have DateBegin = ${DateBegin}" |
---|
6757 | IGCM_debug_Print 1 "We have CumulPeriod = ${CumulPeriod}" |
---|
6758 | IGCM_debug_Print 1 "We have PeriodDateEnd = ${PeriodDateEnd}" |
---|
6759 | IGCM_debug_Print 1 "We have VerifiedPeriodDateEnd = ${VerifiedPeriodDateEnd}" |
---|
6760 | IGCM_debug_Print 1 "You must have change run.card in an inconsistent way." |
---|
6761 | |
---|
6762 | IGCM_debug_Exit "STOP here to avoid further issues." |
---|
6763 | fi |
---|
6764 | |
---|
6765 | # PeriodDateBegin + PeriodLength = PeriodDateEnd |
---|
6766 | VerifiedPeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${VerifiedPeriodDateEnd} $(( ${PeriodLengthInDays} * -1 )) ) |
---|
6767 | |
---|
6768 | IGCM_debug_PopStack "IGCM_config_DateCoherency" |
---|
6769 | } |
---|
6770 | |
---|
6771 | #=================================== |
---|
6772 | function IGCM_config_StateCheck |
---|
6773 | { |
---|
6774 | IGCM_debug_PushStack "IGCM_config_StateCheck" |
---|
6775 | |
---|
6776 | #Test state of run in run.card |
---|
6777 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState |
---|
6778 | |
---|
6779 | if [ ${run_Configuration_PeriodState} = "Fatal" ] ; then |
---|
6780 | echo |
---|
6781 | IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" |
---|
6782 | IGCM_debug_Print 1 "Check the overall status of your simulation by visiting this page:" |
---|
6783 | IGCM_debug_Print 1 "http://prodiguer-test-web.ipsl.fr/static/simulation.detail.html?uid=${simuid}" |
---|
6784 | IGCM_debug_Print 1 "Then try running ${libIGCM}/clean_PeriodLenght.job to clean latest failed period" |
---|
6785 | IGCM_debug_Print 1 "Or try running ${libIGCM}/clean_latestPackperiod.job to clean lastest pack period." |
---|
6786 | IGCM_debug_Print 1 "Or use ${libIGCM}/purge_simulation.job to delete the full simulation." |
---|
6787 | IGCM_debug_Exit |
---|
6788 | elif [ $( echo ${run_Configuration_PeriodState} | grep Fatal | wc -l ) -eq 1 ] ; then |
---|
6789 | echo |
---|
6790 | IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" |
---|
6791 | IGCM_debug_Print 1 "Compute jobs has been stop because at least the above mentionned post-processing jobs fails." |
---|
6792 | IGCM_debug_Print 1 "Check post-processing jobs carefully by visiting this page:" |
---|
6793 | IGCM_debug_Print 1 "http://prodiguer-test-web.ipsl.fr/static/simulation.detail.html?uid=${simuid}" |
---|
6794 | IGCM_debug_Print 1 "Please visit that page to see how to fix issues:" |
---|
6795 | IGCM_debug_Print 1 "https://forge.ipsl.jussieu.fr/igcmg_doc/wiki/DocGmonitor" |
---|
6796 | IGCM_debug_Print 1 "Then try running ${libIGCM}/clean_PeriodLenght.job to clean latest failed period" |
---|
6797 | IGCM_debug_Print 1 "Or try running ${libIGCM}/clean_latestPackperiod.job to clean latest pack period." |
---|
6798 | IGCM_debug_Print 1 "Or use ${libIGCM}/purge_simulation.job to delete the full simulation." |
---|
6799 | IGCM_debug_Exit |
---|
6800 | fi |
---|
6801 | |
---|
6802 | IGCM_debug_PopStack "IGCM_config_StateCheck" |
---|
6803 | } |
---|
6804 | |
---|
6805 | #=================================== |
---|
6806 | function IGCM_config_Check |
---|
6807 | { |
---|
6808 | IGCM_debug_PushStack "IGCM_config_Check" |
---|
6809 | |
---|
6810 | # If one of the following modulo is not zero : |
---|
6811 | # we will issue an error then explain and exit in |
---|
6812 | # AA_job IGCM_debug_Verif_Exit call before binary submission |
---|
6813 | |
---|
6814 | echo |
---|
6815 | IGCM_debug_Print 1 "IGCM_config_Check" |
---|
6816 | echo |
---|
6817 | |
---|
6818 | typeset i |
---|
6819 | |
---|
6820 | # Check RebuildFrequency against key frequencies : PeriodLength ; PackFrequency ; TimeSeriesFrequency ; SeasonalFrequency |
---|
6821 | if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then |
---|
6822 | AsynchronousRebuild=true |
---|
6823 | IGCM_debug_Print 1 "Asynchronous rebuild has been activated." |
---|
6824 | echo |
---|
6825 | # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero |
---|
6826 | IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength" |
---|
6827 | IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength |
---|
6828 | IGCM_debug_Print 1 "Check coherence between PackFrequency and RebuildFrequency" |
---|
6829 | IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_Post_RebuildFrequency |
---|
6830 | IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency" |
---|
6831 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency |
---|
6832 | IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency" |
---|
6833 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency |
---|
6834 | else |
---|
6835 | AsynchronousRebuild=false |
---|
6836 | IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" |
---|
6837 | IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" |
---|
6838 | echo |
---|
6839 | #modulo (PeriodLength and TimeSeriesFrequency/SeasonalFrequency) must be zero |
---|
6840 | IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength" |
---|
6841 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength |
---|
6842 | IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength" |
---|
6843 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength |
---|
6844 | fi |
---|
6845 | |
---|
6846 | # Check PackFrequency against other key frequencies |
---|
6847 | # Modulo (PackFrequency and TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero |
---|
6848 | if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then |
---|
6849 | Pack=true |
---|
6850 | # |
---|
6851 | IGCM_debug_Print 1 "Check coherence between PackFrequency and PeriodLength" |
---|
6852 | IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_UserChoices_PeriodLength |
---|
6853 | IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PackFrequency" |
---|
6854 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_PackFrequency |
---|
6855 | IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PackFrequency" |
---|
6856 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_PackFrequency |
---|
6857 | else |
---|
6858 | Pack=false |
---|
6859 | fi |
---|
6860 | |
---|
6861 | # modulo (TimeSeriesFrequency and all Chunck2D) must be zero |
---|
6862 | NbJob=${#CHUNCK2D_SIZE[@]} |
---|
6863 | i=0 |
---|
6864 | until [ $i -ge $NbJob ]; do |
---|
6865 | value=${CHUNCK2D_SIZE[${i}]} |
---|
6866 | IGCM_debug_Print 1 "Check coherence between ${CHUNCK2D_NAME[${i}]} Chunck2D frequency and TimeSeriesFrequency" |
---|
6867 | IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency |
---|
6868 | case ${value} in |
---|
6869 | *Y|*y) ;; |
---|
6870 | *) |
---|
6871 | IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" |
---|
6872 | IGCM_debug_Exit "This will stop the job" ;; |
---|
6873 | esac |
---|
6874 | (( i=i+1 )) |
---|
6875 | done |
---|
6876 | |
---|
6877 | # modulo (TimeSeriesFrequency and all Chunck3D) must be zero |
---|
6878 | NbJob=${#CHUNCK3D_SIZE[@]} |
---|
6879 | i=0 |
---|
6880 | until [ $i -ge $NbJob ]; do |
---|
6881 | value=${CHUNCK3D_SIZE[${i}]} |
---|
6882 | IGCM_debug_Print 1 "Check coherence between ${CHUNCK3D_NAME[${i}]} Chunck3D frequency and TimeSeriesFrequency" |
---|
6883 | IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency |
---|
6884 | case ${value} in |
---|
6885 | *Y|*y) ;; |
---|
6886 | *) |
---|
6887 | IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" |
---|
6888 | IGCM_debug_Exit "This will stop the job" ;; |
---|
6889 | esac |
---|
6890 | (( i=i+1 )) |
---|
6891 | done |
---|
6892 | |
---|
6893 | # check to be sure there is enough space on temporary filesystems to run |
---|
6894 | echo |
---|
6895 | IGCM_debug_Print 1 "Check if there is enough space on temporary filesystem" |
---|
6896 | IGCM_sys_check_quota |
---|
6897 | |
---|
6898 | # check to be sure that RUN_DIR_PATH, that will be removed is not pointing to an important directory |
---|
6899 | echo |
---|
6900 | IGCM_debug_Print 1 "Check where RUN_DIR_PATH variable is pointing to" |
---|
6901 | IGCM_sys_check_path |
---|
6902 | |
---|
6903 | |
---|
6904 | IGCM_debug_PopStack "IGCM_config_Check" |
---|
6905 | } |
---|
6906 | |
---|
6907 | #=================================== |
---|
6908 | function IGCM_config_ConfigureExecution |
---|
6909 | { |
---|
6910 | IGCM_debug_PushStack " IGCM_config_ConfigureExecution" |
---|
6911 | |
---|
6912 | #echo |
---|
6913 | IGCM_debug_Print 1 " IGCM_config_ConfigureExecution" |
---|
6914 | #echo |
---|
6915 | |
---|
6916 | typeset ExeNameIn ExeNameFirst CompNameFirst configCardPath comp i |
---|
6917 | typeset tempvar tempvarMPI tempvarNOD NbElts NbExec |
---|
6918 | |
---|
6919 | # config.card path |
---|
6920 | configCardPath=$1 |
---|
6921 | |
---|
6922 | coreNumber=0 |
---|
6923 | mpiTasks=0 |
---|
6924 | openMPthreads=0 |
---|
6925 | NbExec=0 |
---|
6926 | |
---|
6927 | OK_PARA_MPI=false |
---|
6928 | OK_PARA_OMP=false |
---|
6929 | OK_PARA_NOD=false |
---|
6930 | OK_PARA_MPMD=false |
---|
6931 | |
---|
6932 | for comp in ${config_ListOfComponents[*]} ; do |
---|
6933 | |
---|
6934 | # Manage component executable |
---|
6935 | IGCM_card_DefineArrayFromOption ${configCardPath} Executable ${comp} |
---|
6936 | |
---|
6937 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
6938 | |
---|
6939 | # NO order in config.card for parallelized values ! |
---|
6940 | # just use suffix : MPI , OMP and NOD (for number of NODes.) |
---|
6941 | |
---|
6942 | # NOD is the number of NODes allocated |
---|
6943 | eval ${comp}_PROC_NOD=0 |
---|
6944 | |
---|
6945 | # MPI is the number of MPI processus per nodes |
---|
6946 | eval ${comp}_PROC_MPI=0 |
---|
6947 | |
---|
6948 | # OMP is the number of OpenMP threads per MPI processus |
---|
6949 | eval ${comp}_PROC_OMP=0 |
---|
6950 | |
---|
6951 | # Only if we really have an executable for the component : |
---|
6952 | if ( [ "X${ExeNameIn}" != X\"\" ] && [ "X${ExeNameIn}" != "Xinca.dat" ] ) ; then |
---|
6953 | |
---|
6954 | IGCM_debug_Print 1 ${comp} |
---|
6955 | |
---|
6956 | # Keep the first executable found and the first CompName |
---|
6957 | ExeNameFirst=${ExeNameIn} |
---|
6958 | CompNameFirst=${comp} |
---|
6959 | |
---|
6960 | # Are we a second executable? |
---|
6961 | (( NbExec = NbExec + 1 )) |
---|
6962 | |
---|
6963 | # set 1 MPI task, 1 OpenMP thread and 1 node as default |
---|
6964 | eval ${comp}_PROC_MPI=1 |
---|
6965 | eval ${comp}_PROC_OMP=1 |
---|
6966 | eval ${comp}_PROC_NOD=1 |
---|
6967 | |
---|
6968 | eval NbElts=\${#config_Executable_${comp}[@]} |
---|
6969 | |
---|
6970 | if [ ${NbElts} -gt 2 ] ; then |
---|
6971 | # |
---|
6972 | # CURRENT METHOD TO SPECIFY MPI AND OMP RESSOURCES |
---|
6973 | # |
---|
6974 | i=2 |
---|
6975 | while [ ${i} -lt ${NbElts} ] ; do |
---|
6976 | eval tempvar=\${config_Executable_${comp}[${i}]} |
---|
6977 | IGCM_debug_Print 2 ${tempvar} |
---|
6978 | |
---|
6979 | if [ X${tempvar} = X ] ; then |
---|
6980 | IGCM_debug_Print 2 "Error reading MPI/OMP parameters !!!" |
---|
6981 | IGCM_debug_Exit "Check your config.card. Exit now" |
---|
6982 | IGCM_debug_Verif_Exit |
---|
6983 | fi |
---|
6984 | |
---|
6985 | case ${tempvar} in |
---|
6986 | *[mM][pP][iI]*) |
---|
6987 | # Read MPI parameter for composante |
---|
6988 | eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" ) |
---|
6989 | OK_PARA_MPI=true;; |
---|
6990 | *[oO][mM][pP]*) |
---|
6991 | # Read OMP parameter for composante |
---|
6992 | eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" ) |
---|
6993 | ;; |
---|
6994 | *[nN][oO][dD]*) |
---|
6995 | # Read NOD (NumBer of Nodes) parameter for composante |
---|
6996 | eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" ) |
---|
6997 | OK_PARA_NOD=true |
---|
6998 | OK_PARA_MPI=true |
---|
6999 | ;; |
---|
7000 | esac |
---|
7001 | (( i = i + 1 )) |
---|
7002 | done |
---|
7003 | else |
---|
7004 | # |
---|
7005 | # BACKWARD COMPATIBILITY NOT SUPPORTED ANYMORE |
---|
7006 | # |
---|
7007 | IGCM_debug_Exit "You are using a deprecated ressources specification mechanism in your config.card" |
---|
7008 | IGCM_debug_Exit "Please check : https://forge.ipsl.jussieu.fr/igcmg_doc/wiki/DocEsetup#ThesectionExecutable" |
---|
7009 | IGCM_debug_Exit "Please modify ${configCardPath}" |
---|
7010 | exit |
---|
7011 | fi |
---|
7012 | if [ ${comp}_PROC_NOD -gt 1 ] ; then |
---|
7013 | if ( [ ${comp}_PROC_MPI -gt 1 ] && [ ${comp}_PROC_OMP -gt 1 ] ) ; then |
---|
7014 | IGCM_debug_Print 2 "Error using MPI/OMP/NOD parameters !!!" |
---|
7015 | IGCM_debug_Exit "It is not allowed to use MPI and OMP and NOD parameters for the same component" |
---|
7016 | IGCM_debug_Exit "Check your config.card. Exit now" |
---|
7017 | IGCM_debug_Verif_Exit |
---|
7018 | fi |
---|
7019 | if [ "${comp}" != "IOS" ] ; then |
---|
7020 | IGCM_debug_Print 2 "Error using NOD parameter !!!" |
---|
7021 | IGCM_debug_Exit "NOD parameter is only available for IOS component " |
---|
7022 | IGCM_debug_Exit "Check your config.card. Exit now" |
---|
7023 | IGCM_debug_Verif_Exit |
---|
7024 | fi |
---|
7025 | fi |
---|
7026 | |
---|
7027 | eval tempvarMPI=\${${comp}_PROC_MPI} |
---|
7028 | eval tempvarNOD=\${${comp}_PROC_NOD} |
---|
7029 | eval tempvarOMP=\${${comp}_PROC_OMP} |
---|
7030 | |
---|
7031 | # set OMP mode if more than 1 OMP thread. |
---|
7032 | [ ${tempvarOMP} -ge 2 ] && OK_PARA_OMP=true |
---|
7033 | |
---|
7034 | # Number of OMP threads |
---|
7035 | [ ${openMPthreads} -lt ${tempvarOMP} ] && openMPthreads=${tempvarOMP} |
---|
7036 | |
---|
7037 | # SUM UP NUMBER OF CORES |
---|
7038 | if [ ${comp}_PROC_NOD -gt 1 ] ; then |
---|
7039 | (( coreNumber = coreNumber + tempvarNOD * NB_CORE_PER_NODE )) |
---|
7040 | else |
---|
7041 | (( coreNumber = coreNumber + tempvarMPI * tempvarNOD * tempvarOMP )) |
---|
7042 | fi |
---|
7043 | # SUM UP NUMBER OF MPI TASKS |
---|
7044 | (( mpiTasks = mpiTasks + tempvarMPI * tempvarNOD )) |
---|
7045 | fi |
---|
7046 | done |
---|
7047 | |
---|
7048 | # MANDATORY FOR THE OPA9.DRIVER. USED TO EDIT OPA NAMELIST |
---|
7049 | # WE SHOULD PLANIFY NUM_PROC_??? DEPRECATION |
---|
7050 | NUM_PROC_CPL=${CPL_PROC_MPI} |
---|
7051 | NUM_PROC_OCE=${OCE_PROC_MPI} |
---|
7052 | NUM_PROC_ATM=${ATM_PROC_MPI} |
---|
7053 | |
---|
7054 | # set MPMD mode if more than 2 executable names. |
---|
7055 | [ ${NbExec} -ge 2 ] && OK_PARA_MPMD=true |
---|
7056 | |
---|
7057 | # Define the execution type we are running in |
---|
7058 | if ( ${OK_PARA_MPMD} ) ; then |
---|
7059 | if ( ${OK_PARA_MPI} ) ; then |
---|
7060 | # MPMD always implies MPI |
---|
7061 | executionType=1 |
---|
7062 | fi |
---|
7063 | if ( ${OK_PARA_OMP} ) ; then |
---|
7064 | # MPMD + MPI/OMP |
---|
7065 | executionType=2 |
---|
7066 | fi |
---|
7067 | else |
---|
7068 | if ( ( ${OK_PARA_MPI} ) && ( ${OK_PARA_OMP} ) ) ; then |
---|
7069 | # SPMD + MPI/OMP |
---|
7070 | executionType=3 |
---|
7071 | elif ( ( ${OK_PARA_MPI} ) && ( ! ${OK_PARA_OMP} ) ) ; then |
---|
7072 | # SPMD + MPI only |
---|
7073 | executionType=4 |
---|
7074 | elif ( ( ! ${OK_PARA_MPI} ) && ( ${OK_PARA_OMP} ) ) ; then |
---|
7075 | # SPMD + OMP only |
---|
7076 | executionType=5 |
---|
7077 | elif ( ( ! ${OK_PARA_MPI} ) && ( ! ${OK_PARA_OMP} ) ) ; then |
---|
7078 | # SEQUENTIAL THEN |
---|
7079 | executionType=6 |
---|
7080 | coreNumber=1 |
---|
7081 | fi |
---|
7082 | fi |
---|
7083 | |
---|
7084 | IGCM_debug_Print 1 "MPI/OMP treatment coreNumber = ${coreNumber}" |
---|
7085 | IGCM_debug_Print 1 "MPI/OMP treatment mpiTasks = ${mpiTasks}" |
---|
7086 | IGCM_debug_Print 1 "MPI/OMP treatment openMPthreads = ${openMPthreads}" |
---|
7087 | IGCM_debug_Print 1 "MPI/OMP treatment executionType = ${executionType}" |
---|
7088 | |
---|
7089 | IGCM_debug_PopStack "IGCM_config_ConfigureExecution" |
---|
7090 | } |
---|
7091 | |
---|
7092 | #=================================== |
---|
7093 | function IGCM_config_PeriodStart |
---|
7094 | { |
---|
7095 | IGCM_debug_PushStack "IGCM_config_PeriodStart" |
---|
7096 | |
---|
7097 | echo |
---|
7098 | IGCM_debug_Print 1 "IGCM_config_PeriodStart" |
---|
7099 | echo |
---|
7100 | |
---|
7101 | if ( ${FirstInitialize} ) ; then |
---|
7102 | #================================================# |
---|
7103 | # Initialize date/period information # |
---|
7104 | #================================================# |
---|
7105 | |
---|
7106 | IGCM_date_GetYearMonthDay ${DateBegin} year month day |
---|
7107 | IGCM_config_DaysInPeriodLength |
---|
7108 | |
---|
7109 | PeriodDateBegin=${DateBegin} |
---|
7110 | PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) ) |
---|
7111 | CumulPeriod=1 |
---|
7112 | |
---|
7113 | #=================================================# |
---|
7114 | # Write updated run.card # |
---|
7115 | #=================================================# |
---|
7116 | |
---|
7117 | #Correct run.card Configuration for this period |
---|
7118 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} |
---|
7119 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} |
---|
7120 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} |
---|
7121 | if [ X$( grep "SubmitPath" ${SUBMIT_DIR}/run.card ) != X ] ; then |
---|
7122 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR} |
---|
7123 | fi |
---|
7124 | |
---|
7125 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" |
---|
7126 | |
---|
7127 | else |
---|
7128 | #================================================# |
---|
7129 | # The file run.card allready exist # |
---|
7130 | #================================================# |
---|
7131 | |
---|
7132 | # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal" |
---|
7133 | IGCM_config_StateCheck |
---|
7134 | # And EXIT if not OK |
---|
7135 | IGCM_debug_Verif_Exit |
---|
7136 | |
---|
7137 | #===================================# |
---|
7138 | # Read updated run.card # |
---|
7139 | #===================================# |
---|
7140 | |
---|
7141 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin |
---|
7142 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd |
---|
7143 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod |
---|
7144 | |
---|
7145 | PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) |
---|
7146 | PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} ) |
---|
7147 | CumulPeriod=${run_Configuration_CumulPeriod} |
---|
7148 | |
---|
7149 | LastPeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate $( IGCM_date_ConvertFormatToGregorian ${PeriodDateBegin} ) -1 ) |
---|
7150 | |
---|
7151 | if [ ${Period} = 1 ]; then |
---|
7152 | # save last Job output and current run.card |
---|
7153 | typeset Potential |
---|
7154 | IGCM_sys_Cd ${SUBMIT_DIR} |
---|
7155 | # |
---|
7156 | IGCM_debug_Print 2 "Save previous ksh job output" |
---|
7157 | for Potential in $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.[0-9][0-9][0-9][0-9][0-9][0-9] ) ; do |
---|
7158 | if [ X${Pack} = Xtrue ] ; then |
---|
7159 | ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${Potential} ) || IGCM_sys_Cp ${Potential} ${R_BUF_KSH}/${Potential}.$$ |
---|
7160 | else |
---|
7161 | ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${Potential} ) || IGCM_sys_Put_Out ${Potential} ${R_OUT_KSH}/${Potential}.$$ NOMOVE |
---|
7162 | IGCM_debug_Print 1 "Save of previous ksh job output is not done for Pack=false" |
---|
7163 | fi |
---|
7164 | done |
---|
7165 | |
---|
7166 | # |
---|
7167 | IGCM_debug_Print 2 "Save current run.card" |
---|
7168 | IGCM_card_CheckConflict run.card |
---|
7169 | |
---|
7170 | if [ X${Pack} = Xtrue ] ; then |
---|
7171 | IGCM_sys_Cp ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card |
---|
7172 | else |
---|
7173 | IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/run.card NOMOVE |
---|
7174 | IGCM_debug_Print 1 "Save of run.card is not done for Pack=false" |
---|
7175 | fi |
---|
7176 | # |
---|
7177 | IGCM_sys_Cd ${RUN_DIR} |
---|
7178 | else |
---|
7179 | unset FileToBeDeleted |
---|
7180 | fi |
---|
7181 | |
---|
7182 | # Determine number of day(s) in PeriodLength |
---|
7183 | IGCM_date_GetYearMonthDay $PeriodDateBegin year month day |
---|
7184 | IGCM_config_DaysInPeriodLength |
---|
7185 | |
---|
7186 | # Check coherency between (PeriodDateBegin, PeriodDateEnd) and (DateBegin, CumulPeriod, PeriodLength) |
---|
7187 | IGCM_config_DateCoherency |
---|
7188 | # And EXIT if not OK |
---|
7189 | IGCM_debug_Verif_Exit |
---|
7190 | |
---|
7191 | # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal" |
---|
7192 | IGCM_config_StateCheck |
---|
7193 | # And EXIT if not OK |
---|
7194 | IGCM_debug_Verif_Exit |
---|
7195 | |
---|
7196 | # We can say we are "Running" now. |
---|
7197 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" |
---|
7198 | fi |
---|
7199 | |
---|
7200 | # BEGIN: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh |
---|
7201 | # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y) |
---|
7202 | year_m1=$(( year - 1 )) |
---|
7203 | year_p1=$(( year + 1 )) |
---|
7204 | # Compute month_m1 (month minus 1M) |
---|
7205 | # Compute yyyymm_m1 (yyyymm minus 1M) |
---|
7206 | month_m1=$(( 10#${month} - 1 )) |
---|
7207 | if [ ${month_m1} = 0 ]; then |
---|
7208 | month_m1=12 |
---|
7209 | yyyymm_m1=${year_m1}12 |
---|
7210 | elif [ ${month_m1} -le 9 ]; then |
---|
7211 | month_m1=0${month_m1} |
---|
7212 | yyyymm_m1=${year}${month_m1} |
---|
7213 | else |
---|
7214 | yyyymm_m1=${year}${month_m1} |
---|
7215 | fi |
---|
7216 | # Compute month_p1 (month plus 1M) |
---|
7217 | # Compute yyyymm_p1 (yyyymm plus 1M) |
---|
7218 | month_p1=$(( 10#${month} + 1 )) |
---|
7219 | if [ ${month_p1} = 13 ]; then |
---|
7220 | month_p1=01 |
---|
7221 | yyyymm_p1=${year_p1}01 |
---|
7222 | elif [ ${month_p1} -le 9 ]; then |
---|
7223 | month_p1=0${month_p1} |
---|
7224 | yyyymm_p1=${year}${month_p1} |
---|
7225 | else |
---|
7226 | yyyymm_p1=${year}${month_p1} |
---|
7227 | fi |
---|
7228 | |
---|
7229 | #===================================================================# |
---|
7230 | # Calculate CyclicYear to be used for looping over a given forcing # |
---|
7231 | # period. Add CyclicBegin and CyclicEnd in config.card UserChoices. # |
---|
7232 | #===================================================================# |
---|
7233 | |
---|
7234 | # To use the variable CyclicYear, one must add in config.card CyclicBegin and CyclicEnd. |
---|
7235 | # CyclicBegin is the first year in the cycle. CyclicEnd is the last year included in the cycle. |
---|
7236 | if ( [ ! X${config_UserChoices_CyclicBegin} = X ] && [ ! X${config_UserChoices_CyclicEnd} = X ] ) ; then |
---|
7237 | CycleNb=$(( ${config_UserChoices_CyclicEnd} - ${config_UserChoices_CyclicBegin} + 1 )) |
---|
7238 | CyclicYear_p1=NOTDEFINED |
---|
7239 | |
---|
7240 | # For current year |
---|
7241 | yeartmp=$year |
---|
7242 | diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) |
---|
7243 | while [ $diffy -lt 0 ] ; do |
---|
7244 | yeartmp=$(( ${yeartmp} + ${CycleNb} )) |
---|
7245 | diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) |
---|
7246 | done |
---|
7247 | CyclicYear=$(( ( ${diffy} % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} )) |
---|
7248 | |
---|
7249 | # For next coming year |
---|
7250 | yeartmp=$(( $year + 1 )) |
---|
7251 | diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) |
---|
7252 | while [ $diffy -lt 0 ] ; do |
---|
7253 | yeartmp=$(( ${yeartmp} + ${CycleNb} )) |
---|
7254 | diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) |
---|
7255 | done |
---|
7256 | CyclicYear_p1=$(( ( ${diffy} % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} )) |
---|
7257 | |
---|
7258 | IGCM_debug_Print 1 "CyclicYear = ${CyclicYear}, CyclicYear_p1 = ${CyclicYear_p1}, current year=$year" |
---|
7259 | else |
---|
7260 | CyclicYear="ERROR_CyclicYear_Variable_Not_Defined" |
---|
7261 | CyclicYear_p1="ERROR_CyclicYear_p1_Variable_Not_Defined" |
---|
7262 | IGCM_debug_Print 1 "CyclicYear wont be use without adding CyclicBegin and CyclicEnd in config.card" |
---|
7263 | fi |
---|
7264 | |
---|
7265 | # END: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh |
---|
7266 | |
---|
7267 | #===================================================================# |
---|
7268 | # Prepare variables available for ${COMP}.card and ${COMP}.driver # |
---|
7269 | # But available to any son functions # |
---|
7270 | #===================================================================# |
---|
7271 | |
---|
7272 | # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !) |
---|
7273 | (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 )) |
---|
7274 | |
---|
7275 | # Debug Print : |
---|
7276 | echo |
---|
7277 | IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution" |
---|
7278 | IGCM_debug_Print 1 "Year of simulation : ${year}" |
---|
7279 | IGCM_debug_Print 1 "Month of simulation : ${month}" |
---|
7280 | IGCM_debug_Print 1 "PeriodLengthInDays : ${PeriodLengthInDays}" |
---|
7281 | IGCM_debug_Print 1 "PeriodDateBegin : ${PeriodDateBegin}" |
---|
7282 | IGCM_debug_Print 1 "PeriodDateEnd : ${PeriodDateEnd}" |
---|
7283 | IGCM_debug_Print 1 "SimulationLengthInDays : ${SimulationLengthInDays}" |
---|
7284 | IGCM_debug_Print 1 "ExperienceLengthInDays : ${ExperienceLengthInDays}" |
---|
7285 | |
---|
7286 | #================================================================# |
---|
7287 | # Prepare variables available for comp_finalyze # |
---|
7288 | #================================================================# |
---|
7289 | |
---|
7290 | # Period for save files |
---|
7291 | DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} |
---|
7292 | |
---|
7293 | # Prefix for save files of this period |
---|
7294 | PREFIX=${config_UserChoices_JobName}_${DatesPeriod} |
---|
7295 | |
---|
7296 | # List of files that will be deleted in RUN_DIR after run |
---|
7297 | [ -f stack ] && FileToBeDeleted[0]="stack" |
---|
7298 | |
---|
7299 | # Test if the same run as already been saved : |
---|
7300 | if [ X${JobType} = XRUN ] ; then |
---|
7301 | if [ ${DRYRUN} -le 0 ] ; then |
---|
7302 | if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then |
---|
7303 | IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently re-running an old job." |
---|
7304 | IGCM_debug_Print 1 "Because of readonly permissions, you can't re-run a job when saved files" |
---|
7305 | IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " |
---|
7306 | IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See different clean_*.job in ${libIGCM} directory." |
---|
7307 | IGCM_debug_Print 1 " This exit has been initiated because at least ${R_BUF_KSH}/${PREFIX}_${Exe_Output} exists." |
---|
7308 | IGCM_debug_Verif_Exit |
---|
7309 | fi |
---|
7310 | fi |
---|
7311 | else |
---|
7312 | if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then |
---|
7313 | IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode." |
---|
7314 | fi |
---|
7315 | fi |
---|
7316 | |
---|
7317 | #================================================================# |
---|
7318 | # Prepare variables available for binary execution # |
---|
7319 | # Call function for creation of run script # |
---|
7320 | # Only done once per job # |
---|
7321 | #================================================================# |
---|
7322 | |
---|
7323 | if [ ${Period} -eq 1 ]; then |
---|
7324 | # Define the execution context (MPMD, SPMD, MPI/OMP ...) |
---|
7325 | IGCM_config_ConfigureExecution ${SUBMIT_DIR}/config.card |
---|
7326 | # Create the execution script for the current context |
---|
7327 | IGCM_sys_build_execution_scripts |
---|
7328 | fi |
---|
7329 | |
---|
7330 | ExecutionFail=false |
---|
7331 | |
---|
7332 | # Update the rabbitMQ queue |
---|
7333 | IGCM_debug_BigBro_Update |
---|
7334 | |
---|
7335 | IGCM_debug_PopStack "IGCM_config_PeriodStart" |
---|
7336 | } |
---|
7337 | |
---|
7338 | #=================================== |
---|
7339 | function IGCM_config_SaveSourceModifications |
---|
7340 | { |
---|
7341 | IGCM_debug_PushStack "IGCM_config_SaveSourceModifications" |
---|
7342 | |
---|
7343 | typeset ExeOutDateMax listVarEnv |
---|
7344 | ExeOutDateMax=$1 |
---|
7345 | |
---|
7346 | listVarEnv="ExeOutDateMax,R_OUT_EXE,PREFIX,SUBMIT_DIR" |
---|
7347 | IGCM_sys_RshMaster "\ |
---|
7348 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh; \ |
---|
7349 | export ExeOutDateMax=${ExeOutDateMax};\ |
---|
7350 | export R_OUT_EXE=${R_OUT_EXE};\ |
---|
7351 | export PREFIX=${PREFIX};\ |
---|
7352 | export SUBMIT_DIR=${SUBMIT_DIR};\ |
---|
7353 | export listVarEnv=${listVarEnv};\ |
---|
7354 | Script_Output=out_SaveSourceModifications;\ |
---|
7355 | IGCM_sys_Qsub ${libIGCM}/SaveSourceModifications.job ${ExeOutDateMax} ${R_OUT_EXE} ${PREFIX} ${SUBMIT_DIR}" |
---|
7356 | |
---|
7357 | IGCM_debug_PopStack "IGCM_config_SaveSourceModifications" |
---|
7358 | } |
---|
7359 | |
---|
7360 | #=================================== |
---|
7361 | function IGCM_config_PeriodEnd |
---|
7362 | { |
---|
7363 | IGCM_debug_PushStack "IGCM_config_PeriodEnd" |
---|
7364 | |
---|
7365 | echo |
---|
7366 | IGCM_debug_Print 1 "IGCM_config_PeriodEnd" |
---|
7367 | echo |
---|
7368 | |
---|
7369 | if [ ${DRYRUN} -le 1 ] ; then |
---|
7370 | |
---|
7371 | IGCM_debug_Print 1 "Check components binary : size and creation date" |
---|
7372 | |
---|
7373 | typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize |
---|
7374 | typeset comp i |
---|
7375 | typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax |
---|
7376 | |
---|
7377 | #==================================# |
---|
7378 | # Get last Exe Size # |
---|
7379 | #==================================# |
---|
7380 | |
---|
7381 | (( i=0 )) |
---|
7382 | if ( ${FirstInitialize} ) ; then |
---|
7383 | run_Log_LastExeSize="" |
---|
7384 | for comp in ${config_ListOfComponents[*]} ; do |
---|
7385 | run_Log_LastExeSize[$i]=0 |
---|
7386 | (( i=i+1 )) |
---|
7387 | done |
---|
7388 | else |
---|
7389 | IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize |
---|
7390 | fi |
---|
7391 | #==================================# |
---|
7392 | # And Build ExeDate # |
---|
7393 | #==================================# |
---|
7394 | |
---|
7395 | # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33 |
---|
7396 | # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M") |
---|
7397 | # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34 |
---|
7398 | ExeDate="" |
---|
7399 | NextExeSize="( " |
---|
7400 | (( i=0 )) |
---|
7401 | UpdateExe=false |
---|
7402 | (( ExeSecDateMax = 0 )) |
---|
7403 | for comp in ${config_ListOfComponents[*]} ; do |
---|
7404 | |
---|
7405 | IGCM_debug_Print 3 ${comp} |
---|
7406 | |
---|
7407 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
7408 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
7409 | # Only if we really have an executable for the component : |
---|
7410 | if [ X${ExeNameIn} = X\"\" ] ; then |
---|
7411 | # If there is no exe file for this component |
---|
7412 | (( ExeSize=0 )) |
---|
7413 | else |
---|
7414 | LS_bin=${R_EXE}/${ExeNameIn} |
---|
7415 | IGCM_sys_FileSize ${LS_bin} ExeSize |
---|
7416 | |
---|
7417 | set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} ) |
---|
7418 | if [ X${ExeDate} = X ] ; then |
---|
7419 | # First component exe date |
---|
7420 | ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]} |
---|
7421 | else |
---|
7422 | ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]} |
---|
7423 | fi |
---|
7424 | ExeDate=${ExeDate}_${LS_comp[7]} |
---|
7425 | fi |
---|
7426 | |
---|
7427 | if [ ${i} -eq 0 ] ; then |
---|
7428 | # First component |
---|
7429 | NextExeSize="( "${ExeSize} |
---|
7430 | else |
---|
7431 | NextExeSize=${NextExeSize}", "${ExeSize} |
---|
7432 | fi |
---|
7433 | LastCompExeSize=${run_Log_LastExeSize[$i]} |
---|
7434 | (( i=i+1 )) |
---|
7435 | |
---|
7436 | if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then |
---|
7437 | if ( ${FirstInitialize} ) ; then |
---|
7438 | IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !" |
---|
7439 | else |
---|
7440 | IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" |
---|
7441 | IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !" |
---|
7442 | FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} |
---|
7443 | fi |
---|
7444 | IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw |
---|
7445 | UpdateExe=true |
---|
7446 | |
---|
7447 | # SD : switch off for now |
---|
7448 | #IGCM_sys_GetDate_FichWork ${LS_bin} ExeSecDate |
---|
7449 | #if [ $ExeSecDateMax -lt $ExeSecDate ] ; then |
---|
7450 | # ExeSecDateMax=$ExeSecDate |
---|
7451 | #fi |
---|
7452 | fi |
---|
7453 | done |
---|
7454 | |
---|
7455 | # SD : switch off for now |
---|
7456 | #if ( ${UpdateExe} ) ; then |
---|
7457 | # echo "Launch SaveSourceModifications." |
---|
7458 | # IGCM_config_SaveSourceModifications ${ExeSecDateMax} |
---|
7459 | #fi |
---|
7460 | |
---|
7461 | NextExeSize=${NextExeSize}" )" |
---|
7462 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" |
---|
7463 | |
---|
7464 | if [ ${DRYRUN} -le 1 ] ; then |
---|
7465 | tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt |
---|
7466 | ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) |
---|
7467 | RET=$? |
---|
7468 | if [ $RET -eq 0 ] ; then |
---|
7469 | # ExeCpuLog variable contents 5 fields |
---|
7470 | echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" | \ |
---|
7471 | gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \ |
---|
7472 | $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card |
---|
7473 | fi |
---|
7474 | FileToBeDeleted[${#FileToBeDeleted[@]}]=${Exe_Output}_tail.txt |
---|
7475 | fi |
---|
7476 | |
---|
7477 | fi |
---|
7478 | |
---|
7479 | #==================================# |
---|
7480 | # Save Job output # |
---|
7481 | #==================================# |
---|
7482 | if [ X${Pack} = Xtrue ] ; then |
---|
7483 | IGCM_sys_PutBuffer_Out ${Exe_Output} ${R_BUF_KSH}/${PREFIX}_${Exe_Output} |
---|
7484 | else |
---|
7485 | IGCM_sys_Put_Out ${Exe_Output} ${R_OUT_KSH}/${PREFIX}_${Exe_Output} |
---|
7486 | fi |
---|
7487 | FileToBeDeleted[${#FileToBeDeleted[@]}]=${Exe_Output} |
---|
7488 | |
---|
7489 | # All was right ? no ? then we stop. |
---|
7490 | IGCM_debug_Verif_Exit |
---|
7491 | |
---|
7492 | # If all was OK, we can delete all files not necessary for next Job |
---|
7493 | echo |
---|
7494 | IGCM_debug_Print 1 "Files that will be deleted before next period-run : " |
---|
7495 | |
---|
7496 | if [ ${DRYRUN} -le 2 ] ; then |
---|
7497 | for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done |
---|
7498 | else |
---|
7499 | echo ${FileToBeDeleted[@]} |
---|
7500 | fi |
---|
7501 | |
---|
7502 | # Send some accounting element to the user if CumulPeriod=3 |
---|
7503 | if [ ${CumulPeriod} -eq 3 ] ; then |
---|
7504 | echo |
---|
7505 | IGCM_debug_Print 1 "Send email containing some accounting information : " |
---|
7506 | |
---|
7507 | RealCpuTime=$( echo ${ExeCpuLog} | gawk '{print $3}' ) |
---|
7508 | |
---|
7509 | consumeHoursPerPeriod=$( echo "scale=6;${RealCpuTime}*${coreNumber}/3600" | bc ) |
---|
7510 | |
---|
7511 | consumeHoursPerWholeSimulation=$( echo "scale=6;${consumeHoursPerPeriod}/${PeriodLengthInDays}*${ExperienceLengthInDays}" | bc ) |
---|
7512 | |
---|
7513 | recommendedPeriodNb=$( echo "scale=6;${jobWarningDelay}/3600/${consumeHoursPerPeriod}*${coreNumber}" | bc ) |
---|
7514 | |
---|
7515 | IGCM_sys_SendMail Accounting |
---|
7516 | fi |
---|
7517 | |
---|
7518 | #=================================================# |
---|
7519 | # Modification of libIGCM behaviour # |
---|
7520 | #=================================================# |
---|
7521 | |
---|
7522 | # To use this function, one must copy libIGCM.card from ${libIGCM} directory |
---|
7523 | # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card, |
---|
7524 | # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. |
---|
7525 | if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then |
---|
7526 | echo |
---|
7527 | echo "########################################################################" |
---|
7528 | echo "!!! Modification of libIGCM behaviour !!!" |
---|
7529 | echo |
---|
7530 | |
---|
7531 | IGCM_debug_Print 1 "DefineArrayFromOption : libIGCM_UserChanges in libIGCM.card" |
---|
7532 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges |
---|
7533 | IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]} |
---|
7534 | |
---|
7535 | # Special treatments for libIGCM internals |
---|
7536 | for option in ${libIGCM_UserChanges[*]} ; do |
---|
7537 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option} |
---|
7538 | |
---|
7539 | echo "We will change : ${option}." |
---|
7540 | eval echo "Previous value : " \${${option}} |
---|
7541 | eval echo "Change to : " \${libIGCM_UserChanges_${option}} |
---|
7542 | |
---|
7543 | eval ${option}=\${libIGCM_UserChanges_${option}} |
---|
7544 | |
---|
7545 | case ${option} in |
---|
7546 | config_UserChoices_DateEnd) |
---|
7547 | IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd |
---|
7548 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
7549 | |
---|
7550 | # Period Length In Days between DateBegin and DateEnd |
---|
7551 | (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) |
---|
7552 | if [ ${ExperienceLengthInDays} -lt 0 ] ; then |
---|
7553 | IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that." |
---|
7554 | IGCM_debug_Exit "IGCM_PeriodEnd have wrong dates." |
---|
7555 | IGCM_debug_Verif_Exit |
---|
7556 | fi |
---|
7557 | ;; |
---|
7558 | config_UserChoices_PeriodLength) |
---|
7559 | IGCM_debug_Print 1 "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}" |
---|
7560 | ;; |
---|
7561 | PeriodNb) |
---|
7562 | IGCM_debug_Print 1 "Loop in main Job with ${PeriodNb} period(s)" |
---|
7563 | ;; |
---|
7564 | config_Post_RebuildFrequency) |
---|
7565 | IGCM_debug_Print 1 "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" |
---|
7566 | IGCM_post_Configure |
---|
7567 | ;; |
---|
7568 | config_Post_TimeSeriesFrequency) |
---|
7569 | IGCM_debug_Print 1 "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Configure" |
---|
7570 | IGCM_post_Configure |
---|
7571 | ;; |
---|
7572 | config_Post_SeasonalFrequency) |
---|
7573 | IGCM_debug_Print 1 "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Configure" |
---|
7574 | IGCM_post_Configure |
---|
7575 | ;; |
---|
7576 | esac |
---|
7577 | done |
---|
7578 | |
---|
7579 | echo |
---|
7580 | echo "########################################################################" |
---|
7581 | echo |
---|
7582 | fi |
---|
7583 | |
---|
7584 | #=================================================# |
---|
7585 | # Determine next computed period # |
---|
7586 | #=================================================# |
---|
7587 | |
---|
7588 | PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 ) |
---|
7589 | IGCM_date_GetYearMonthDay $PeriodDateBegin year month day |
---|
7590 | year_m1=$(( year - 1 )) |
---|
7591 | year_p1=$(( year + 1 )) |
---|
7592 | IGCM_config_DaysInPeriodLength |
---|
7593 | PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) ) |
---|
7594 | |
---|
7595 | # Debug Print : |
---|
7596 | echo |
---|
7597 | IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution" |
---|
7598 | IGCM_debug_Print 1 "PeriodDateBegin : ${PeriodDateBegin}" |
---|
7599 | IGCM_debug_Print 1 "PeriodDateEnd : ${PeriodDateEnd}" |
---|
7600 | IGCM_debug_Print 1 "PeriodLengthInDays : ${PeriodLengthInDays}" |
---|
7601 | |
---|
7602 | PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} ) |
---|
7603 | PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} ) |
---|
7604 | |
---|
7605 | (( CumulPeriod = CumulPeriod + 1 )) |
---|
7606 | |
---|
7607 | # Debug Print : |
---|
7608 | echo |
---|
7609 | IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}" |
---|
7610 | IGCM_debug_Print 3 "PeriodDateEnd Human : ${PeriodDateEnd}" |
---|
7611 | IGCM_debug_Print 3 "CumulPeriod : ${CumulPeriod}" |
---|
7612 | |
---|
7613 | #=================================================# |
---|
7614 | # Write updated run.card # |
---|
7615 | #=================================================# |
---|
7616 | |
---|
7617 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} |
---|
7618 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} |
---|
7619 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} |
---|
7620 | |
---|
7621 | if ( ${FirstInitialize} ) ; then |
---|
7622 | # It's no more the first time |
---|
7623 | FirstInitialize=false |
---|
7624 | fi |
---|
7625 | |
---|
7626 | IGCM_debug_PopStack "IGCM_config_PeriodEnd" |
---|
7627 | } |
---|
7628 | |
---|
7629 | #=================================== |
---|
7630 | function IGCM_config_Finalize |
---|
7631 | { |
---|
7632 | IGCM_debug_PushStack "IGCM_config_Finalize" |
---|
7633 | |
---|
7634 | echo |
---|
7635 | IGCM_debug_Print 1 "IGCM_config_Finalize" |
---|
7636 | echo |
---|
7637 | |
---|
7638 | # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal" |
---|
7639 | IGCM_config_StateCheck |
---|
7640 | |
---|
7641 | # And EXIT if not OK |
---|
7642 | IGCM_debug_Verif_Exit |
---|
7643 | |
---|
7644 | if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then |
---|
7645 | #==========================# |
---|
7646 | # End of entire simulation # |
---|
7647 | #==========================# |
---|
7648 | simulationIsOver=true |
---|
7649 | |
---|
7650 | # Mail notification |
---|
7651 | IGCM_sys_SendMail |
---|
7652 | # |
---|
7653 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed" |
---|
7654 | # |
---|
7655 | IGCM_debug_Print 1 "Normal End of computation." |
---|
7656 | |
---|
7657 | else |
---|
7658 | #=================# |
---|
7659 | # Submit next job # |
---|
7660 | #=================# |
---|
7661 | simulationIsOver=false |
---|
7662 | |
---|
7663 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" |
---|
7664 | |
---|
7665 | # Name of next Ksh Script output : |
---|
7666 | Script_Output=${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} ) |
---|
7667 | |
---|
7668 | IGCM_debug_Print 1 "Submit next job" |
---|
7669 | # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR |
---|
7670 | IGCM_sys_Cd ${SUBMIT_DIR} |
---|
7671 | # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName} |
---|
7672 | ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l ) |
---|
7673 | [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) ) |
---|
7674 | # Submit next job and come back |
---|
7675 | IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} |
---|
7676 | IGCM_sys_Cd - |
---|
7677 | fi |
---|
7678 | |
---|
7679 | # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_JobName}.${$} |
---|
7680 | # Only for production run (No clean up in DEV or DEB mode) |
---|
7681 | # and command sent from .. directory. |
---|
7682 | IGCM_sys_Cd .. |
---|
7683 | [ X${JobType} = XRUN ] && IGCM_sys_RmRunDir -rf ${RUN_DIR_PATH} |
---|
7684 | |
---|
7685 | # Inform the rabbitMQ queue |
---|
7686 | IGCM_debug_BigBro_Finalize |
---|
7687 | |
---|
7688 | IGCM_debug_PopStack "IGCM_config_Finalize" |
---|
7689 | } |
---|
7690 | |
---|
7691 | #=================================== |
---|
7692 | #------- |
---|
7693 | IGCM_sys_MkdirWork ${RUN_DIR_PATH} |
---|
7694 | + IGCM_sys_MkdirWork /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313 |
---|
7695 | IGCM_sys_MkdirWork : /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313 |
---|
7696 | IGCM_sys_Cd ${RUN_DIR_PATH} |
---|
7697 | + IGCM_sys_Cd /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313 |
---|
7698 | IGCM_sys_Cd : /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313 |
---|
7699 | #------- |
---|
7700 | ( ${DEBUG_debug} ) && IGCM_debug_Check |
---|
7701 | + false |
---|
7702 | ( ${DEBUG_debug} ) && IGCM_card_Check |
---|
7703 | + false |
---|
7704 | ( ${DEBUG_debug} ) && IGCM_date_Check |
---|
7705 | |
---|
7706 | + false |
---|
7707 | ######################################################################## |
---|
7708 | |
---|
7709 | #set -vx |
---|
7710 | |
---|
7711 | # Useful cleaning function |
---|
7712 | MENAGE () |
---|
7713 | { |
---|
7714 | typeset ExistFlag |
---|
7715 | ExistFlag=$( IGCM_sys_RshArchive "[ -f $1/$3 ] && echo 0 || echo 1" ) |
---|
7716 | [ ${ExistFlag} -eq 0 ] && ( IGCM_sys_RshArchive rm -f $1/$2 ;) |
---|
7717 | } |
---|
7718 | |
---|
7719 | ######################################################################## |
---|
7720 | |
---|
7721 | # ------------------------------------------------------------------ |
---|
7722 | # Test if all was right before proceeding further |
---|
7723 | # ------------------------------------------------------------------ |
---|
7724 | IGCM_debug_Verif_Exit |
---|
7725 | |
---|
7726 | + IGCM_debug_Verif_Exit |
---|
7727 | if [ ${StandAlone} = true ] ; then |
---|
7728 | CARD_DIR=${SUBMIT_DIR} |
---|
7729 | else |
---|
7730 | CARD_DIR=${RUN_DIR_PATH} |
---|
7731 | |
---|
7732 | IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH} |
---|
7733 | |
---|
7734 | IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card ${RUN_DIR_PATH} |
---|
7735 | |
---|
7736 | IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP ${RUN_DIR_PATH} |
---|
7737 | |
---|
7738 | IGCM_sys_Get_Master ${SUBMIT_DIR}/POST ${RUN_DIR_PATH} |
---|
7739 | fi |
---|
7740 | |
---|
7741 | + [ true '=' true ] |
---|
7742 | + CARD_DIR=/ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030 |
---|
7743 | #================================== |
---|
7744 | # First of all |
---|
7745 | # |
---|
7746 | # Read libIGCM compatibility version in config.card |
---|
7747 | # Read UserChoices section |
---|
7748 | # Read Ensemble section |
---|
7749 | # Read Post section |
---|
7750 | # Define all netcdf output directories |
---|
7751 | #================================== |
---|
7752 | IGCM_config_CommonConfiguration ${CARD_DIR}/config.card |
---|
7753 | |
---|
7754 | + IGCM_config_CommonConfiguration /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/config.card |
---|
7755 | |
---|
7756 | 2018-07-27 12:34:18 --Debug1--> IGCM_config_CommonConfiguration |
---|
7757 | 2018-07-27 12:34:18 --Debug1--> /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/config.card |
---|
7758 | |
---|
7759 | 2018-07-27 12:34:18 --Debug1--> DefineArrayFromOption : config_UserChoices |
---|
7760 | unset config_UserChoicesconfig_UserChoices[0]=_0_echo ${config_UserChoices[@]}config_UserChoices_JobName=CM61-LR-hist-03.2030auxprint=${config_UserChoices_JobName}2018-07-27 12:34:18 --------------Debug3--> JobName : CM61-LR-hist-03.2030 |
---|
7761 | config_UserChoices_ExperimentName=historicalauxprint=${config_UserChoices_ExperimentName}2018-07-27 12:34:18 --------------Debug3--> ExperimentName : historical |
---|
7762 | config_UserChoices_SpaceName=PRODauxprint=${config_UserChoices_SpaceName}2018-07-27 12:34:18 --------------Debug3--> SpaceName : PROD |
---|
7763 | config_UserChoices_LongName="IPSLCM6.1.3-LR"auxprint=${config_UserChoices_LongName}2018-07-27 12:34:18 --------------Debug3--> LongName : IPSLCM6.1.3-LR |
---|
7764 | config_UserChoices_TagName=IPSLCM6auxprint=${config_UserChoices_TagName}2018-07-27 12:34:18 --------------Debug3--> TagName : IPSLCM6 |
---|
7765 | config_UserChoices_Member=r6i1p1f1auxprint=${config_UserChoices_Member}2018-07-27 12:34:18 --------------Debug3--> Member : r6i1p1f1 |
---|
7766 | config_UserChoices_ExpType=IPSLCM/historical_CMIP6auxprint=${config_UserChoices_ExpType}2018-07-27 12:34:18 --------------Debug3--> ExpType : IPSLCM/historical_CMIP6 |
---|
7767 | config_UserChoices_CalendarType=leapauxprint=${config_UserChoices_CalendarType}2018-07-27 12:34:18 --------------Debug3--> CalendarType : leap |
---|
7768 | config_UserChoices_DateBegin=1850-01-01auxprint=${config_UserChoices_DateBegin}2018-07-27 12:34:18 --------------Debug3--> DateBegin : 1850-01-01 |
---|
7769 | config_UserChoices_DateEnd=2014-12-31auxprint=${config_UserChoices_DateEnd}2018-07-27 12:34:18 --------------Debug3--> DateEnd : 2014-12-31 |
---|
7770 | config_UserChoices_ORCA_version=eORCA1.2auxprint=${config_UserChoices_ORCA_version}2018-07-27 12:34:18 --------------Debug3--> ORCA_version : eORCA1.2 |
---|
7771 | config_UserChoices_PeriodLength=1Yauxprint=${config_UserChoices_PeriodLength}2018-07-27 12:34:18 --------------Debug3--> PeriodLength : 1Y |
---|
7772 | |
---|
7773 | 2018-07-27 12:34:18 --Debug1--> DefineArrayFromOption : config_Ensemble |
---|
7774 | unset config_Ensembleconfig_Ensemble[0]=_0_echo ${config_Ensemble[@]} |
---|
7775 | 2018-07-27 12:34:18 --Debug1--> Warning with readding of config_Ensemble variable in /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/config.card. |
---|
7776 | 2018-07-27 12:34:18 --Debug1--> Warning: Section Ensemble not found |
---|
7777 | unset config_Ensemble |
---|
7778 | 2018-07-27 12:34:18 --Debug1--> DefineArrayFromOption : config_Post |
---|
7779 | unset config_Postconfig_Post[0]=_0_echo ${config_Post[@]}config_Post_ParserXIOS=FALSEauxprint=${config_Post_ParserXIOS}2018-07-27 12:34:18 --------------Debug3--> ParserXIOS : FALSE |
---|
7780 | config_Post_RebuildFrequency=NONEauxprint=${config_Post_RebuildFrequency}2018-07-27 12:34:18 --------------Debug3--> RebuildFrequency : NONE |
---|
7781 | config_Post_PackFrequency=10Yauxprint=${config_Post_PackFrequency}2018-07-27 12:34:18 --------------Debug3--> PackFrequency : 10Y |
---|
7782 | config_Post_LightRestartPack=FALSEauxprint=${config_Post_LightRestartPack}2018-07-27 12:34:18 --------------Debug3--> LightRestartPack : FALSE |
---|
7783 | config_Post_TimeSeriesFrequency=10Yauxprint=${config_Post_TimeSeriesFrequency}2018-07-27 12:34:18 --------------Debug3--> TimeSeriesFrequency : 10Y |
---|
7784 | config_Post_SeasonalFrequency=10Yauxprint=${config_Post_SeasonalFrequency}2018-07-27 12:34:18 --------------Debug3--> SeasonalFrequency : 10Y |
---|
7785 | config_Post_MetricsPCMDI=FALSEauxprint=${config_Post_MetricsPCMDI}2018-07-27 12:34:18 --------------Debug3--> MetricsPCMDI : FALSE |
---|
7786 | config_Post_SeasonalFrequencyOffset=0auxprint=${config_Post_SeasonalFrequencyOffset}2018-07-27 12:34:18 --------------Debug3--> SeasonalFrequencyOffset : 0 |
---|
7787 | |
---|
7788 | 2018-07-27 12:34:18 --Debug1--> R_OUT has been defined = /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT |
---|
7789 | 2018-07-27 12:34:18 --Debug1--> R_BUF has been defined = /ccc/scratch/cont003/gencmip6/oboucher/IGCM_OUT |
---|
7790 | 2018-07-27 12:34:18 --Debug1--> R_FIG has been defined = /ccc/work/cont003/gencmip6/oboucher/IGCM_OUT |
---|
7791 | IGCM_sys_MkdirWork : /ccc/scratch/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/REBUILD |
---|
7792 | # ------------------------------------------------------------------ |
---|
7793 | # Activate BigBrother so as to supervise this job |
---|
7794 | # ------------------------------------------------------------------ |
---|
7795 | IGCM_debug_BigBro_Initialize |
---|
7796 | |
---|
7797 | + IGCM_debug_BigBro_Initialize |
---|
7798 | #================================== |
---|
7799 | # Define default value to keep compatibility with previous card: means before changes due to TGCC |
---|
7800 | if [ X${PackDefault} = Xtrue ] ; then |
---|
7801 | [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency} |
---|
7802 | else |
---|
7803 | config_Post_PackFrequency=NONE |
---|
7804 | fi |
---|
7805 | |
---|
7806 | + [ Xtrue '=' Xtrue ] |
---|
7807 | + [ X10Y '=' X ] |
---|
7808 | #================================== |
---|
7809 | # If pack is active then PackFrequency overule the config_UserChoices_PeriodLength |
---|
7810 | if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then |
---|
7811 | config_UserChoices_PeriodLength=${config_Post_PackFrequency} |
---|
7812 | fi |
---|
7813 | |
---|
7814 | + [ ! X10Y '=' X_0_ ] |
---|
7815 | + [ ! X10Y '=' XNONE ] |
---|
7816 | + config_UserChoices_PeriodLength=10Y |
---|
7817 | # |
---|
7818 | # Determine component to take care of depending on kind of task create_ts will perform |
---|
7819 | # |
---|
7820 | [ ${CompToRead} ] && set -A config_ListOfComponents ${CompToRead} || IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents |
---|
7821 | + [ OCE ] |
---|
7822 | + set -A config_ListOfComponents OCE |
---|
7823 | # |
---|
7824 | # Determine period for time series. Default : value from AA_job or from launch_TS if any |
---|
7825 | # |
---|
7826 | [ X${CompletedFlag} = X ] || CompletedFlag=$( IGCM_date_ConvertFormatToGregorian ${CompletedFlag} ) |
---|
7827 | |
---|
7828 | + [ X '=' X ] |
---|
7829 | DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )} |
---|
7830 | + DateBegin=18500101 |
---|
7831 | # |
---|
7832 | PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )} |
---|
7833 | + PeriodDateEnd=19491231 |
---|
7834 | # |
---|
7835 | # Determine Dimension of the produced time series : 2D or 3D |
---|
7836 | if ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = X2D ] ) ; then |
---|
7837 | Dimension=2D |
---|
7838 | elif ( [ X${TsTask} = XChunck3D ] || [ X${TsTask} = X3D ] ) ; then |
---|
7839 | Dimension=3D |
---|
7840 | else |
---|
7841 | Dimension="" |
---|
7842 | fi |
---|
7843 | |
---|
7844 | + [ XChunck3D '=' XChunck2D ] |
---|
7845 | + [ XChunck3D '=' X2D ] |
---|
7846 | + [ XChunck3D '=' XChunck3D ] |
---|
7847 | + Dimension=3D |
---|
7848 | # ------------------------------------------------------------------ |
---|
7849 | #D- Test if all was right before entering the loop |
---|
7850 | # ------------------------------------------------------------------ |
---|
7851 | IGCM_debug_Verif_Exit |
---|
7852 | |
---|
7853 | + IGCM_debug_Verif_Exit |
---|
7854 | ######################################################################## |
---|
7855 | # Depending on requested time series fill following variables : |
---|
7856 | # |
---|
7857 | # - LISTE_FILE_${comp}[*] |
---|
7858 | # - LISTE_VARS_${file}[*] |
---|
7859 | # - LISTE_AXIS_${file}[*] |
---|
7860 | # - LISTE_PATCH_${file}[*] |
---|
7861 | ######################################################################## |
---|
7862 | |
---|
7863 | # |
---|
7864 | # For each selected component determine which files need post-processing |
---|
7865 | # |
---|
7866 | DoJob=false |
---|
7867 | + DoJob=false |
---|
7868 | for comp in ${config_ListOfComponents[*]} ; do |
---|
7869 | # |
---|
7870 | ActiveComp=false |
---|
7871 | # |
---|
7872 | IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp} |
---|
7873 | eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 |
---|
7874 | # |
---|
7875 | card=${CARD_DIR}/COMP/${compname}.card |
---|
7876 | |
---|
7877 | IGCM_card_DefineArrayFromOption ${card} OutputFiles List |
---|
7878 | # |
---|
7879 | ListFilesName=${compname}_OutputFiles_List |
---|
7880 | eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 |
---|
7881 | # |
---|
7882 | if [ X${FileName0} != X${NULL_STR} ] ; then |
---|
7883 | # |
---|
7884 | #IGCM_debug_Print 1 "Component : ${compname}" |
---|
7885 | # |
---|
7886 | # INITIALISATION |
---|
7887 | # |
---|
7888 | typeset i |
---|
7889 | if [ ${FlagToRead} ] ; then |
---|
7890 | ((NbFiles=${FlagToRead})) |
---|
7891 | ((i=${NbFiles})) |
---|
7892 | else |
---|
7893 | eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 |
---|
7894 | i=2 |
---|
7895 | fi |
---|
7896 | # |
---|
7897 | until [ $i -gt $NbFiles ]; do |
---|
7898 | # |
---|
7899 | eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1 |
---|
7900 | # |
---|
7901 | if [ X${flag_post} != XNONE ] ; then |
---|
7902 | # |
---|
7903 | # For each comp and each file who needs post-processing |
---|
7904 | # determine which variables need time series. |
---|
7905 | # |
---|
7906 | FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' ) |
---|
7907 | IGCM_card_DefineArrayFromOption ${card} Post_${FILE} TimeSeriesVars${Dimension} |
---|
7908 | IGCM_card_DefineVariableFromOption ${card} Post_${FILE} ChunckJob${Dimension} |
---|
7909 | # |
---|
7910 | # If TimeSeriesVars list is empty we skip |
---|
7911 | # |
---|
7912 | if [ $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then |
---|
7913 | # |
---|
7914 | IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}" |
---|
7915 | IGCM_debug_Print 3 "TimeSeriesVars${Dimension} for ${FILE} is empty" |
---|
7916 | (( i=i+3 )) |
---|
7917 | continue |
---|
7918 | # |
---|
7919 | fi |
---|
7920 | # |
---|
7921 | # If files/variables has been switch off by ChunckJob${Dimension}=0 we skip |
---|
7922 | # |
---|
7923 | if [ X$( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = XOFF ] ; then |
---|
7924 | IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}" |
---|
7925 | IGCM_debug_Print 3 "ChunckJob${Dimension}=OFF for ${FILE} so it has been switched off" |
---|
7926 | (( i=i+3 )) |
---|
7927 | continue |
---|
7928 | fi |
---|
7929 | # |
---|
7930 | # If we are not a Chunck type task, we skip files/variables handled by chunck task |
---|
7931 | # |
---|
7932 | if ( [ ! X${TsTask} = XChunck${Dimension} ] && [ ! X${TsTask} = X ] && [ ! XChunck${Dimension} = XChunck ] ) ; then |
---|
7933 | if [ ! $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = NONE ] ; then |
---|
7934 | IGCM_debug_Print 3 "Nothing to do for ${FILE} TimeSeriesVars${Dimension} according to ${card}" |
---|
7935 | IGCM_debug_Print 3 "Let another chunck task do the job $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} )" |
---|
7936 | (( i=i+3 )) |
---|
7937 | continue |
---|
7938 | fi |
---|
7939 | fi |
---|
7940 | # |
---|
7941 | # Now on we know we have things to do |
---|
7942 | # |
---|
7943 | |
---|
7944 | # |
---|
7945 | # We need coordinates axis to properly fill produced time series |
---|
7946 | # |
---|
7947 | IGCM_card_DefineArrayFromOption ${card} Post_${FILE} GatherWithInternal |
---|
7948 | # |
---|
7949 | if [ $( eval echo \${${compname}_Post_${FILE}_GatherWithInternal} ) = ${NULL_STR} ] ; then |
---|
7950 | # |
---|
7951 | IGCM_debug_Print 1 "ERROR !! We miss coordinate axis for ${FILE} according to ${card}" |
---|
7952 | IGCM_debug_Print 1 "So no time series will be produced for ${FILE} !!" |
---|
7953 | (( i=i+3 )) |
---|
7954 | continue |
---|
7955 | # |
---|
7956 | fi |
---|
7957 | # |
---|
7958 | # We need LIST of variables not allready produced (useful for standalone mode) |
---|
7959 | # |
---|
7960 | FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' ) |
---|
7961 | case ${FlagDir} in |
---|
7962 | *Y) TS_Dir=TS_YE ;; |
---|
7963 | *M) TS_Dir=TS_MO ;; |
---|
7964 | *D) TS_Dir=TS_DA ;; |
---|
7965 | HF) TS_Dir=TS_HF ;; |
---|
7966 | 3H) TS_Dir=TS_HF ;; |
---|
7967 | INS) TS_Dir=TS_INS ;; |
---|
7968 | esac |
---|
7969 | # |
---|
7970 | count=0 |
---|
7971 | for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do |
---|
7972 | # |
---|
7973 | DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir} |
---|
7974 | TestedFile=${config_UserChoices_JobName}_${DateBegin}_${PeriodDateEnd}_${FlagDir}_${var}.nc |
---|
7975 | # |
---|
7976 | IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} |
---|
7977 | if [ ! $? = 0 ] ; then |
---|
7978 | eval set +A LISTE_VARS_${FILE} \${LISTE_VARS_${FILE}[*]} ${var} |
---|
7979 | ActiveComp=true |
---|
7980 | (( count = count + 1 )) |
---|
7981 | fi |
---|
7982 | done |
---|
7983 | # |
---|
7984 | if [ ${count} -gt 0 ] ; then |
---|
7985 | # |
---|
7986 | eval set +A LISTE_FILE_${comp} \${LISTE_FILE_${comp}[*]} ${FILE} |
---|
7987 | eval set +A LISTE_AXIS_${FILE} \${${compname}_Post_${FILE}_GatherWithInternal[*]} |
---|
7988 | # |
---|
7989 | if [ ! X${RebuildFrequency} = Xtrue ] ; then |
---|
7990 | IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches |
---|
7991 | eval set +A LISTE_PATCHES_${FILE} \${${compname}_Post_${FILE}_Patches[*]} |
---|
7992 | if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) != X${NULL_STR} ]; then |
---|
7993 | for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do |
---|
7994 | if [ Xload${Patch} != X ] ; then |
---|
7995 | . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh |
---|
7996 | eval load${Patch}=loaded |
---|
7997 | fi |
---|
7998 | done |
---|
7999 | fi |
---|
8000 | fi |
---|
8001 | fi |
---|
8002 | fi |
---|
8003 | (( i=i+3 )) |
---|
8004 | done |
---|
8005 | fi |
---|
8006 | # |
---|
8007 | if [ ${ActiveComp} = true ] ; then |
---|
8008 | set +A ActiveListOfComponents ${ActiveListOfComponents[*]} ${comp} |
---|
8009 | fi |
---|
8010 | done |
---|
8011 | |
---|
8012 | + ActiveComp=false |
---|
8013 | + IGCM_card_DefineArrayFromOption /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/config.card ListOfComponents OCE |
---|
8014 | unset config_ListOfComponents_OCEconfig_ListOfComponents_OCE[0]=_0_+ eval compname='${config_ListOfComponents_OCE[0]}' |
---|
8015 | + 1> /dev/null 2>& 1 |
---|
8016 | + card=/ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/COMP/opa9.card |
---|
8017 | + IGCM_card_DefineArrayFromOption /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/COMP/opa9.card OutputFiles List |
---|
8018 | unset opa9_OutputFiles_Listopa9_OutputFiles_List[0]=_0_+ ListFilesName=opa9_OutputFiles_List |
---|
8019 | + eval FileName0='${opa9_OutputFiles_List[0]}' |
---|
8020 | + 1> /dev/null 2>& 1 |
---|
8021 | + [ 'X${config_UserChoices_JobName}_1y_scalar.nc' '!=' X_0_ ] |
---|
8022 | + typeset i |
---|
8023 | + [ 47 ] |
---|
8024 | + ((NbFiles=47)) |
---|
8025 | + ((i=47)) |
---|
8026 | + [ 47 -gt 47 ] |
---|
8027 | + eval flag_post='${opa9_OutputFiles_List[47]}' |
---|
8028 | + 1> /dev/null 2>& 1 |
---|
8029 | + [ XPost_1M_trdtra '!=' XNONE ] |
---|
8030 | + echo Post_1M_trdtra |
---|
8031 | + awk -FPost_ '{print $2}' |
---|
8032 | + FILE=1M_trdtra |
---|
8033 | + IGCM_card_DefineArrayFromOption /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/COMP/opa9.card Post_1M_trdtra TimeSeriesVars3D |
---|
8034 | unset opa9_Post_1M_trdtra_TimeSeriesVars3Dopa9_Post_1M_trdtra_TimeSeriesVars3D[0]=_0_+ IGCM_card_DefineVariableFromOption /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/COMP/opa9.card Post_1M_trdtra ChunckJob3D |
---|
8035 | opa9_Post_1M_trdtra_ChunckJob3D=100Y+ eval echo '${opa9_Post_1M_trdtra_TimeSeriesVars3D}' |
---|
8036 | echo ${opa9_Post_1M_trdtra_TimeSeriesVars3D}+ echo ttrdtr_zdfp |
---|
8037 | + [ ttrdtr_zdfp '=' _0_ ] |
---|
8038 | + eval echo '${opa9_Post_1M_trdtra_ChunckJob3D}' |
---|
8039 | echo ${opa9_Post_1M_trdtra_ChunckJob3D}+ echo 100Y |
---|
8040 | + [ X100Y '=' XOFF ] |
---|
8041 | + [ ! XChunck3D '=' XChunck3D ] |
---|
8042 | + IGCM_card_DefineArrayFromOption /ccc/cont003/home/gencmip6/oboucher/IPSLCM613/modipsl/config/IPSLCM6/CM61-LR-hist-03.2030/COMP/opa9.card Post_1M_trdtra GatherWithInternal |
---|
8043 | unset opa9_Post_1M_trdtra_GatherWithInternalopa9_Post_1M_trdtra_GatherWithInternal[0]=_0_+ eval echo '${opa9_Post_1M_trdtra_GatherWithInternal}' |
---|
8044 | echo ${opa9_Post_1M_trdtra_GatherWithInternal}+ echo nav_lon |
---|
8045 | + [ nav_lon '=' _0_ ] |
---|
8046 | + echo 1M_trdtra |
---|
8047 | + awk -F _ '{print $1}' |
---|
8048 | + FlagDir=1M |
---|
8049 | + TS_Dir=TS_MO |
---|
8050 | + count=0 |
---|
8051 | + eval echo '${opa9_Post_1M_trdtra_TimeSeriesVars3D[*]}' |
---|
8052 | echo ${opa9_Post_1M_trdtra_TimeSeriesVars3D[*]}+ echo ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad ttrdtr_tot strdtr_zdfp strdtr_eivad strdtr_iso strdtr_totad strdtr_tot |
---|
8053 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8054 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_zdfp.nc |
---|
8055 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_zdfp.nc |
---|
8056 | + [ ! 1 '=' 0 ] |
---|
8057 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' ttrdtr_zdfp |
---|
8058 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} ttrdtr_zdfp+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp |
---|
8059 | + ActiveComp=true |
---|
8060 | + (( count = count + 1 )) |
---|
8061 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8062 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_eivad.nc |
---|
8063 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_eivad.nc |
---|
8064 | + [ ! 1 '=' 0 ] |
---|
8065 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' ttrdtr_eivad |
---|
8066 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} ttrdtr_eivad+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad |
---|
8067 | + ActiveComp=true |
---|
8068 | + (( count = count + 1 )) |
---|
8069 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8070 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_iso.nc |
---|
8071 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_iso.nc |
---|
8072 | + [ ! 1 '=' 0 ] |
---|
8073 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' ttrdtr_iso |
---|
8074 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} ttrdtr_iso+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso |
---|
8075 | + ActiveComp=true |
---|
8076 | + (( count = count + 1 )) |
---|
8077 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8078 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_totad.nc |
---|
8079 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_totad.nc |
---|
8080 | + [ ! 1 '=' 0 ] |
---|
8081 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' ttrdtr_totad |
---|
8082 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} ttrdtr_totad+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad |
---|
8083 | + ActiveComp=true |
---|
8084 | + (( count = count + 1 )) |
---|
8085 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8086 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_tot.nc |
---|
8087 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_ttrdtr_tot.nc |
---|
8088 | + [ ! 1 '=' 0 ] |
---|
8089 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' ttrdtr_tot |
---|
8090 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} ttrdtr_tot+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad ttrdtr_tot |
---|
8091 | + ActiveComp=true |
---|
8092 | + (( count = count + 1 )) |
---|
8093 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8094 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_zdfp.nc |
---|
8095 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_zdfp.nc |
---|
8096 | + [ ! 1 '=' 0 ] |
---|
8097 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' strdtr_zdfp |
---|
8098 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} strdtr_zdfp+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad ttrdtr_tot strdtr_zdfp |
---|
8099 | + ActiveComp=true |
---|
8100 | + (( count = count + 1 )) |
---|
8101 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8102 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_eivad.nc |
---|
8103 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_eivad.nc |
---|
8104 | + [ ! 1 '=' 0 ] |
---|
8105 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' strdtr_eivad |
---|
8106 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} strdtr_eivad+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad ttrdtr_tot strdtr_zdfp strdtr_eivad |
---|
8107 | + ActiveComp=true |
---|
8108 | + (( count = count + 1 )) |
---|
8109 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8110 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_iso.nc |
---|
8111 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_iso.nc |
---|
8112 | + [ ! 1 '=' 0 ] |
---|
8113 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' strdtr_iso |
---|
8114 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} strdtr_iso+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad ttrdtr_tot strdtr_zdfp strdtr_eivad strdtr_iso |
---|
8115 | + ActiveComp=true |
---|
8116 | + (( count = count + 1 )) |
---|
8117 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8118 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_totad.nc |
---|
8119 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_totad.nc |
---|
8120 | + [ ! 1 '=' 0 ] |
---|
8121 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' strdtr_totad |
---|
8122 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} strdtr_totad+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad ttrdtr_tot strdtr_zdfp strdtr_eivad strdtr_iso strdtr_totad |
---|
8123 | + ActiveComp=true |
---|
8124 | + (( count = count + 1 )) |
---|
8125 | + DIRECTORY=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8126 | + TestedFile=CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_tot.nc |
---|
8127 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO/CM61-LR-hist-03.2030_18500101_19491231_1M_strdtr_tot.nc |
---|
8128 | + [ ! 1 '=' 0 ] |
---|
8129 | + eval set +A LISTE_VARS_1M_trdtra '${LISTE_VARS_1M_trdtra[*]}' strdtr_tot |
---|
8130 | set +A LISTE_VARS_1M_trdtra ${LISTE_VARS_1M_trdtra[*]} strdtr_tot+ set +A LISTE_VARS_1M_trdtra ttrdtr_zdfp ttrdtr_eivad ttrdtr_iso ttrdtr_totad ttrdtr_tot strdtr_zdfp strdtr_eivad strdtr_iso strdtr_totad strdtr_tot |
---|
8131 | + ActiveComp=true |
---|
8132 | + (( count = count + 1 )) |
---|
8133 | + [ 10 -gt 0 ] |
---|
8134 | + eval set +A LISTE_FILE_OCE '${LISTE_FILE_OCE[*]}' 1M_trdtra |
---|
8135 | set +A LISTE_FILE_OCE ${LISTE_FILE_OCE[*]} 1M_trdtra+ set +A LISTE_FILE_OCE 1M_trdtra |
---|
8136 | + eval set +A LISTE_AXIS_1M_trdtra '${opa9_Post_1M_trdtra_GatherWithInternal[*]}' |
---|
8137 | set +A LISTE_AXIS_1M_trdtra ${opa9_Post_1M_trdtra_GatherWithInternal[*]}+ set +A LISTE_AXIS_1M_trdtra nav_lon nav_lat olevel time_counter time_centered time_centered_bounds |
---|
8138 | + [ ! Xtrue '=' Xtrue ] |
---|
8139 | + (( i=i+3 )) |
---|
8140 | + [ 50 -gt 47 ] |
---|
8141 | + [ true '=' true ] |
---|
8142 | + set +A ActiveListOfComponents OCE |
---|
8143 | set -A config_ListOfComponents ${ActiveListOfComponents[*]} |
---|
8144 | + set -A config_ListOfComponents OCE |
---|
8145 | [ ! -z "${ActiveListOfComponents}" ] && DoJob=true |
---|
8146 | |
---|
8147 | + [ ! -z OCE ] |
---|
8148 | + DoJob=true |
---|
8149 | ######################################################################## |
---|
8150 | # |
---|
8151 | # IS THERE SOME ALLREADY PRODUCED TIME SERIES ? |
---|
8152 | # IF SO BRING THEM IN THE WORKING DIRECTORY |
---|
8153 | # |
---|
8154 | # PS : Keep in mind that IGCM_sys_Get here is a weak link : |
---|
8155 | # - especially for IDRiS |
---|
8156 | # - no special protection against "command too long" ! |
---|
8157 | # - libIGCM_sys should handle that or modify following code part |
---|
8158 | # |
---|
8159 | ######################################################################## |
---|
8160 | |
---|
8161 | if [ ${StandAlone} != true ] ; then |
---|
8162 | Running_Flag=$( IGCM_sys_RshMaster "IGCM_card_DefineVariableFromOption \ |
---|
8163 | ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning ; \ |
---|
8164 | echo \${run_PostProcessing_TimeSeriesRunning}" ) |
---|
8165 | |
---|
8166 | #if [ X${Running_Flag} = Xy ] ; then |
---|
8167 | # # Time Series Job allready running |
---|
8168 | # IGCM_debug_Print 1 "Time Series Job allready running exit" |
---|
8169 | # exit |
---|
8170 | #fi |
---|
8171 | # Now run.card know we are running |
---|
8172 | |
---|
8173 | |
---|
8174 | |
---|
8175 | |
---|
8176 | IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "y" |
---|
8177 | |
---|
8178 | |
---|
8179 | |
---|
8180 | |
---|
8181 | |
---|
8182 | # Get information from last execution |
---|
8183 | #CompletedFlag=$( IGCM_sys_RshMaster \ |
---|
8184 | # "IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted ;\ |
---|
8185 | # echo \${run_PostProcessing_TimeSeriesCompleted}" ) |
---|
8186 | fi |
---|
8187 | |
---|
8188 | + [ true '!=' true ] |
---|
8189 | # Is it the first submission or not ? |
---|
8190 | |
---|
8191 | if ( [ X${CompletedFlag} = X ] || [ X${CompletedFlag} = X$( IGCM_date_AddDaysToGregorianDate ${DateBegin} -1 ) ] ) ; then |
---|
8192 | # First Time Series Submission |
---|
8193 | FIRST_PASS=TRUE |
---|
8194 | Length=$( IGCM_date_DaysInPreviousPeriod ${DateBegin} ${config_UserChoices_PeriodLength} begin) |
---|
8195 | DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) ) |
---|
8196 | else |
---|
8197 | # Last Completed Time Series |
---|
8198 | FIRST_PASS=FALSE |
---|
8199 | DATE_FIN_JOB_B=${CompletedFlag} |
---|
8200 | date=${DateBegin}_${DATE_FIN_JOB_B} |
---|
8201 | # |
---|
8202 | for comp in ${config_ListOfComponents[*]} ; do |
---|
8203 | # |
---|
8204 | IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp} |
---|
8205 | # |
---|
8206 | IGCM_sys_Cd ${RUN_DIR_PATH}/${comp} |
---|
8207 | # |
---|
8208 | unset liste_file |
---|
8209 | # |
---|
8210 | file_path=${R_SAVE}/${comp}/Analyse |
---|
8211 | # |
---|
8212 | i=0 |
---|
8213 | file=${NULL_STR} |
---|
8214 | # |
---|
8215 | for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do |
---|
8216 | # |
---|
8217 | # Determine in which output can we find file |
---|
8218 | # IE : Analyse/TS or Analyse/DA2TS or ... |
---|
8219 | # |
---|
8220 | FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) |
---|
8221 | case ${FlagDir} in |
---|
8222 | *Y) TS_Dir=TS_YE ;; |
---|
8223 | *M) TS_Dir=TS_MO ;; |
---|
8224 | *D) TS_Dir=TS_DA ;; |
---|
8225 | HF) TS_Dir=TS_HF ;; |
---|
8226 | 3H) TS_Dir=TS_HF ;; |
---|
8227 | INS) TS_Dir=TS_INS ;; |
---|
8228 | esac |
---|
8229 | for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do |
---|
8230 | # |
---|
8231 | IGCM_sys_TestFileArchive ${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc |
---|
8232 | if [ $? = 0 ] ; then |
---|
8233 | liste_file[${#liste_file[*]}]=${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc |
---|
8234 | else |
---|
8235 | IGCM_debug_Print 1 "WARNING ${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc dont exist" |
---|
8236 | fi |
---|
8237 | # |
---|
8238 | done |
---|
8239 | done |
---|
8240 | if [ X${file} != X${NULL_STR} ] ; then |
---|
8241 | IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp} |
---|
8242 | IGCM_debug_Verif_Exit |
---|
8243 | fi |
---|
8244 | done |
---|
8245 | # |
---|
8246 | LEVEL=0 |
---|
8247 | # |
---|
8248 | fi |
---|
8249 | |
---|
8250 | + [ X '=' X ] |
---|
8251 | + FIRST_PASS=TRUE |
---|
8252 | + IGCM_date_DaysInPreviousPeriod 18500101 10Y begin |
---|
8253 | year=1850month=01+ Length=3652 |
---|
8254 | + IGCM_date_AddDaysToGregorianDate 18500101 3651 |
---|
8255 | + DATE_FIN_JOB_B=18591231 |
---|
8256 | ######################################################################## |
---|
8257 | # |
---|
8258 | # DEFINE LOOP PARAMETERS |
---|
8259 | # |
---|
8260 | ######################################################################## |
---|
8261 | |
---|
8262 | DATE_COUNT=${DATE_FIN_JOB_B} |
---|
8263 | + DATE_COUNT=18591231 |
---|
8264 | DATE_FIN_JOB_B_LOOP=${DATE_FIN_JOB_B} |
---|
8265 | |
---|
8266 | + DATE_FIN_JOB_B_LOOP=18591231 |
---|
8267 | ( [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] ) && NBRE_FILE_TOT=0 || NBRE_FILE_TOT=1 |
---|
8268 | |
---|
8269 | + [ -n '' ] |
---|
8270 | + NBRE_FILE_TOT=1 |
---|
8271 | if [ ${DoJob} = true ] ; then |
---|
8272 | while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do |
---|
8273 | (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8274 | Length=$( IGCM_date_DaysInNextPeriod ${DATE_COUNT} ${config_UserChoices_PeriodLength} ) |
---|
8275 | DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} ) |
---|
8276 | done |
---|
8277 | else |
---|
8278 | NBRE_FILE_TOT=0 |
---|
8279 | fi |
---|
8280 | |
---|
8281 | + [ true '=' true ] |
---|
8282 | + [ 18591231 -lt 19491231 ] |
---|
8283 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8284 | + IGCM_date_DaysInNextPeriod 18591231 10Y |
---|
8285 | year=1859month=12+ Length=3653 |
---|
8286 | + IGCM_date_AddDaysToGregorianDate 18591231 3653 |
---|
8287 | + DATE_COUNT=18691231 |
---|
8288 | + [ 18691231 -lt 19491231 ] |
---|
8289 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8290 | + IGCM_date_DaysInNextPeriod 18691231 10Y |
---|
8291 | year=1869month=12+ Length=3652 |
---|
8292 | + IGCM_date_AddDaysToGregorianDate 18691231 3652 |
---|
8293 | + DATE_COUNT=18791231 |
---|
8294 | + [ 18791231 -lt 19491231 ] |
---|
8295 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8296 | + IGCM_date_DaysInNextPeriod 18791231 10Y |
---|
8297 | year=1879month=12+ Length=3653 |
---|
8298 | + IGCM_date_AddDaysToGregorianDate 18791231 3653 |
---|
8299 | + DATE_COUNT=18891231 |
---|
8300 | + [ 18891231 -lt 19491231 ] |
---|
8301 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8302 | + IGCM_date_DaysInNextPeriod 18891231 10Y |
---|
8303 | year=1889month=12+ Length=3652 |
---|
8304 | + IGCM_date_AddDaysToGregorianDate 18891231 3652 |
---|
8305 | + DATE_COUNT=18991231 |
---|
8306 | + [ 18991231 -lt 19491231 ] |
---|
8307 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8308 | + IGCM_date_DaysInNextPeriod 18991231 10Y |
---|
8309 | year=1899month=12+ Length=3652 |
---|
8310 | + IGCM_date_AddDaysToGregorianDate 18991231 3652 |
---|
8311 | + DATE_COUNT=19091231 |
---|
8312 | + [ 19091231 -lt 19491231 ] |
---|
8313 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8314 | + IGCM_date_DaysInNextPeriod 19091231 10Y |
---|
8315 | year=1909month=12+ Length=3652 |
---|
8316 | + IGCM_date_AddDaysToGregorianDate 19091231 3652 |
---|
8317 | + DATE_COUNT=19191231 |
---|
8318 | + [ 19191231 -lt 19491231 ] |
---|
8319 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8320 | + IGCM_date_DaysInNextPeriod 19191231 10Y |
---|
8321 | year=1919month=12+ Length=3653 |
---|
8322 | + IGCM_date_AddDaysToGregorianDate 19191231 3653 |
---|
8323 | + DATE_COUNT=19291231 |
---|
8324 | + [ 19291231 -lt 19491231 ] |
---|
8325 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8326 | + IGCM_date_DaysInNextPeriod 19291231 10Y |
---|
8327 | year=1929month=12+ Length=3652 |
---|
8328 | + IGCM_date_AddDaysToGregorianDate 19291231 3652 |
---|
8329 | + DATE_COUNT=19391231 |
---|
8330 | + [ 19391231 -lt 19491231 ] |
---|
8331 | + (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) |
---|
8332 | + IGCM_date_DaysInNextPeriod 19391231 10Y |
---|
8333 | year=1939month=12+ Length=3653 |
---|
8334 | + IGCM_date_AddDaysToGregorianDate 19391231 3653 |
---|
8335 | + DATE_COUNT=19491231 |
---|
8336 | + [ 19491231 -lt 19491231 ] |
---|
8337 | if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then |
---|
8338 | NBRE_TOUR=1 |
---|
8339 | elif [ ${NBRE_FILE_TOT}%${UNIX_MAX_LIMIT} -eq 0 ] ; then |
---|
8340 | let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT} |
---|
8341 | else |
---|
8342 | let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT}+1 |
---|
8343 | fi |
---|
8344 | |
---|
8345 | + [ 10 -le 360 ] |
---|
8346 | + NBRE_TOUR=1 |
---|
8347 | CURRENT_LOOP=1 |
---|
8348 | + CURRENT_LOOP=1 |
---|
8349 | # THIS LOOP GIVES PARAMETERS FOR THE DATE'S LOOP ie : DATE_COURANTE, DATE_FIN. |
---|
8350 | # WE HAVE 3 LEVELS |
---|
8351 | # - LEVEL 1 : JUST ONE LOOP TO COMPLETE |
---|
8352 | # - LEVEL 2 : WE ARE IN THE "DEEP" LOOP |
---|
8353 | # - LEVEL 3 : WE ARE IN THE LAST LOOP |
---|
8354 | |
---|
8355 | while [ ${CURRENT_LOOP} -le ${NBRE_TOUR} ] ; do |
---|
8356 | |
---|
8357 | if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then |
---|
8358 | # - LEVEL 1 : JUST ONE LOOP TO COMPLETE |
---|
8359 | NBRE_FILE_LOOP=${NBRE_FILE_TOT} |
---|
8360 | |
---|
8361 | if [ ${FIRST_PASS} = TRUE ] ; then |
---|
8362 | DATE_COURANTE=${DATE_FIN_JOB_B_LOOP} |
---|
8363 | else |
---|
8364 | Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN_JOB_B_LOOP} ${config_UserChoices_PeriodLength} ) |
---|
8365 | DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) |
---|
8366 | fi |
---|
8367 | |
---|
8368 | DATE_FIN=${PeriodDateEnd} |
---|
8369 | DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} |
---|
8370 | |
---|
8371 | [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP=${DATE_LOOP} |
---|
8372 | [ -n "${LEVEL}" ] && FLAG_B="TRUE" || FLAG_B="FALSE" |
---|
8373 | |
---|
8374 | LEVEL=1 |
---|
8375 | DEPOT="TRUE" |
---|
8376 | elif [ ${CURRENT_LOOP} -ne ${NBRE_TOUR} ] ; then |
---|
8377 | # - LEVEL 2 : WE ARE IN THE "DEEP" LOOP |
---|
8378 | NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} |
---|
8379 | |
---|
8380 | if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then |
---|
8381 | Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN_JOB_B_LOOP} ${config_UserChoices_PeriodLength} ) |
---|
8382 | DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) |
---|
8383 | elif [ -z "${DATE_COURANTE}" ] ; then |
---|
8384 | DATE_COURANTE=${DATE_FIN_JOB_B} |
---|
8385 | else |
---|
8386 | Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} ) |
---|
8387 | DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) |
---|
8388 | fi |
---|
8389 | |
---|
8390 | (( TotLength = 0 )) |
---|
8391 | COMPTEUR=1 |
---|
8392 | DATE_LOOP=${DATE_COURANTE} |
---|
8393 | |
---|
8394 | while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do |
---|
8395 | # |
---|
8396 | Length=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} ) |
---|
8397 | DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} ) |
---|
8398 | (( TotLength = TotLength + Length )) |
---|
8399 | (( COMPTEUR = COMPTEUR + 1 )) |
---|
8400 | # |
---|
8401 | done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done |
---|
8402 | DATE_FIN=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} ${TotLength} ) |
---|
8403 | |
---|
8404 | [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP} |
---|
8405 | [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] && FLAG_B="TRUE" || [ ${CURRENT_LOOP} -gt 1 ] && FLAG_B="TRUE" || FLAG_B="FALSE" |
---|
8406 | DEPOT="FALSE" |
---|
8407 | LEVEL=2 |
---|
8408 | else |
---|
8409 | # - LEVEL 3 : WE ARE IN THE LAST LOOP |
---|
8410 | NBRE_FILE_LOOP=$(( ${NBRE_FILE_TOT} % ( ${UNIX_MAX_LIMIT} * ( ${CURRENT_LOOP} - 1 ) ) )) |
---|
8411 | [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} |
---|
8412 | |
---|
8413 | Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} ) |
---|
8414 | DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) |
---|
8415 | DATE_FIN=${PeriodDateEnd} |
---|
8416 | [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP} |
---|
8417 | |
---|
8418 | LEVEL=3 |
---|
8419 | DEPOT="TRUE" |
---|
8420 | FLAG_B="TRUE" |
---|
8421 | fi |
---|
8422 | |
---|
8423 | # THEN FOR EACH FILE TYPE WE LOOP BETWEEN DATE_COURANTE AND DATE_FIN. |
---|
8424 | for comp in ${config_ListOfComponents[*]} ; do |
---|
8425 | # |
---|
8426 | IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp} |
---|
8427 | # |
---|
8428 | IGCM_sys_Cd ${RUN_DIR_PATH}/${comp} |
---|
8429 | # |
---|
8430 | eval R_OUT_${comp}=${R_SAVE}/${comp} |
---|
8431 | # |
---|
8432 | i=0 |
---|
8433 | # |
---|
8434 | for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do |
---|
8435 | # |
---|
8436 | # Determine in which output we can find file |
---|
8437 | # IE : Output/MO or Output/DA or ... |
---|
8438 | # |
---|
8439 | FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) |
---|
8440 | case ${FlagDir} in |
---|
8441 | *Y) TS_Dir=TS_YE ; FreqDir=YE ;; |
---|
8442 | *M) TS_Dir=TS_MO ; FreqDir=MO ;; |
---|
8443 | *D) TS_Dir=TS_DA ; FreqDir=DA ;; |
---|
8444 | HF) TS_Dir=TS_HF ; FreqDir=HF ;; |
---|
8445 | 3H) TS_Dir=TS_HF ; FreqDir=HF ;; |
---|
8446 | INS) TS_Dir=TS_INS ; FreqDir=INS ;; |
---|
8447 | *) IGCM_debug_Print 1 "Error in FlagDir=${FlagDir} for file ${file}." |
---|
8448 | IGCM_debug_Exit "Job create_ts" ;; |
---|
8449 | esac |
---|
8450 | |
---|
8451 | # Initialize array |
---|
8452 | unset liste_file |
---|
8453 | unset liste_file_tmp |
---|
8454 | eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/ |
---|
8455 | |
---|
8456 | COMPTEUR=1 |
---|
8457 | MissingFile=FALSE |
---|
8458 | DATE_LOOP=${DATE_COURANTE} |
---|
8459 | |
---|
8460 | while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do |
---|
8461 | # |
---|
8462 | Length1=$( IGCM_date_DaysInPreviousPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} end) |
---|
8463 | DATE_TAB=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP} |
---|
8464 | |
---|
8465 | Length2=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} ) |
---|
8466 | DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} ) |
---|
8467 | |
---|
8468 | IGCM_sys_TestFileArchive ${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc |
---|
8469 | if [ $? = 0 ] ; then |
---|
8470 | liste_file[${#liste_file[*]}]=${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc |
---|
8471 | liste_file_tmp[${#liste_file_tmp[*]}]=${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc |
---|
8472 | else |
---|
8473 | IGCM_debug_Print 1 "WARNING ${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc dont exist" |
---|
8474 | MissingFile=TRUE |
---|
8475 | fi |
---|
8476 | (( COMPTEUR = COMPTEUR + 1 )) |
---|
8477 | # |
---|
8478 | done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done |
---|
8479 | |
---|
8480 | # We skip this file type if one of them is missing. |
---|
8481 | if [ "${MissingFile}" = "TRUE" ] ; then |
---|
8482 | IGCM_debug_Print 1 "WARNING We skip ${file} type processing" |
---|
8483 | continue |
---|
8484 | fi |
---|
8485 | |
---|
8486 | DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} -${Length2} ) |
---|
8487 | |
---|
8488 | # Get selected files |
---|
8489 | IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp} |
---|
8490 | IGCM_debug_Verif_Exit |
---|
8491 | |
---|
8492 | # Apply IGCM_Patch if needed |
---|
8493 | if [ ! X${RebuildFrequency} = Xtrue ] ; then |
---|
8494 | if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then |
---|
8495 | for file_t in $( eval echo ${liste_file_tmp[*]} ); do |
---|
8496 | for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do |
---|
8497 | IGCM_${Patch} ${file_t} |
---|
8498 | IGCM_debug_Verif_Exit |
---|
8499 | done |
---|
8500 | done |
---|
8501 | fi |
---|
8502 | fi |
---|
8503 | |
---|
8504 | # WE CAN CONCATENATE FILES AT THIS POINT |
---|
8505 | [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC} |
---|
8506 | Length=$( IGCM_date_DaysInPreviousPeriod ${DATE_COURANTE} ${config_UserChoices_PeriodLength} end) |
---|
8507 | DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) ) |
---|
8508 | DATE_BUILD=${DATE_BUILD1}_${DATE_FIN} |
---|
8509 | DATE_BUILD_END=${DateBegin}_${DATE_FIN} |
---|
8510 | |
---|
8511 | liste_coord=" " |
---|
8512 | for axis in $( eval echo \${LISTE_AXIS_${file}[*]} ); do |
---|
8513 | liste_coord=${liste_coord}${axis}"," |
---|
8514 | done |
---|
8515 | |
---|
8516 | # Time axis must be the last dimension |
---|
8517 | time_axis=${axis} |
---|
8518 | |
---|
8519 | # SWITCH BETWEEN MODEL TO FIT PARTICULAR CASE |
---|
8520 | for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do |
---|
8521 | # |
---|
8522 | # We skip variables not in the first file of the list. |
---|
8523 | # Seems overkill to test thel all... but will do if needed |
---|
8524 | ncdump -hv ${var} ${liste_file_tmp[0]} > /dev/null 2>&1 |
---|
8525 | if [ ! $? = 0 ] ; then |
---|
8526 | IGCM_debug_Print 1 "WARNING We skip ${var}, not present within ${liste_file_tmp[0]}" |
---|
8527 | continue |
---|
8528 | fi |
---|
8529 | # |
---|
8530 | if [ "${FLAG_B}" = "TRUE" ] ; then |
---|
8531 | # WE CONCATENATE WITH EXISTING FILES |
---|
8532 | file1=${config_UserChoices_JobName}_${DATE_BUILD_B}_${FlagDir}_${var}.nc |
---|
8533 | file_out=${config_UserChoices_JobName}_${DATE_BUILD_END}_${FlagDir}_${var}.nc |
---|
8534 | IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${file1} ${liste_file_tmp[*]} ${file_out} |
---|
8535 | IGCM_debug_Verif_Exit |
---|
8536 | # |
---|
8537 | IGCM_sys_Rm ${file1} |
---|
8538 | if [ ! "${DEPOT}" = "TRUE" ] ; then |
---|
8539 | eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}}/Analyse/${TS_Dir}/${file_out} |
---|
8540 | # "${file1} = file_before ? |
---|
8541 | [ ! "${file1}" = "${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_${FlagDir}_${var}.nc" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/${TS_Dir} ${file1} ${file_out} |
---|
8542 | fi |
---|
8543 | else |
---|
8544 | # OR NOT |
---|
8545 | file_out=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc |
---|
8546 | IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${liste_file_tmp[*]} ${file_out} |
---|
8547 | IGCM_debug_Verif_Exit |
---|
8548 | fi |
---|
8549 | |
---|
8550 | # |
---|
8551 | if [ "${DEPOT}" = "TRUE" ] ; then |
---|
8552 | # WE PUT FINAL FILE ON FILE SYSTEM |
---|
8553 | [ "${FLAG_B}" = "FALSE" ] && file_out=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc |
---|
8554 | file_before=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_${FlagDir}_${var}.nc |
---|
8555 | # |
---|
8556 | eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}}/Analyse/${TS_Dir}/${file_out} |
---|
8557 | [ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/${TS_Dir} ${file_before} ${file_out} |
---|
8558 | if [ ! "X${file1}" = "X" ] ; then |
---|
8559 | [ ! "${file1}" = "${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_${FlagDir}_${var}.nc" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/${TS_Dir} ${file1} ${file_out} |
---|
8560 | fi |
---|
8561 | # |
---|
8562 | [ -f ${file_out} ] && IGCM_sys_Rm ${file_out} |
---|
8563 | # |
---|
8564 | fi |
---|
8565 | # |
---|
8566 | done # for var in ${liste_var} ; do |
---|
8567 | IGCM_sys_Rm ${liste_file_tmp[*]} |
---|
8568 | done # for file in ${liste_file_brut} do |
---|
8569 | done # for comp in ${config_ListOfComponents[*]} ; do |
---|
8570 | # GO AHEAD IN DEEPEST LOOP |
---|
8571 | (( CURRENT_LOOP = CURRENT_LOOP + 1 )) |
---|
8572 | done # while [ ${CURRENT_LOOP} -le ${NBRE_TOUR} ] do |
---|
8573 | # FINISH |
---|
8574 | |
---|
8575 | # DODS copy |
---|
8576 | + [ 1 -le 1 ] |
---|
8577 | + [ 10 -le 360 ] |
---|
8578 | + NBRE_FILE_LOOP=10 |
---|
8579 | + [ TRUE '=' TRUE ] |
---|
8580 | + DATE_COURANTE=18591231 |
---|
8581 | + DATE_FIN=19491231 |
---|
8582 | + DATE_FIN_JOB_B_LOOP_PREC=18591231 |
---|
8583 | + [ -n '' ] |
---|
8584 | + [ -n '' ] |
---|
8585 | + FLAG_B=FALSE |
---|
8586 | + LEVEL=1 |
---|
8587 | + DEPOT=TRUE |
---|
8588 | + IGCM_sys_Mkdir /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313/OCE |
---|
8589 | IGCM_sys_Mkdir : /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313/OCE |
---|
8590 | + IGCM_sys_Cd /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313/OCE |
---|
8591 | IGCM_sys_Cd : /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313/OCE |
---|
8592 | + eval R_OUT_OCE=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE |
---|
8593 | R_OUT_OCE=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE+ R_OUT_OCE=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE |
---|
8594 | + i=0 |
---|
8595 | + eval echo '${LISTE_FILE_OCE[*]}' |
---|
8596 | echo ${LISTE_FILE_OCE[*]}+ echo 1M_trdtra |
---|
8597 | + echo 1M_trdtra |
---|
8598 | + awk -F _ '{print $1}' |
---|
8599 | + FlagDir=1M |
---|
8600 | + TS_Dir=TS_MO |
---|
8601 | + FreqDir=MO |
---|
8602 | + unset liste_file |
---|
8603 | + unset liste_file_tmp |
---|
8604 | + eval file_path='${R_OUT_OCE}/Output/MO/' |
---|
8605 | file_path=${R_OUT_OCE}/Output/MO/+ file_path=/ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/ |
---|
8606 | + COMPTEUR=1 |
---|
8607 | + MissingFile=FALSE |
---|
8608 | + DATE_LOOP=18591231 |
---|
8609 | + [ 1 -le 10 ] |
---|
8610 | + IGCM_date_DaysInPreviousPeriod 18591231 10Y end |
---|
8611 | year=1859month=12+ Length1=3652 |
---|
8612 | + IGCM_date_AddDaysToGregorianDate 18591231 -3651 |
---|
8613 | + DATE_TAB=18500101_18591231 |
---|
8614 | + IGCM_date_DaysInNextPeriod 18591231 10Y |
---|
8615 | year=1859month=12+ Length2=3653 |
---|
8616 | + IGCM_date_AddDaysToGregorianDate 18591231 3653 |
---|
8617 | + DATE_LOOP=18691231 |
---|
8618 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18500101_18591231_1M_trdtra.nc |
---|
8619 | + [ 1 '=' 0 ] |
---|
8620 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18500101_18591231_1M_trdtra.nc dont exist' |
---|
8621 | 2018-07-27 12:34:18 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18500101_18591231_1M_trdtra.nc dont exist |
---|
8622 | + MissingFile=TRUE |
---|
8623 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8624 | + [ 2 -le 10 ] |
---|
8625 | + IGCM_date_DaysInPreviousPeriod 18691231 10Y end |
---|
8626 | year=1869month=12+ Length1=3653 |
---|
8627 | + IGCM_date_AddDaysToGregorianDate 18691231 -3652 |
---|
8628 | + DATE_TAB=18600101_18691231 |
---|
8629 | + IGCM_date_DaysInNextPeriod 18691231 10Y |
---|
8630 | year=1869month=12+ Length2=3652 |
---|
8631 | + IGCM_date_AddDaysToGregorianDate 18691231 3652 |
---|
8632 | + DATE_LOOP=18791231 |
---|
8633 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18600101_18691231_1M_trdtra.nc |
---|
8634 | + [ 1 '=' 0 ] |
---|
8635 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18600101_18691231_1M_trdtra.nc dont exist' |
---|
8636 | 2018-07-27 12:34:18 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18600101_18691231_1M_trdtra.nc dont exist |
---|
8637 | + MissingFile=TRUE |
---|
8638 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8639 | + [ 3 -le 10 ] |
---|
8640 | + IGCM_date_DaysInPreviousPeriod 18791231 10Y end |
---|
8641 | year=1879month=12+ Length1=3652 |
---|
8642 | + IGCM_date_AddDaysToGregorianDate 18791231 -3651 |
---|
8643 | + DATE_TAB=18700101_18791231 |
---|
8644 | + IGCM_date_DaysInNextPeriod 18791231 10Y |
---|
8645 | year=1879month=12+ Length2=3653 |
---|
8646 | + IGCM_date_AddDaysToGregorianDate 18791231 3653 |
---|
8647 | + DATE_LOOP=18891231 |
---|
8648 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18700101_18791231_1M_trdtra.nc |
---|
8649 | + [ 1 '=' 0 ] |
---|
8650 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18700101_18791231_1M_trdtra.nc dont exist' |
---|
8651 | 2018-07-27 12:34:18 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18700101_18791231_1M_trdtra.nc dont exist |
---|
8652 | + MissingFile=TRUE |
---|
8653 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8654 | + [ 4 -le 10 ] |
---|
8655 | + IGCM_date_DaysInPreviousPeriod 18891231 10Y end |
---|
8656 | year=1889month=12+ Length1=3653 |
---|
8657 | + IGCM_date_AddDaysToGregorianDate 18891231 -3652 |
---|
8658 | + DATE_TAB=18800101_18891231 |
---|
8659 | + IGCM_date_DaysInNextPeriod 18891231 10Y |
---|
8660 | year=1889month=12+ Length2=3652 |
---|
8661 | + IGCM_date_AddDaysToGregorianDate 18891231 3652 |
---|
8662 | + DATE_LOOP=18991231 |
---|
8663 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18800101_18891231_1M_trdtra.nc |
---|
8664 | + [ 1 '=' 0 ] |
---|
8665 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18800101_18891231_1M_trdtra.nc dont exist' |
---|
8666 | 2018-07-27 12:34:18 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18800101_18891231_1M_trdtra.nc dont exist |
---|
8667 | + MissingFile=TRUE |
---|
8668 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8669 | + [ 5 -le 10 ] |
---|
8670 | + IGCM_date_DaysInPreviousPeriod 18991231 10Y end |
---|
8671 | year=1899month=12+ Length1=3652 |
---|
8672 | + IGCM_date_AddDaysToGregorianDate 18991231 -3651 |
---|
8673 | + DATE_TAB=18900101_18991231 |
---|
8674 | + IGCM_date_DaysInNextPeriod 18991231 10Y |
---|
8675 | year=1899month=12+ Length2=3652 |
---|
8676 | + IGCM_date_AddDaysToGregorianDate 18991231 3652 |
---|
8677 | + DATE_LOOP=19091231 |
---|
8678 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18900101_18991231_1M_trdtra.nc |
---|
8679 | + [ 1 '=' 0 ] |
---|
8680 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18900101_18991231_1M_trdtra.nc dont exist' |
---|
8681 | 2018-07-27 12:34:18 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_18900101_18991231_1M_trdtra.nc dont exist |
---|
8682 | + MissingFile=TRUE |
---|
8683 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8684 | + [ 6 -le 10 ] |
---|
8685 | + IGCM_date_DaysInPreviousPeriod 19091231 10Y end |
---|
8686 | year=1909month=12+ Length1=3652 |
---|
8687 | + IGCM_date_AddDaysToGregorianDate 19091231 -3651 |
---|
8688 | + DATE_TAB=19000101_19091231 |
---|
8689 | + IGCM_date_DaysInNextPeriod 19091231 10Y |
---|
8690 | year=1909month=12+ Length2=3652 |
---|
8691 | + IGCM_date_AddDaysToGregorianDate 19091231 3652 |
---|
8692 | + DATE_LOOP=19191231 |
---|
8693 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19000101_19091231_1M_trdtra.nc |
---|
8694 | + [ 1 '=' 0 ] |
---|
8695 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19000101_19091231_1M_trdtra.nc dont exist' |
---|
8696 | 2018-07-27 12:34:18 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19000101_19091231_1M_trdtra.nc dont exist |
---|
8697 | + MissingFile=TRUE |
---|
8698 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8699 | + [ 7 -le 10 ] |
---|
8700 | + IGCM_date_DaysInPreviousPeriod 19191231 10Y end |
---|
8701 | year=1919month=12+ Length1=3652 |
---|
8702 | + IGCM_date_AddDaysToGregorianDate 19191231 -3651 |
---|
8703 | + DATE_TAB=19100101_19191231 |
---|
8704 | + IGCM_date_DaysInNextPeriod 19191231 10Y |
---|
8705 | year=1919month=12+ Length2=3653 |
---|
8706 | + IGCM_date_AddDaysToGregorianDate 19191231 3653 |
---|
8707 | + DATE_LOOP=19291231 |
---|
8708 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19100101_19191231_1M_trdtra.nc |
---|
8709 | + [ 1 '=' 0 ] |
---|
8710 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19100101_19191231_1M_trdtra.nc dont exist' |
---|
8711 | 2018-07-27 12:34:19 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19100101_19191231_1M_trdtra.nc dont exist |
---|
8712 | + MissingFile=TRUE |
---|
8713 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8714 | + [ 8 -le 10 ] |
---|
8715 | + IGCM_date_DaysInPreviousPeriod 19291231 10Y end |
---|
8716 | year=1929month=12+ Length1=3653 |
---|
8717 | + IGCM_date_AddDaysToGregorianDate 19291231 -3652 |
---|
8718 | + DATE_TAB=19200101_19291231 |
---|
8719 | + IGCM_date_DaysInNextPeriod 19291231 10Y |
---|
8720 | year=1929month=12+ Length2=3652 |
---|
8721 | + IGCM_date_AddDaysToGregorianDate 19291231 3652 |
---|
8722 | + DATE_LOOP=19391231 |
---|
8723 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19200101_19291231_1M_trdtra.nc |
---|
8724 | + [ 1 '=' 0 ] |
---|
8725 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19200101_19291231_1M_trdtra.nc dont exist' |
---|
8726 | 2018-07-27 12:34:19 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19200101_19291231_1M_trdtra.nc dont exist |
---|
8727 | + MissingFile=TRUE |
---|
8728 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8729 | + [ 9 -le 10 ] |
---|
8730 | + IGCM_date_DaysInPreviousPeriod 19391231 10Y end |
---|
8731 | year=1939month=12+ Length1=3652 |
---|
8732 | + IGCM_date_AddDaysToGregorianDate 19391231 -3651 |
---|
8733 | + DATE_TAB=19300101_19391231 |
---|
8734 | + IGCM_date_DaysInNextPeriod 19391231 10Y |
---|
8735 | year=1939month=12+ Length2=3653 |
---|
8736 | + IGCM_date_AddDaysToGregorianDate 19391231 3653 |
---|
8737 | + DATE_LOOP=19491231 |
---|
8738 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19300101_19391231_1M_trdtra.nc |
---|
8739 | + [ 1 '=' 0 ] |
---|
8740 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19300101_19391231_1M_trdtra.nc dont exist' |
---|
8741 | 2018-07-27 12:34:19 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19300101_19391231_1M_trdtra.nc dont exist |
---|
8742 | + MissingFile=TRUE |
---|
8743 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8744 | + [ 10 -le 10 ] |
---|
8745 | + IGCM_date_DaysInPreviousPeriod 19491231 10Y end |
---|
8746 | year=1949month=12+ Length1=3653 |
---|
8747 | + IGCM_date_AddDaysToGregorianDate 19491231 -3652 |
---|
8748 | + DATE_TAB=19400101_19491231 |
---|
8749 | + IGCM_date_DaysInNextPeriod 19491231 10Y |
---|
8750 | year=1949month=12+ Length2=3652 |
---|
8751 | + IGCM_date_AddDaysToGregorianDate 19491231 3652 |
---|
8752 | + DATE_LOOP=19591231 |
---|
8753 | + IGCM_sys_TestFileArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19400101_19491231_1M_trdtra.nc |
---|
8754 | + [ 1 '=' 0 ] |
---|
8755 | + IGCM_debug_Print 1 'WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19400101_19491231_1M_trdtra.nc dont exist' |
---|
8756 | 2018-07-27 12:34:19 --Debug1--> WARNING /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Output/MO/CM61-LR-hist-03.2030_19400101_19491231_1M_trdtra.nc dont exist |
---|
8757 | + MissingFile=TRUE |
---|
8758 | + (( COMPTEUR = COMPTEUR + 1 )) |
---|
8759 | + [ 11 -le 10 ] |
---|
8760 | + [ TRUE '=' TRUE ] |
---|
8761 | + IGCM_debug_Print 1 'WARNING We skip 1M_trdtra type processing' |
---|
8762 | 2018-07-27 12:34:19 --Debug1--> WARNING We skip 1M_trdtra type processing |
---|
8763 | + continue |
---|
8764 | + (( CURRENT_LOOP = CURRENT_LOOP + 1 )) |
---|
8765 | + [ 2 -le 1 ] |
---|
8766 | for comp in ${config_ListOfComponents[*]} ; do |
---|
8767 | for TS_Dir in TS_YE TS_MO TS_DA TS_HF TS_INS ; do |
---|
8768 | IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/${TS_Dir} |
---|
8769 | [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/${TS_Dir} |
---|
8770 | done |
---|
8771 | done |
---|
8772 | |
---|
8773 | + IGCM_sys_TestDirArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_YE |
---|
8774 | IGCM_sys_TestDirArchive : /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_YE |
---|
8775 | + [ 1 '=' 0 ] |
---|
8776 | + IGCM_sys_TestDirArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8777 | IGCM_sys_TestDirArchive : /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8778 | + [ 0 '=' 0 ] |
---|
8779 | + IGCM_sys_Put_Dods OCE/Analyse/TS_MO |
---|
8780 | IGCM_sys_Put_Dods : OCE/Analyse/TS_MO |
---|
8781 | IGCM_sys_Dods_Rm : OCE/Analyse/TS_MO |
---|
8782 | /ccc/store/cont003/thredds/oboucher/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8783 | IGCM_sys_Dods_Cp : OCE/Analyse/TS_MO |
---|
8784 | - store : /ccc/store/cont003/thredds/oboucher/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO == IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_MO |
---|
8785 | + IGCM_sys_TestDirArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_DA |
---|
8786 | IGCM_sys_TestDirArchive : /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_DA |
---|
8787 | + [ 1 '=' 0 ] |
---|
8788 | + IGCM_sys_TestDirArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_HF |
---|
8789 | IGCM_sys_TestDirArchive : /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_HF |
---|
8790 | + [ 1 '=' 0 ] |
---|
8791 | + IGCM_sys_TestDirArchive /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_INS |
---|
8792 | IGCM_sys_TestDirArchive : /ccc/store/cont003/gencmip6/oboucher/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.2030/OCE/Analyse/TS_INS |
---|
8793 | + [ 1 '=' 0 ] |
---|
8794 | export DEBUG_debug; export BigBrother ; export libIGCM; export SUBMIT_DIR; export POST_DIR; export Script_Output ; |
---|
8795 | + export DEBUG_debug |
---|
8796 | + export BigBrother |
---|
8797 | + export libIGCM |
---|
8798 | + export SUBMIT_DIR |
---|
8799 | + export POST_DIR |
---|
8800 | + export Script_Output |
---|
8801 | export StandAlone ; export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ; |
---|
8802 | + export StandAlone |
---|
8803 | + export RESOL_ATM |
---|
8804 | + export RESOL_OCE |
---|
8805 | + export RESOL_ICE |
---|
8806 | + export RESOL_MBG |
---|
8807 | + export RESOL_SRF |
---|
8808 | export RESOL_SBG |
---|
8809 | + export RESOL_SBG |
---|
8810 | listVarEnv="DEBUG_debug,BigBrother,libIGCM,SUBMIT_DIR,POST_DIR,Script_Post_Output,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" |
---|
8811 | + listVarEnv=DEBUG_debug,BigBrother,libIGCM,SUBMIT_DIR,POST_DIR,Script_Post_Output,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG |
---|
8812 | export listVarEnv |
---|
8813 | |
---|
8814 | + export listVarEnv |
---|
8815 | #D- |
---|
8816 | # -------------------------------------------------------------------- |
---|
8817 | #D- Test if all was right |
---|
8818 | # -------------------------------------------------------------------- |
---|
8819 | IGCM_debug_Verif_Exit |
---|
8820 | + IGCM_debug_Verif_Exit |
---|
8821 | # -------------------------------------------------------------------- |
---|
8822 | #D- Submit MONITORING |
---|
8823 | # -------------------------------------------------------------------- |
---|
8824 | if ( [ X${TsTask} = X2D ] || [ X${TsTask} = X3D ] || [ X${TsTask} = X ] ) ; then |
---|
8825 | # From 2D and 3D it is the last one to finish that will submit the monitoring. |
---|
8826 | if [ ! "X$( grep "IGCM_sys_RmRunDir" ${POST_DIR}/create_ts.${PeriodDateEnd}.[23]D.out 2> /dev/null )" = "X" ] ; then |
---|
8827 | Script_Post_Output=monitoring.${PeriodDateEnd} |
---|
8828 | IGCM_sys_QsubPost monitoring |
---|
8829 | fi |
---|
8830 | fi |
---|
8831 | |
---|
8832 | + [ XChunck3D '=' X2D ] |
---|
8833 | + [ XChunck3D '=' X3D ] |
---|
8834 | + [ XChunck3D '=' X ] |
---|
8835 | #D- |
---|
8836 | # -------------------------------------------------------------------- |
---|
8837 | #D- Update the run.card |
---|
8838 | # -------------------------------------------------------------------- |
---|
8839 | if [ ${StandAlone} != true ] ; then |
---|
8840 | # Put in run.card end period of time series |
---|
8841 | [ X"${DATE_FIN}" = X ] || IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted "${DATE_FIN}" |
---|
8842 | # We have finish the job ! |
---|
8843 | IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "n" |
---|
8844 | fi |
---|
8845 | |
---|
8846 | + [ true '!=' true ] |
---|
8847 | # Clean RUN_DIR_PATH (necessary for cesium and titane only) |
---|
8848 | IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH} |
---|
8849 | |
---|
8850 | + IGCM_sys_RmRunDir -Rf /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313 |
---|
8851 | IGCM_sys_RmRunDir : -Rf /ccc/scratch/cont003/gencmip6/oboucher/RUN_DIR/422357_61313 |
---|
8852 | # ------------------------------------------------------------------ |
---|
8853 | # Finalize BigBrother to inform that the jobs end |
---|
8854 | # ------------------------------------------------------------------ |
---|
8855 | IGCM_debug_BigBro_Finalize |
---|
8856 | |
---|
8857 | + IGCM_debug_BigBro_Finalize |
---|
8858 | date |
---|
8859 | + date |
---|
8860 | Fri Jul 27 12:34:20 CEST 2018 |
---|
8861 | #### SCRIPT ENDS HERE #### |
---|
8862 | exit 0 |
---|
8863 | + exit 0 |
---|
8864 | ########## ########## ########## ########## ########## ########## ########## ########## |
---|
8865 | Execution Sum Up |
---|
8866 | ########## ########## ########## ########## ########## ########## ########## ########## |
---|
8867 | Jobid : 422357 |
---|
8868 | Jobname : TS |
---|
8869 | User : oboucher |
---|
8870 | Account : dekcmip6@standard |
---|
8871 | Limits : time = 22:14:00 , memory/task = 4000 Mo |
---|
8872 | Date : submit = 27/07/2018 12:34:14 , start = 27/07/2018 12:34:14 |
---|
8873 | Execution : partition = standard , QoS = normal , Comment = (null) |
---|
8874 | Resources : ntasks = 1 , cpus/task = 4 , ncpus = 4 , nodes = 1 |
---|
8875 | Nodes=curie1751 CPU_IDs=4-7 Mem=16000 |
---|
8876 | |
---|
8877 | Memory / step |
---|
8878 | -------------- |
---|
8879 | Resident Size (Mo) Virtual Size (Go) |
---|
8880 | JobID Max (Node:Task) AveTask Max (Node:Task) AveTask |
---|
8881 | ----------- ------------------------ ------- -------------------------- ------- |
---|
8882 | |
---|
8883 | Accounting / step |
---|
8884 | ------------------ |
---|
8885 | |
---|
8886 | JobID JobName Ntasks Ncpus Nnodes Layout Elapsed Ratio CPusage Eff State |
---|
8887 | ------------ ------------ ------ ----- ------ ------- ------- ----- ------- --- ----- |
---|
8888 | 422357 TS - 4 1 - 00:00:06 100 - - - |
---|
8889 | ########## ########## ########## ########## ########## ########## ########## ########## |
---|