1 | #!/bin/ksh |
---|
2 | |
---|
3 | #************************************************************** |
---|
4 | # Author: Sebastien Denvil, Martial Mancip |
---|
5 | # Contact: Martial.Mancip__at__ipsl.jussieu.fr |
---|
6 | # $Revision:: $ Revision of last commit |
---|
7 | # $Author:: $ Author of last commit |
---|
8 | # $Date:: $ Date of last commit |
---|
9 | # IPSL (2006) |
---|
10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
11 | # |
---|
12 | #************************************************************** |
---|
13 | |
---|
14 | #========================================================= |
---|
15 | # The documentation of this file can be automatically generated |
---|
16 | # if you use the prefix #D- for comments to be extracted. |
---|
17 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
18 | #========================================================= |
---|
19 | |
---|
20 | #D-#================================================== |
---|
21 | #D-LibIGCM_sys Default host |
---|
22 | #D-#================================================== |
---|
23 | #D- |
---|
24 | #D- This ksh library if a layer under some usefull |
---|
25 | #D- environment variables and shell commands. |
---|
26 | #D- All those definitions depend on host particularities. |
---|
27 | #D- It manages a stack mechanism and test validity of operations. |
---|
28 | #D- All function described bellow must be prefixed by IGCM_sys. |
---|
29 | |
---|
30 | #==================================================== |
---|
31 | # libIGCM_sys PARAMETERS |
---|
32 | #==================================================== |
---|
33 | |
---|
34 | #==================================================== |
---|
35 | #set DEBUG_sys to true to output calls of function |
---|
36 | typeset -r DEBUG_sys=${DEBUG_sys:=true} |
---|
37 | |
---|
38 | #==================================================== |
---|
39 | # Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get) |
---|
40 | typeset -r DRYRUN=${DRYRUN:=0} |
---|
41 | |
---|
42 | # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! |
---|
43 | # ------------------------------------------------------------------------------------- |
---|
44 | # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | |
---|
45 | # | | Cp/Exe param files | | Chmod | | |
---|
46 | # | | Qsub | | | | |
---|
47 | # ------------------------------------------------------------------------------------- |
---|
48 | # | 0 | yes | yes | yes | yes | |
---|
49 | # ------------------------------------------------------------------------------------- |
---|
50 | # | 1 | yes | yes | yes | no | |
---|
51 | # ------------------------------------------------------------------------------------- |
---|
52 | # | 2 | yes | yes | no | no | |
---|
53 | # ------------------------------------------------------------------------------------- |
---|
54 | # | 3 | yes | no | no | no | |
---|
55 | # ------------------------------------------------------------------------------------- |
---|
56 | |
---|
57 | #===================================================== |
---|
58 | #Global Variables : |
---|
59 | #===================================================== |
---|
60 | # Language : "fr" or "en" |
---|
61 | typeset -r MYLANG="fr" |
---|
62 | |
---|
63 | #===================================================== |
---|
64 | # Host and user names |
---|
65 | # $hostname ou hostname |
---|
66 | typeset HOST=${HOST:=$( hostname )} |
---|
67 | # $username ou whoami |
---|
68 | typeset LOGIN=${LOGIN:=$( whoami )} |
---|
69 | # $hostname of the MASTER job |
---|
70 | typeset -r MASTER=${HOST} |
---|
71 | |
---|
72 | #D- |
---|
73 | #D-#================================================== |
---|
74 | #D-Program used in libIGCM |
---|
75 | #D-#================================================== |
---|
76 | |
---|
77 | # rsync with path |
---|
78 | typeset -r RSYNC=/usr/bin/rsync |
---|
79 | #RSYNC_opt args to rsync |
---|
80 | typeset -r RSYNC_opt="-va" |
---|
81 | #"-Lt -v" |
---|
82 | # ie storage filesystem |
---|
83 | typeset -r STOREHOST=${MASTER} |
---|
84 | |
---|
85 | #==================================================== |
---|
86 | # Set environment tools (ferret, nco, cdo) |
---|
87 | #==================================================== |
---|
88 | #. /home/${LOGIN}/.atlas_env_${HOST}_ksh |
---|
89 | |
---|
90 | #==================================================== |
---|
91 | # Host specific DIRECTORIES |
---|
92 | #==================================================== |
---|
93 | |
---|
94 | #==================================================== |
---|
95 | #- MirrorlibIGCM for frontend |
---|
96 | typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} |
---|
97 | |
---|
98 | #==================================================== |
---|
99 | #- libIGCM_POST |
---|
100 | typeset -r libIGCM_POST=${libIGCM} |
---|
101 | |
---|
102 | #==================================================== |
---|
103 | #- R_EXE (==> BIN_DIR = ${MODIPSL}/bin ) |
---|
104 | typeset -r R_EXE="${MODIPSL}/bin" |
---|
105 | |
---|
106 | #==================================================== |
---|
107 | #- SCRATCHDIR (=> ${R_DONNEES}) |
---|
108 | typeset -r SCRATCHDIR=/tmp |
---|
109 | |
---|
110 | #==================================================== |
---|
111 | #- SUBMIT_DIR : submission dir |
---|
112 | typeset SUBMIT_DIR=${SUBMIT_DIR:=${PWD}} |
---|
113 | |
---|
114 | #==================================================== |
---|
115 | #- ARCHIVE (dedicated to large files) |
---|
116 | typeset -r ARCHIVE=/home/${LOGIN} |
---|
117 | |
---|
118 | #- ARCHIVE (dedicated to small/medium files) |
---|
119 | typeset -r STORAGE=${ARCHIVE} |
---|
120 | |
---|
121 | #==================================================== |
---|
122 | #- IN |
---|
123 | typeset -r R_IN=${R_IN:=${ARCHIVE}/IGCM} |
---|
124 | |
---|
125 | #==================================================== |
---|
126 | #- OUT |
---|
127 | IGCM_OUT=${IGCM_OUT:=IGCM_OUT} |
---|
128 | typeset -r R_OUT=${ARCHIVE}/${IGCM_OUT} |
---|
129 | |
---|
130 | #==================================================== |
---|
131 | #- R_FIG (hosting figures : monitoring and atlas, and/or small files) |
---|
132 | typeset -r R_FIG=${STORAGE}/IGCM_OUT |
---|
133 | |
---|
134 | #==================================================== |
---|
135 | #- R_BUF (ONLY FOR double copy an scratch) |
---|
136 | typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT |
---|
137 | |
---|
138 | #==================================================== |
---|
139 | #- BIG_DIR : BIG_DIR to store files waiting for rebuild |
---|
140 | typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} |
---|
141 | |
---|
142 | #==================================================== |
---|
143 | #- OUT_POST |
---|
144 | typeset -r R_OUT_POST=${R_OUT} |
---|
145 | |
---|
146 | #==================================================== |
---|
147 | #- RUN_DIR_PATH : Temporary working directory (=> TMP) |
---|
148 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$} |
---|
149 | |
---|
150 | #==================================================== |
---|
151 | #- HOST_MPIRUN_COMMAND |
---|
152 | typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"} |
---|
153 | |
---|
154 | #========================================================= |
---|
155 | #- Add "time" before mpirun command |
---|
156 | MPIRUN_COMMAND="time "${MPIRUN_COMMAND} |
---|
157 | echo ${MPIRUN_COMMAND} |
---|
158 | |
---|
159 | #==================================================== |
---|
160 | #- Max number of arguments passed to nco operator or demigration command |
---|
161 | UNIX_MAX_LIMIT=360 |
---|
162 | |
---|
163 | #==================================================== |
---|
164 | #- Number of core per node (max number of OpenMP task) |
---|
165 | NUM_COREPERNODE=1 |
---|
166 | |
---|
167 | #==================================================== |
---|
168 | #- Default number of MPI task for IPSL coupled model |
---|
169 | #- required for backward compatibility |
---|
170 | #- |
---|
171 | DEFAULT_NUM_PROC_OCE=1 |
---|
172 | DEFAULT_NUM_PROC_CPL=1 |
---|
173 | (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) |
---|
174 | DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT} |
---|
175 | |
---|
176 | #D-#================================================== |
---|
177 | #D-function IGCM_sys_RshMaster |
---|
178 | #D-* Purpose: Just a fake command to wrapp |
---|
179 | #D- IGCM_card call in post-treatment |
---|
180 | #D- Ulam do not see brodie filesystem |
---|
181 | #D- Cesium do not see all mercure filesystem |
---|
182 | #D- That's why we need this hack. |
---|
183 | #D-* Examples: |
---|
184 | #D- |
---|
185 | function IGCM_sys_RshMaster { |
---|
186 | IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ |
---|
187 | ssh ${HOST} /bin/ksh <<-EOF |
---|
188 | export libIGCM=${libIGCM} |
---|
189 | export DEBUG_debug=${DEBUG_debug} |
---|
190 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
191 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
192 | ${@} |
---|
193 | EOF |
---|
194 | if [ $? -gt 0 ] ; then |
---|
195 | echo "IGCM_sys_RshMaster : erreur." |
---|
196 | IGCM_debug_Exit "IGCM_sys_RshMaster" |
---|
197 | fi |
---|
198 | IGCM_debug_PopStack "IGCM_sys_RshMaster" |
---|
199 | } |
---|
200 | |
---|
201 | #D-#================================================== |
---|
202 | #D-function IGCM_sys_RshArchive |
---|
203 | #D-* Purpose: Archive rsh command |
---|
204 | #D-* Examples: |
---|
205 | #D- |
---|
206 | function IGCM_sys_RshArchive { |
---|
207 | IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ |
---|
208 | /bin/ksh <<-EOF |
---|
209 | ${@} |
---|
210 | EOF |
---|
211 | if [ $? -gt 0 ] ; then |
---|
212 | echo "IGCM_sys_RshArchive : erreur." |
---|
213 | IGCM_debug_Exit "IGCM_sys_RshArchive" |
---|
214 | fi |
---|
215 | IGCM_debug_PopStack "IGCM_sys_RshArchive" |
---|
216 | } |
---|
217 | |
---|
218 | #D-#================================================== |
---|
219 | #D-function IGCM_sys_RshPost |
---|
220 | #D-* Purpose: Post-process rsh command |
---|
221 | #D-* Examples: |
---|
222 | #D- |
---|
223 | (( RshPNum = 0 )) |
---|
224 | function IGCM_sys_RshPost { |
---|
225 | IGCM_debug_PushStack "IGCM_sys_RshPost" $@ |
---|
226 | if ( $DEBUG_sys ) ; then |
---|
227 | echo "IGCM_sys_RshPost :" $@ |
---|
228 | fi |
---|
229 | #/bin/ksh -vx $@ > out_RshPost.${RshPNum} |
---|
230 | ssh ${HOST} /bin/ksh $@ > out_RshPost.${RshPNum} |
---|
231 | if [ $? -gt 0 ] ; then |
---|
232 | echo "IGCM_sys_RshPost : erreur." |
---|
233 | IGCM_debug_Exit "IGCM_sys_RshPost" |
---|
234 | fi |
---|
235 | (( RshPNum = RshPNum + 1 )) |
---|
236 | IGCM_debug_PopStack "IGCM_sys_RshPost" |
---|
237 | } |
---|
238 | |
---|
239 | #D-#================================================== |
---|
240 | #D-function IGCM_sys_SendMail |
---|
241 | #D-* Purpose: Send mail when simulation is over |
---|
242 | #D-* Examples: |
---|
243 | #D- |
---|
244 | function IGCM_sys_SendMail { |
---|
245 | IGCM_debug_PushStack "IGCM_sys_SendMail" $@ |
---|
246 | if ( $DEBUG_sys ) ; then |
---|
247 | echo "IGCM_sys_SendMail :" $@ |
---|
248 | fi |
---|
249 | |
---|
250 | if ( ${ExitFlag} ) ; then |
---|
251 | status=failed |
---|
252 | else |
---|
253 | status=completed |
---|
254 | fi |
---|
255 | cat << END_MAIL > job_end.mail |
---|
256 | Dear ${LOGIN}, |
---|
257 | |
---|
258 | Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`. |
---|
259 | Job started : ${DateBegin} |
---|
260 | Job ended : ${DateEnd} |
---|
261 | Output files are available in ${R_SAVE} |
---|
262 | Script files, Script Outputs and Debug files (if necessary) are available in ${SUBMIT_DIR} |
---|
263 | END_MAIL |
---|
264 | |
---|
265 | if [ ! -z ${config_UserChoices_MailName} ] ; then |
---|
266 | mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail |
---|
267 | elif [ -f ~/.forward ] ; then |
---|
268 | mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail |
---|
269 | fi |
---|
270 | |
---|
271 | if [ $? -gt 0 ] ; then |
---|
272 | echo "IGCM_sys_SendMail : erreur." |
---|
273 | IGCM_debug_Exit "IGCM_sys_SendMail" |
---|
274 | fi |
---|
275 | IGCM_debug_PopStack "IGCM_sys_SendMail" |
---|
276 | } |
---|
277 | |
---|
278 | #D-#================================================== |
---|
279 | #D-function IGCM_sys_Mkdir |
---|
280 | #D-* Purpose: Master locale mkdir command |
---|
281 | #D-* Examples: |
---|
282 | #D- |
---|
283 | function IGCM_sys_Mkdir { |
---|
284 | IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ |
---|
285 | if ( $DEBUG_sys ) ; then |
---|
286 | echo "IGCM_sys_Mkdir :" $@ |
---|
287 | fi |
---|
288 | if [ ! -d ${1} ]; then |
---|
289 | \mkdir -p $1 |
---|
290 | if [ $? -gt 0 ] ; then |
---|
291 | echo "IGCM_sys_Mkdir : erreur." |
---|
292 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
293 | fi |
---|
294 | fi |
---|
295 | # vérification : |
---|
296 | if [ ! -d ${1} ] ; then |
---|
297 | echo "IGCM_sys_Mkdir : erreur." |
---|
298 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
299 | fi |
---|
300 | IGCM_debug_PopStack "IGCM_sys_Mkdir" |
---|
301 | } |
---|
302 | |
---|
303 | #D-#================================================== |
---|
304 | #D-function IGCM_sys_MkdirArchive |
---|
305 | #D-* Purpose: Mkdir on Archive |
---|
306 | #D-* Examples: |
---|
307 | #D- |
---|
308 | function IGCM_sys_MkdirArchive { |
---|
309 | IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ |
---|
310 | if ( $DEBUG_sys ) ; then |
---|
311 | echo "IGCM_sys_MkdirArchive :" $@ |
---|
312 | fi |
---|
313 | #- creation de repertoire sur le serveur fichier |
---|
314 | if [ ! -d ${1} ]; then |
---|
315 | \mkdir -p $1 |
---|
316 | if [ $? -gt 0 ] ; then |
---|
317 | echo "IGCM_sys_MkdirArchive : erreur." |
---|
318 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
319 | fi |
---|
320 | fi |
---|
321 | IGCM_debug_PopStack "IGCM_sys_MkdirArchive" |
---|
322 | } |
---|
323 | |
---|
324 | #D-#================================================== |
---|
325 | #D-function IGCM_sys_MkdirWork |
---|
326 | #D-* Purpose: Mkdir on Work |
---|
327 | #D-* Examples: |
---|
328 | #D- |
---|
329 | function IGCM_sys_MkdirWork { |
---|
330 | IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ |
---|
331 | if ( $DEBUG_sys ) ; then |
---|
332 | echo "IGCM_sys_MkdirWork :" $@ |
---|
333 | fi |
---|
334 | #- creation de repertoire sur le serveur fichier |
---|
335 | if [ ! -d ${1} ]; then |
---|
336 | \mkdir -p $1 |
---|
337 | if [ $? -gt 0 ] ; then |
---|
338 | echo "IGCM_sys_MkdirWork : erreur." |
---|
339 | IGCM_debug_Exit "IGCM_sys_MkdirWork" |
---|
340 | fi |
---|
341 | fi |
---|
342 | IGCM_debug_PopStack "IGCM_sys_MkdirWork" |
---|
343 | } |
---|
344 | |
---|
345 | #D-#================================================== |
---|
346 | #D-function IGCM_sys_Cd |
---|
347 | #D-* Purpose: master cd command |
---|
348 | #D-* Examples: |
---|
349 | #D- |
---|
350 | function IGCM_sys_Cd { |
---|
351 | IGCM_debug_PushStack "IGCM_sys_Cd" $@ |
---|
352 | if ( $DEBUG_sys ) ; then |
---|
353 | echo "IGCM_sys_Cd :" $@ |
---|
354 | fi |
---|
355 | \cd $1 |
---|
356 | if [ $? -gt 0 ] ; then |
---|
357 | echo "IGCM_sys_Cd : erreur." |
---|
358 | IGCM_debug_Exit "IGCM_sys_Cd" |
---|
359 | fi |
---|
360 | IGCM_debug_PopStack "IGCM_sys_Cd" |
---|
361 | } |
---|
362 | |
---|
363 | #D-#================================================== |
---|
364 | #D-function IGCM_sys_Chmod |
---|
365 | #D-* Purpose: Chmod |
---|
366 | #D-* Examples: |
---|
367 | #D- |
---|
368 | function IGCM_sys_Chmod { |
---|
369 | IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ |
---|
370 | if ( $DEBUG_sys ) ; then |
---|
371 | echo "IGCM_sys_Chmod :" $@ |
---|
372 | fi |
---|
373 | if [ $DRYRUN -le 1 ]; then |
---|
374 | \chmod $@ |
---|
375 | if [ $? -gt 0 ] ; then |
---|
376 | echo "IGCM_sys_Chmod : erreur." |
---|
377 | IGCM_debug_Exit "IGCM_sys_Chmod" |
---|
378 | fi |
---|
379 | else |
---|
380 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
381 | fi |
---|
382 | IGCM_debug_PopStack "IGCM_sys_Chmod" |
---|
383 | } |
---|
384 | |
---|
385 | #D-#================================================== |
---|
386 | #D-function IGCM_sys_FileSize |
---|
387 | #D-* Purpose: Filesize |
---|
388 | #D-* Examples: |
---|
389 | #D- |
---|
390 | function IGCM_sys_FileSize { |
---|
391 | IGCM_debug_PushStack "IGCM_sys_FileSize" $@ |
---|
392 | |
---|
393 | typeset sizeF |
---|
394 | set +A sizeF -- $( ls -la ${1} ) |
---|
395 | if [ $? -gt 0 ] ; then |
---|
396 | IGCM_debug_Exit "IGCM_sys_FileSize" |
---|
397 | fi |
---|
398 | eval ${2}=${sizeF[4]} |
---|
399 | |
---|
400 | IGCM_debug_PopStack "IGCM_sys_FileSize" |
---|
401 | } |
---|
402 | |
---|
403 | #D-#================================================== |
---|
404 | #D-function IGCM_sys_TestDir |
---|
405 | #D-* Purpose: Test Directory that must exists |
---|
406 | #D-* Examples: |
---|
407 | #D- |
---|
408 | function IGCM_sys_TestDir { |
---|
409 | IGCM_debug_PushStack "IGCM_sys_TestDir" $@ |
---|
410 | if ( $DEBUG_sys ) ; then |
---|
411 | echo "IGCM_sys_TestDir :" $@ |
---|
412 | fi |
---|
413 | typeset ExistFlag |
---|
414 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
415 | IGCM_debug_PopStack "IGCM_sys_TestDir" |
---|
416 | |
---|
417 | return ${ExistFlag} |
---|
418 | } |
---|
419 | |
---|
420 | #D-#================================================== |
---|
421 | #D-function IGCM_sys_TestDirArchive |
---|
422 | #D-* Purpose: Test Directory that must exists on Archive |
---|
423 | #D-* Examples: |
---|
424 | #D- |
---|
425 | function IGCM_sys_TestDirArchive { |
---|
426 | IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ |
---|
427 | if ( $DEBUG_sys ) ; then |
---|
428 | echo "IGCM_sys_TestDirArchive :" $@ |
---|
429 | fi |
---|
430 | typeset ExistFlag |
---|
431 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
432 | IGCM_debug_PopStack "IGCM_sys_TestDirArchive" |
---|
433 | |
---|
434 | return ${ExistFlag} |
---|
435 | } |
---|
436 | |
---|
437 | #D-#================================================== |
---|
438 | #D-function IGCM_sys_TestFileArchive |
---|
439 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
440 | #D-* Examples: |
---|
441 | #D- |
---|
442 | function IGCM_sys_TestFileArchive { |
---|
443 | IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ |
---|
444 | typeset ExistFlag |
---|
445 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
446 | IGCM_debug_PopStack "IGCM_sys_TestFileArchive" |
---|
447 | |
---|
448 | return ${ExistFlag} |
---|
449 | } |
---|
450 | |
---|
451 | #D-#================================================== |
---|
452 | #D-function IGCM_sys_TestFileBuffer |
---|
453 | #D-* Purpose: Test file that must NOT EXISTS on Buffer |
---|
454 | #D-* Examples: |
---|
455 | #D- |
---|
456 | function IGCM_sys_TestFileBuffer { |
---|
457 | IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ |
---|
458 | typeset ExistFlag |
---|
459 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
460 | IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" |
---|
461 | |
---|
462 | return ${ExistFlag} |
---|
463 | } |
---|
464 | |
---|
465 | #D-#================================================== |
---|
466 | #D-function IGCM_sys_CountFileArchive |
---|
467 | #D-* Purpose: Count files on Archive filesystem |
---|
468 | #D-* Examples: |
---|
469 | #D- |
---|
470 | function IGCM_sys_CountFileArchive { |
---|
471 | IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ |
---|
472 | ls ${@} 2>/dev/null | wc -l |
---|
473 | if [ $? -gt 0 ] ; then |
---|
474 | echo "IGCM_sys_CountFileArchive : erreur." |
---|
475 | fi |
---|
476 | IGCM_debug_PopStack "IGCM_sys_CountFileArchive" |
---|
477 | } |
---|
478 | |
---|
479 | #D-#================================================== |
---|
480 | #D-function IGCM_sys_CountFileBuffer |
---|
481 | #D-* Purpose: Count files on Scratch filesystem |
---|
482 | #D-* Examples: |
---|
483 | #D- |
---|
484 | function IGCM_sys_CountFileBuffer { |
---|
485 | IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ |
---|
486 | ls ${@} 2>/dev/null | wc -l |
---|
487 | if [ $? -gt 0 ] ; then |
---|
488 | echo "IGCM_sys_CountFileBuffer : erreur." |
---|
489 | fi |
---|
490 | IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" |
---|
491 | } |
---|
492 | |
---|
493 | #D-#================================================== |
---|
494 | #D-function IGCM_sys_Tree |
---|
495 | #D-* Purpose: Tree directories with files on ${ARCHIVE} |
---|
496 | #D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT} |
---|
497 | #D- |
---|
498 | function IGCM_sys_Tree { |
---|
499 | IGCM_debug_PushStack "IGCM_sys_Tree" $@ |
---|
500 | if ( $DEBUG_sys ) ; then |
---|
501 | echo "IGCM_sys_Tree :" $@ |
---|
502 | fi |
---|
503 | |
---|
504 | \tree -f $@ |
---|
505 | |
---|
506 | IGCM_debug_PopStack "IGCM_sys_Tree" |
---|
507 | } |
---|
508 | |
---|
509 | #D-#================================================== |
---|
510 | #D-function IGCM_sys_Tar |
---|
511 | #D-* Purpose: master tar command |
---|
512 | #D-* Examples: |
---|
513 | #D- |
---|
514 | function IGCM_sys_Tar { |
---|
515 | IGCM_debug_PushStack "IGCM_sys_Tar" $@ |
---|
516 | if ( $DEBUG_sys ) ; then |
---|
517 | echo "IGCM_sys_Tar :" $@ |
---|
518 | fi |
---|
519 | \tar cf $@ |
---|
520 | if [ $? -gt 0 ] ; then |
---|
521 | echo "IGCM_sys_Tar : erreur." |
---|
522 | IGCM_debug_Exit "IGCM_sys_Tar" |
---|
523 | fi |
---|
524 | |
---|
525 | IGCM_debug_PopStack "IGCM_sys_Tar" |
---|
526 | } |
---|
527 | |
---|
528 | #D-#================================================== |
---|
529 | #D-function IGCM_sys_UnTar |
---|
530 | #D-* Purpose: master un-tar command |
---|
531 | #D-* Examples: |
---|
532 | #D- |
---|
533 | function IGCM_sys_UnTar { |
---|
534 | IGCM_debug_PushStack "IGCM_sys_UnTar" $@ |
---|
535 | if ( $DEBUG_sys ) ; then |
---|
536 | echo "IGCM_sys_UnTar :" $@ |
---|
537 | fi |
---|
538 | \tar xvf $1 |
---|
539 | if [ $? -gt 0 ] ; then |
---|
540 | echo "IGCM_sys_UnTar : erreur." |
---|
541 | IGCM_debug_Exit "IGCM_sys_UnTar" |
---|
542 | fi |
---|
543 | IGCM_debug_PopStack "IGCM_sys_UnTar" |
---|
544 | } |
---|
545 | |
---|
546 | #D-#================================================== |
---|
547 | #D-function IGCM_sys_Qsub |
---|
548 | #D-* Purpose: Qsub new job |
---|
549 | #D-* Examples: |
---|
550 | #D- |
---|
551 | function IGCM_sys_Qsub { |
---|
552 | IGCM_debug_PushStack "IGCM_sys_Qsub" $@ |
---|
553 | if ( $DEBUG_sys ) ; then |
---|
554 | echo "IGCM_sys_Qsub :" $@ |
---|
555 | fi |
---|
556 | echo "ssh -l ${LOGIN} ${HOST} ""cd ${SUBMIT_DIR} ; ${@}"" > ${Script_Output} 2>&1 &" |
---|
557 | ssh -l ${LOGIN} ${HOST} "cd ${SUBMIT_DIR} ; ${@}" > ${Script_Output} 2>&1 & |
---|
558 | if [ $? -gt 0 ] ; then |
---|
559 | echo "IGCM_sys_Qsub : erreur." |
---|
560 | IGCM_debug_Exit "IGCM_sys_Qsub" |
---|
561 | fi |
---|
562 | IGCM_debug_PopStack "IGCM_sys_Qsub" |
---|
563 | } |
---|
564 | |
---|
565 | #D-#================================================== |
---|
566 | #D-function IGCM_sys_QsubPost |
---|
567 | #D-* Purpose: Qsub new job on scalaire |
---|
568 | #D-* Examples: |
---|
569 | #D- |
---|
570 | function IGCM_sys_QsubPost { |
---|
571 | IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ |
---|
572 | if ( $DEBUG_sys ) ; then |
---|
573 | echo "IGCM_sys_QsubPost :" $@ |
---|
574 | fi |
---|
575 | #echo "ssh -x -l ${LOGIN} ${HOST} ${3} > ${2} 2>&1 &" |
---|
576 | # ssh -x -l ${LOGIN} ${HOST} |
---|
577 | echo "${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 2>&1 &" |
---|
578 | ${libIGCM_POST}/$1.job > ${POST_DIR}/${Script_Post_Output}.out 2>&1 & |
---|
579 | # ${3} > ${2} 2>&1 & |
---|
580 | if [ $? -gt 0 ] ; then |
---|
581 | echo "IGCM_sys_QsubPost : erreur " $@ |
---|
582 | IGCM_debug_Exit "IGCM_sys_QsubPost" |
---|
583 | fi |
---|
584 | IGCM_debug_PopStack "IGCM_sys_QsubPost" |
---|
585 | } |
---|
586 | |
---|
587 | #D-************************* |
---|
588 | #D- File transfer functions |
---|
589 | #D-************************* |
---|
590 | #D- |
---|
591 | |
---|
592 | #D-#================================================== |
---|
593 | #D-function IGCM_sys_Rsync_out |
---|
594 | #D-* Purpose: treat return val of rsync |
---|
595 | #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync |
---|
596 | #D- Error values and explanations can depend on your system version. |
---|
597 | function IGCM_sys_Rsync_out { |
---|
598 | RET=$1 |
---|
599 | if [ ! $RET ] ; then |
---|
600 | echo "rsync error !" |
---|
601 | fi |
---|
602 | |
---|
603 | if [ $MYLANG = "fr" ]; then |
---|
604 | case $RET in |
---|
605 | 0) return ;; |
---|
606 | 1) echo "Erreur de rsync ; RERR_SYNTAX : " |
---|
607 | echo "Erreur de syntaxe ou d'utilisation." |
---|
608 | return;; |
---|
609 | 2) echo "Erreur de rsync ; RERR_PROTOCOL : " |
---|
610 | echo "Incompatibilité de protocole." |
---|
611 | return;; |
---|
612 | 3) echo "Erreur de rsync ; RERR_FILESELECT 3" |
---|
613 | echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" |
---|
614 | echo "répertoires" |
---|
615 | return;; |
---|
616 | 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" |
---|
617 | echo "Action demandée non supportée : une tentative de manipulation de" |
---|
618 | echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" |
---|
619 | echo "été faite ; ou une option qui est supportée par le client mais" |
---|
620 | echo "pas par le serveur a été spécifiée." |
---|
621 | return;; |
---|
622 | 10) echo "Erreur de rsync ; RERR_SOCKETIO" |
---|
623 | echo "Erreur dans le socket d'entrée sortie" |
---|
624 | return;; |
---|
625 | 11) echo "Erreur de rsync ; RERR_FILEIO" |
---|
626 | echo "Erreur d'entrée sortie fichier" |
---|
627 | return;; |
---|
628 | 12) echo "Erreur de rsync ; RERR_STREAMIO" |
---|
629 | echo "Erreur dans flux de donnée du protocole rsync" |
---|
630 | return;; |
---|
631 | 13) echo "Erreur de rsync ; RERR_MESSAGEIO" |
---|
632 | echo "Erreur avec les diagnostics du programme" |
---|
633 | return;; |
---|
634 | 14) echo "Erreur de rsync ; RERR_IPC" |
---|
635 | echo "Erreur dans le code IPC" |
---|
636 | return;; |
---|
637 | 20) echo "Erreur de rsync ; RERR_SIGNAL" |
---|
638 | echo "SIGUSR1 ou SIGINT reçu" |
---|
639 | return;; |
---|
640 | 21) echo "Erreur de rsync ; RERR_WAITCHILD" |
---|
641 | echo "Une erreur retournée par waitpid()" |
---|
642 | return;; |
---|
643 | 22) echo "Erreur de rsync ; RERR_MALLOC" |
---|
644 | echo "Erreur lors de l'allocation des tampons de mémoire de coeur" |
---|
645 | return;; |
---|
646 | 23) echo "" |
---|
647 | echo "Erreur fichier inexistant" |
---|
648 | return;; |
---|
649 | 30) echo "Erreur de rsync ; RERR_TIMEOUT" |
---|
650 | echo "Temps d'attente écoulé dans l'envoi/réception de données" |
---|
651 | return;; |
---|
652 | *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET |
---|
653 | return;; |
---|
654 | esac |
---|
655 | elif [ $MYLANG = "en" ] ; then |
---|
656 | case $RET in |
---|
657 | 0) return;; |
---|
658 | 1) echo "rsync error : Syntax or usage error " |
---|
659 | return;; |
---|
660 | 2) echo "rsync error : Protocol incompatibility " |
---|
661 | return;; |
---|
662 | 3) echo "rsync error : Errors selecting input/output files, dirs" |
---|
663 | return;; |
---|
664 | 4) echo "rsync error : Requested action not supported: an attempt" |
---|
665 | echo "was made to manipulate 64-bit files on a platform that cannot support" |
---|
666 | echo "them; or an option was specified that is supported by the client and" |
---|
667 | echo "not by the server." |
---|
668 | return;; |
---|
669 | 5) echo "rsync error : Error starting client-server protocol" |
---|
670 | return;; |
---|
671 | 10) echo "rsync error : Error in socket I/O " |
---|
672 | return;; |
---|
673 | 11) echo "rsync error : Error in file I/O " |
---|
674 | return;; |
---|
675 | 12) echo "rsync error : Error in rsync protocol data stream " |
---|
676 | return;; |
---|
677 | 13) echo "rsync error : Errors with program diagnostics " |
---|
678 | return;; |
---|
679 | 14) echo "rsync error : Error in IPC code " |
---|
680 | return;; |
---|
681 | 20) echo "rsync error : Received SIGUSR1 or SIGINT " |
---|
682 | return;; |
---|
683 | 21) echo "rsync error : Some error returned by waitpid() " |
---|
684 | return;; |
---|
685 | 22) echo "rsync error : Error allocating core memory buffers " |
---|
686 | return;; |
---|
687 | 23) echo "rsync error : Partial transfer due to error" |
---|
688 | return;; |
---|
689 | 24) echo "rsync error : Partial transfer due to vanished source files" |
---|
690 | return;; |
---|
691 | 30) echo "rsync error : Timeout in data send/receive " |
---|
692 | return;; |
---|
693 | *) echo "rsync error : return code of rsync unknown :" $RET |
---|
694 | return;; |
---|
695 | esac |
---|
696 | else |
---|
697 | echo "unknown language $MYLANG." |
---|
698 | return |
---|
699 | fi |
---|
700 | } |
---|
701 | |
---|
702 | #D-#================================================== |
---|
703 | #D-function IGCM_sys_Cp |
---|
704 | #D-* Purpose: generic cp |
---|
705 | #D-* Examples: |
---|
706 | #D- |
---|
707 | function IGCM_sys_Cp { |
---|
708 | IGCM_debug_PushStack "IGCM_sys_Cp" $@ |
---|
709 | if ( $DEBUG_sys ) ; then |
---|
710 | echo "IGCM_sys_Cp :" $@ |
---|
711 | fi |
---|
712 | |
---|
713 | typeset RET |
---|
714 | |
---|
715 | echo cp --preserve=timestamps $@ > out_rsync 2>&1 |
---|
716 | \cp --preserve=timestamps $@ >> out_rsync 2>&1 |
---|
717 | RET=$? |
---|
718 | |
---|
719 | if [ ${RET} -gt 0 ] ; then |
---|
720 | echo "" |
---|
721 | # echo "IGCM_sys_Cp : error." |
---|
722 | # cat out_rsync |
---|
723 | # IGCM_debug_Exit "IGCM_sys_Cp" |
---|
724 | else |
---|
725 | \rm out_rsync |
---|
726 | fi |
---|
727 | IGCM_debug_PopStack "IGCM_sys_Cp" |
---|
728 | } |
---|
729 | |
---|
730 | #D-#================================================== |
---|
731 | #D-function IGCM_sys_Rm |
---|
732 | #D-* Purpose: generic rm |
---|
733 | #D-* Examples: |
---|
734 | #D- |
---|
735 | function IGCM_sys_Rm { |
---|
736 | IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ |
---|
737 | if ( $DEBUG_sys ) ; then |
---|
738 | echo "IGCM_sys_Rm :" $@ |
---|
739 | fi |
---|
740 | |
---|
741 | typeset RET |
---|
742 | |
---|
743 | echo rm $@ > out_rsync 2>&1 |
---|
744 | \rm $@ >> out_rsync 2>&1 |
---|
745 | RET=$? |
---|
746 | |
---|
747 | if [ ${RET} -gt 0 ] ; then |
---|
748 | echo "IGCM_sys_Rm : error." |
---|
749 | cat out_rsync |
---|
750 | IGCM_debug_Exit "IGCM_sys_Rm" |
---|
751 | else |
---|
752 | \rm out_rsync |
---|
753 | fi |
---|
754 | IGCM_debug_PopStack "IGCM_sys_Rm" |
---|
755 | } |
---|
756 | |
---|
757 | #D-#================================================== |
---|
758 | #D-function IGCM_sys_RmRunDir |
---|
759 | #D-* Purpose: rm tmpdir (dummy function most of the time batch |
---|
760 | #D- scheduler will do the job) |
---|
761 | #D-* Examples: |
---|
762 | #D- |
---|
763 | function IGCM_sys_RmRunDir { |
---|
764 | IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ |
---|
765 | if ( $DEBUG_sys ) ; then |
---|
766 | echo "IGCM_sys_RmRunDir :" $@ |
---|
767 | echo "Dummy call, let the scheduler do that." |
---|
768 | # IGCM_sys_Rm -rf ${RUN_DIR} |
---|
769 | fi |
---|
770 | IGCM_debug_PopStack "IGCM_sys_RmRunDir" |
---|
771 | } |
---|
772 | |
---|
773 | #D-#================================================== |
---|
774 | #D-function IGCM_sys_Mv |
---|
775 | #D-* Purpose: generic move |
---|
776 | #D-* Examples: |
---|
777 | #D- |
---|
778 | function IGCM_sys_Mv { |
---|
779 | IGCM_debug_PushStack "IGCM_sys_Mv" $@ |
---|
780 | if ( $DEBUG_sys ) ; then |
---|
781 | echo "IGCM_sys_Mv :" $@ |
---|
782 | fi |
---|
783 | |
---|
784 | if [ $DRYRUN = 0 ]; then |
---|
785 | |
---|
786 | typeset RET |
---|
787 | |
---|
788 | echo mv $@ > out_rsync 2>&1 |
---|
789 | \mv $@ >> out_rsync 2>&1 |
---|
790 | RET=$? |
---|
791 | |
---|
792 | if [ ${RET} -gt 0 ] ; then |
---|
793 | echo "IGCM_sys_Mv : error in mv." |
---|
794 | cat out_rsync |
---|
795 | IGCM_debug_Exit "IGCM_sys_Mv" |
---|
796 | else |
---|
797 | \rm out_rsync |
---|
798 | fi |
---|
799 | else |
---|
800 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
801 | fi |
---|
802 | |
---|
803 | IGCM_debug_PopStack "IGCM_sys_Mv" |
---|
804 | } |
---|
805 | |
---|
806 | #D-#================================================== |
---|
807 | #D-function IGCM_sys_Put_Dir |
---|
808 | #D-* Purpose: Copy a complete directory on $(ARCHIVE) |
---|
809 | #D-* Examples: |
---|
810 | #D- |
---|
811 | function IGCM_sys_Put_Dir { |
---|
812 | IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ |
---|
813 | if ( $DEBUG_sys ) ; then |
---|
814 | echo "IGCM_sys_Put_Dir :" $@ |
---|
815 | fi |
---|
816 | if [ $DRYRUN = 0 ]; then |
---|
817 | if [ ! -d ${1} ] ; then |
---|
818 | echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." |
---|
819 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
820 | return |
---|
821 | fi |
---|
822 | |
---|
823 | typeset RET |
---|
824 | |
---|
825 | # Only if we use rsync |
---|
826 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
827 | # |
---|
828 | #USUAL WAY |
---|
829 | \cp -R $1 $2 > out_rsync 2>&1 |
---|
830 | RET=$? |
---|
831 | |
---|
832 | if [ ${RET} -gt 0 ] ; then |
---|
833 | echo "IGCM_sys_Put_Dir : error." |
---|
834 | cat out_rsync |
---|
835 | IGCM_debug_Exit "IGCM_sys_Put_Dir" |
---|
836 | else |
---|
837 | \rm out_rsync |
---|
838 | fi |
---|
839 | else |
---|
840 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
841 | fi |
---|
842 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
843 | } |
---|
844 | |
---|
845 | #D-#================================================== |
---|
846 | #D-function IGCM_sys_Get_Dir |
---|
847 | #D-* Purpose: Copy a complete directory from $(ARCHIVE) |
---|
848 | #D-* Examples: |
---|
849 | #D- |
---|
850 | function IGCM_sys_Get_Dir { |
---|
851 | IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ |
---|
852 | if ( $DEBUG_sys ) ; then |
---|
853 | echo "IGCM_sys_Get_Dir :" $@ |
---|
854 | fi |
---|
855 | if [ $DRYRUN = 0 ]; then |
---|
856 | if [ ! -d ${1} ] ; then |
---|
857 | echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." |
---|
858 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
859 | return |
---|
860 | fi |
---|
861 | |
---|
862 | typeset RET |
---|
863 | |
---|
864 | #USUAL WAY |
---|
865 | \cp -R $1 $2 > out_rsync 2>&1 |
---|
866 | RET=$? |
---|
867 | |
---|
868 | if [ ${RET} -gt 0 ] ; then |
---|
869 | echo "IGCM_sys_Get_Dir : error." |
---|
870 | cat out_rsync |
---|
871 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
872 | else |
---|
873 | \rm out_rsync |
---|
874 | fi |
---|
875 | else |
---|
876 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
877 | fi |
---|
878 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
879 | } |
---|
880 | |
---|
881 | #D-#================================================== |
---|
882 | #D-function IGCM_sys_Get_Master |
---|
883 | #D-* Purpose: Copy a complete directory from MASTER filesystem |
---|
884 | #D-* Examples: |
---|
885 | #D- |
---|
886 | function IGCM_sys_Get_Master { |
---|
887 | IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ |
---|
888 | if ( $DEBUG_sys ) ; then |
---|
889 | echo "IGCM_sys_Get_Master :" $@ |
---|
890 | fi |
---|
891 | if [ $DRYRUN = 0 ]; then |
---|
892 | if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then |
---|
893 | echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." |
---|
894 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
895 | return |
---|
896 | fi |
---|
897 | |
---|
898 | typeset RET |
---|
899 | |
---|
900 | #USUAL WAY |
---|
901 | cp -RL $1 $2 > out_rsync 2>&1 |
---|
902 | RET=$? |
---|
903 | |
---|
904 | if [ ${RET} -gt 0 ] ; then |
---|
905 | echo "IGCM_sys_Get_Master : error." |
---|
906 | cat out_rsync |
---|
907 | IGCM_debug_Exit "IGCM_sys_Get_Master" |
---|
908 | else |
---|
909 | \rm out_rsync |
---|
910 | fi |
---|
911 | else |
---|
912 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
913 | fi |
---|
914 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
915 | } |
---|
916 | |
---|
917 | #D-#================================================== |
---|
918 | #D-function IGCM_sys_Put_Rest |
---|
919 | #D-* Purpose: Put computied restarts on $(ARCHIVE). |
---|
920 | #D- File and target directory must exist. |
---|
921 | #D-* Examples: |
---|
922 | #D- |
---|
923 | function IGCM_sys_Put_Rest { |
---|
924 | IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ |
---|
925 | if ( $DEBUG_sys ) ; then |
---|
926 | echo "IGCM_sys_Put_Rest :" $@ |
---|
927 | fi |
---|
928 | if [ $DRYRUN = 0 ]; then |
---|
929 | |
---|
930 | IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
931 | |
---|
932 | if [ ! -f ${1} ] ; then |
---|
933 | echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." |
---|
934 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
935 | fi |
---|
936 | if [ X${JobType} = XRUN ] ; then |
---|
937 | IGCM_sys_Chmod 444 ${1} |
---|
938 | fi |
---|
939 | |
---|
940 | typeset RET |
---|
941 | |
---|
942 | echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 |
---|
943 | ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 |
---|
944 | RET=$? |
---|
945 | IGCM_sys_Rsync_out $RET |
---|
946 | |
---|
947 | ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
948 | (( RET=RET+$? )) |
---|
949 | |
---|
950 | if [ ${RET} -gt 0 ] ; then |
---|
951 | echo "IGCM_sys_Put_Rest : error." |
---|
952 | cat out_rsync |
---|
953 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
954 | else |
---|
955 | \rm out_rsync |
---|
956 | fi |
---|
957 | else |
---|
958 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
959 | fi |
---|
960 | IGCM_debug_PopStack "IGCM_sys_Put_Rest" |
---|
961 | } |
---|
962 | |
---|
963 | #D-#================================================== |
---|
964 | #D-function IGCM_sys_PutBuffer_Rest |
---|
965 | #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. |
---|
966 | #D- File and target directory must exist. |
---|
967 | #D-* Examples: |
---|
968 | #D- |
---|
969 | function IGCM_sys_PutBuffer_Rest { |
---|
970 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ |
---|
971 | if ( $DEBUG_sys ) ; then |
---|
972 | echo "IGCM_sys_PutBuffer_Rest :" $@ |
---|
973 | fi |
---|
974 | if [ $DRYRUN = 0 ]; then |
---|
975 | if [ ! -f ${1} ] ; then |
---|
976 | echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." |
---|
977 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
978 | fi |
---|
979 | |
---|
980 | typeset RET |
---|
981 | # |
---|
982 | if [ X${JobType} = XRUN ] ; then |
---|
983 | IGCM_sys_Chmod 444 ${1} |
---|
984 | fi |
---|
985 | |
---|
986 | # |
---|
987 | # USUAL WAY |
---|
988 | \cp $1 $2 > out_rsync 2>&1 |
---|
989 | RET=$? |
---|
990 | |
---|
991 | if [ ${RET} -gt 0 ] ; then |
---|
992 | echo "IGCM_sys_PutBuffer_Rest : error." |
---|
993 | cat out_rsync |
---|
994 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
995 | else |
---|
996 | \rm out_rsync |
---|
997 | fi |
---|
998 | else |
---|
999 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
1000 | fi |
---|
1001 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" |
---|
1002 | } |
---|
1003 | |
---|
1004 | #D-#================================================== |
---|
1005 | #D-function IGCM_sys_Put_Out |
---|
1006 | #D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly |
---|
1007 | #D-* Examples: |
---|
1008 | #D- |
---|
1009 | function IGCM_sys_Put_Out { |
---|
1010 | IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ |
---|
1011 | if ( $DEBUG_sys ) ; then |
---|
1012 | echo "IGCM_sys_Put_Out :" $@ |
---|
1013 | fi |
---|
1014 | if [ $DRYRUN = 0 ]; then |
---|
1015 | if [ -f ${1} ] ; then |
---|
1016 | if [ ! -d $( dirname $2 ) ] ; then |
---|
1017 | IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
1018 | fi |
---|
1019 | else |
---|
1020 | echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." |
---|
1021 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
1022 | return 1 |
---|
1023 | fi |
---|
1024 | |
---|
1025 | typeset RET |
---|
1026 | # |
---|
1027 | if [ X${JobType} = XRUN ] ; then |
---|
1028 | if [ X${3} = X ] ; then |
---|
1029 | IGCM_sys_Chmod 444 ${1} |
---|
1030 | fi |
---|
1031 | fi |
---|
1032 | # |
---|
1033 | |
---|
1034 | echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 |
---|
1035 | ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 |
---|
1036 | RET=$? |
---|
1037 | IGCM_sys_Rsync_out $RET |
---|
1038 | |
---|
1039 | ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
1040 | (( RET=RET+$? )) |
---|
1041 | |
---|
1042 | if [ ${RET} -gt 0 ] ; then |
---|
1043 | echo "IGCM_sys_Put_Out : error." |
---|
1044 | cat out_rsync |
---|
1045 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
1046 | else |
---|
1047 | \rm out_rsync |
---|
1048 | fi |
---|
1049 | else |
---|
1050 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
1051 | fi |
---|
1052 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
1053 | return 0 |
---|
1054 | } |
---|
1055 | |
---|
1056 | #D-#================================================== |
---|
1057 | #D-function IGCM_sys_PutBuffer_Out |
---|
1058 | #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly |
---|
1059 | #D-* Examples: |
---|
1060 | #D- |
---|
1061 | function IGCM_sys_PutBuffer_Out { |
---|
1062 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ |
---|
1063 | if ( $DEBUG_sys ) ; then |
---|
1064 | echo "IGCM_sys_PutBuffer_Out :" $@ |
---|
1065 | fi |
---|
1066 | if [ $DRYRUN = 0 ]; then |
---|
1067 | if [ ! -f ${1} ] ; then |
---|
1068 | echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." |
---|
1069 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
1070 | return 1 |
---|
1071 | fi |
---|
1072 | # |
---|
1073 | IGCM_sys_Mkdir $( dirname $2 ) |
---|
1074 | # |
---|
1075 | typeset RET |
---|
1076 | |
---|
1077 | if [ X${JobType} = XRUN ] ; then |
---|
1078 | if [ X${3} = X ] ; then |
---|
1079 | IGCM_sys_Chmod 444 ${1} |
---|
1080 | fi |
---|
1081 | fi |
---|
1082 | # |
---|
1083 | # USUAL WAY |
---|
1084 | \cp $1 $2 > out_rsync 2>&1 |
---|
1085 | RET=$? |
---|
1086 | |
---|
1087 | if [ ${RET} -gt 0 ] ; then |
---|
1088 | echo "IGCM_sys_PutBuffer_Out : error." |
---|
1089 | cat out_rsync |
---|
1090 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" |
---|
1091 | else |
---|
1092 | \rm out_rsync |
---|
1093 | fi |
---|
1094 | else |
---|
1095 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
1096 | fi |
---|
1097 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
1098 | return 0 |
---|
1099 | } |
---|
1100 | |
---|
1101 | #D-#================================================== |
---|
1102 | #D-function IGCM_sys_Get |
---|
1103 | #D-* Purpose: Get a file from ${ARCHIVE} |
---|
1104 | #D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX |
---|
1105 | #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ |
---|
1106 | function IGCM_sys_Get { |
---|
1107 | IGCM_debug_PushStack "IGCM_sys_Get" $@ |
---|
1108 | |
---|
1109 | typeset DEST RET dm_liste ifile target |
---|
1110 | |
---|
1111 | if ( $DEBUG_sys ) ; then |
---|
1112 | echo "IGCM_sys_Get :" $@ |
---|
1113 | fi |
---|
1114 | if [ $DRYRUN -le 2 ]; then |
---|
1115 | if [ X${1} = X'/l' ] ; then |
---|
1116 | # test if the first file is present in the old computation : |
---|
1117 | eval set +A dm_liste \${${2}} |
---|
1118 | else |
---|
1119 | dm_liste=${1} |
---|
1120 | fi |
---|
1121 | eval DEST=\${${#}} |
---|
1122 | |
---|
1123 | # test if the (first) file is present in the old computation : |
---|
1124 | IGCM_sys_TestFileArchive ${dm_liste[0]} |
---|
1125 | RET=$? |
---|
1126 | if [ ${RET} -gt 0 ] ; then |
---|
1127 | echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." |
---|
1128 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
1129 | #return |
---|
1130 | fi |
---|
1131 | |
---|
1132 | (( RET=0 )) |
---|
1133 | for target in ${dm_liste[*]} ; do |
---|
1134 | \cp ${target} ${DEST} >> out_rsync 2>&1 |
---|
1135 | (( RET=RET+$? )) |
---|
1136 | done |
---|
1137 | |
---|
1138 | # echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 |
---|
1139 | # ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 |
---|
1140 | # RET=$? |
---|
1141 | # IGCM_sys_Rsync_out $RET |
---|
1142 | |
---|
1143 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
1144 | # (( RET=RET+$? )) |
---|
1145 | |
---|
1146 | if [ ${RET} -gt 0 ] ; then |
---|
1147 | echo "IGCM_sys_Get : copy error." |
---|
1148 | cat out_rsync |
---|
1149 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
1150 | else |
---|
1151 | \rm out_rsync |
---|
1152 | fi |
---|
1153 | else |
---|
1154 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
1155 | fi |
---|
1156 | IGCM_debug_PopStack "IGCM_sys_Get" |
---|
1157 | } |
---|
1158 | |
---|
1159 | #D-#================================================== |
---|
1160 | #D-function IGCM_sys_GetBuffer |
---|
1161 | #D-* Purpose: Get a file from ${SCRATCHDIR} |
---|
1162 | #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX |
---|
1163 | #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ |
---|
1164 | function IGCM_sys_GetBuffer { |
---|
1165 | IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ |
---|
1166 | |
---|
1167 | typeset DEST RET buf_liste ifile target file_work |
---|
1168 | |
---|
1169 | if ( $DEBUG_sys ) ; then |
---|
1170 | echo "IGCM_sys_GetBuffer :" $@ |
---|
1171 | fi |
---|
1172 | if [ $DRYRUN -le 2 ]; then |
---|
1173 | if [ X${1} = X'/l' ] ; then |
---|
1174 | # test if the first file is present in the old computation : |
---|
1175 | eval set +A buf_liste \${${2}} |
---|
1176 | else |
---|
1177 | eval set +A buf_liste ${1} |
---|
1178 | fi |
---|
1179 | eval DEST=\${${#}} |
---|
1180 | |
---|
1181 | #USUAL WAY |
---|
1182 | if [ X${1} = X'/l' ] ; then |
---|
1183 | (( RET=0 )) |
---|
1184 | for target in ${buf_liste[*]} ; do |
---|
1185 | local_file=$( basename ${target} ) |
---|
1186 | \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 |
---|
1187 | (( RET = RET + $? )) |
---|
1188 | done |
---|
1189 | else |
---|
1190 | \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 |
---|
1191 | RET=$? |
---|
1192 | fi |
---|
1193 | |
---|
1194 | if [ ${RET} -gt 0 ] ; then |
---|
1195 | echo "IGCM_sys_GetBuffer : copy error." |
---|
1196 | cat out_rsync |
---|
1197 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
1198 | else |
---|
1199 | \rm out_rsync |
---|
1200 | fi |
---|
1201 | else |
---|
1202 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
1203 | fi |
---|
1204 | IGCM_debug_PopStack "IGCM_sys_GetBuffer" |
---|
1205 | } |
---|
1206 | |
---|
1207 | #D-#================================================== |
---|
1208 | #D-function IGCM_sys_GetDate_FichWork |
---|
1209 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK |
---|
1210 | #D-* Examples: |
---|
1211 | #D- |
---|
1212 | function IGCM_sys_GetDate_FichWork { |
---|
1213 | IGCM_debug_PushStack "IGCM_sys_FichWork" $@ |
---|
1214 | if ( $DEBUG_sys ) ; then |
---|
1215 | echo "IGCM_sys_GetDate_FichWork :" $@ |
---|
1216 | fi |
---|
1217 | typeset dateF |
---|
1218 | set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) |
---|
1219 | eval ${2}=${dateF[5]} |
---|
1220 | |
---|
1221 | # donne la date filesys d'un fichier sur la machine work |
---|
1222 | IGCM_debug_PopStack "IGCM_sys_FichWork" |
---|
1223 | } |
---|
1224 | |
---|
1225 | #D-#================================================== |
---|
1226 | #D-function IGCM_sys_GetDate_FichArchive |
---|
1227 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE |
---|
1228 | #D-* Examples: |
---|
1229 | #D- |
---|
1230 | function IGCM_sys_GetDate_FichArchive { |
---|
1231 | IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ |
---|
1232 | if ( $DEBUG_sys ) ; then |
---|
1233 | echo "IGCM_sys_GetDate_FichArchive :" $@ |
---|
1234 | fi |
---|
1235 | typeset dateF |
---|
1236 | set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) |
---|
1237 | eval ${2}=${dateF[5]} |
---|
1238 | |
---|
1239 | IGCM_debug_PopStack "IGCM_sys_FichArchive" |
---|
1240 | } |
---|
1241 | |
---|
1242 | #D-#================================================== |
---|
1243 | #D-function IGCM_sys_Dods_Rm |
---|
1244 | #D-* Purpose: Suppress files in /tmp/DODS for simulation of internet protocole. |
---|
1245 | #D-* Examples: |
---|
1246 | #D- |
---|
1247 | function IGCM_sys_Dods_Rm { |
---|
1248 | if ( $DEBUG_sys ) ; then |
---|
1249 | echo "IGCM_sys_Dods_Rm :" $@ |
---|
1250 | fi |
---|
1251 | return 0 |
---|
1252 | } |
---|
1253 | |
---|
1254 | |
---|
1255 | #D-#================================================== |
---|
1256 | #D-function IGCM_sys_Dods_Cp |
---|
1257 | #D-* Purpose: Copy from $(ARCHIVE) files to /tmp/DODS for simulation of internet protocole. |
---|
1258 | #D-* Examples: |
---|
1259 | #D- |
---|
1260 | function IGCM_sys_Dods_Cp { |
---|
1261 | if ( $DEBUG_sys ) ; then |
---|
1262 | echo "IGCM_sys_Dods_Cp :" $@ |
---|
1263 | fi |
---|
1264 | return 0 |
---|
1265 | } |
---|
1266 | |
---|
1267 | #D-#================================================== |
---|
1268 | #D-function IGCM_sys_Put_Dods |
---|
1269 | #D-* Purpose: Put $(ARCHIVE) files on /tmp/DODS for simulation of internet protocole. |
---|
1270 | #D-* Examples: |
---|
1271 | #D- |
---|
1272 | function IGCM_sys_Put_Dods { |
---|
1273 | IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ |
---|
1274 | if ( $DEBUG_sys ) ; then |
---|
1275 | echo "IGCM_sys_Put_Dods :" $@ |
---|
1276 | fi |
---|
1277 | if [ $DRYRUN = 0 ]; then |
---|
1278 | RET=0 |
---|
1279 | |
---|
1280 | if [ ${RET} -gt 0 ] ; then |
---|
1281 | echo "IGCM_sys_Put_Dods : error." |
---|
1282 | IGCM_debug_Exit "IGCM_sys_Put_Dods" |
---|
1283 | fi |
---|
1284 | else |
---|
1285 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
1286 | fi |
---|
1287 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
1288 | } |
---|
1289 | |
---|
1290 | ############################################################## |
---|
1291 | # REBUILD OPERATOR |
---|
1292 | |
---|
1293 | function IGCM_sys_rebuild { |
---|
1294 | IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ |
---|
1295 | if ( $DEBUG_sys ) ; then |
---|
1296 | echo "IGCM_sys_rebuild :" $@ |
---|
1297 | fi |
---|
1298 | rebuild -f -o $@ |
---|
1299 | if [ $? -gt 0 ] ; then |
---|
1300 | echo "IGCM_sys_rebuild : erreur ${@}." |
---|
1301 | IGCM_debug_Exit "rebuild" |
---|
1302 | fi |
---|
1303 | |
---|
1304 | IGCM_debug_PopStack "IGCM_sys_rebuild" |
---|
1305 | } |
---|
1306 | |
---|
1307 | function IGCM_sys_rebuild_station { |
---|
1308 | IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ |
---|
1309 | typeset i list_opt file_in file_out prefix_invert list_invert |
---|
1310 | if ( $DEBUG_sys ) ; then |
---|
1311 | echo "IGCM_sys_rebuild_station :" $@ |
---|
1312 | fi |
---|
1313 | list_opt=$@ |
---|
1314 | |
---|
1315 | # Invert Axis : t,x -> x,t |
---|
1316 | # t,pres,x -> x,t,pres |
---|
1317 | # So that we can concatenate along x |
---|
1318 | i=0 |
---|
1319 | for file_in in ${list_opt} ; do |
---|
1320 | (( i = i + 1)) |
---|
1321 | [ ${i} = 1 ] && file_out=${file_in} && continue |
---|
1322 | prefix_invert=$( basename ${file_in} .nc ) |
---|
1323 | IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc |
---|
1324 | list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc |
---|
1325 | done |
---|
1326 | |
---|
1327 | # Concatenate |
---|
1328 | IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc |
---|
1329 | |
---|
1330 | # Re-ivert file |
---|
1331 | IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} |
---|
1332 | |
---|
1333 | # Station re-ordering is too expansive to be run within libICGM |
---|
1334 | # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. |
---|
1335 | # This re-ordering must be done "in memory" by the cmorization process |
---|
1336 | # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) |
---|
1337 | # BEGIN reordering |
---|
1338 | |
---|
1339 | # Only LMDZ text output contains the exact ordering of the station. |
---|
1340 | # We isolate this in the code below: |
---|
1341 | # 0 38 -157.5000000000000 70.98591549295774 |
---|
1342 | # 0 54 27.49999999999999 67.18309859154928 |
---|
1343 | # 0 56 -62.50000000000001 82.39436619718309 |
---|
1344 | # 0 79 12.49999999999999 78.59154929577466 |
---|
1345 | # 0 116 -165.0000000000000 76.05633802816901 |
---|
1346 | # 0 117 130.0000000000000 70.98591549295774 |
---|
1347 | # 0 118 110.0000000000000 87.46478873239437 |
---|
1348 | # 1 40 4.999999999999995 51.97183098591550 |
---|
1349 | # typeset iStation iProc list_opt file_in file_out prefix_invert |
---|
1350 | # typeset -Z4 j4 |
---|
1351 | # typeset -Z3 j3 |
---|
1352 | |
---|
1353 | # unset list_opt |
---|
1354 | # set +A list_opt $@ |
---|
1355 | |
---|
1356 | # Filename after rebuild |
---|
1357 | # file_out=${list_opt[0]} |
---|
1358 | # Prefix of output files |
---|
1359 | # prefix_invert=$( basename ${file_out} .nc ) |
---|
1360 | # Number of procs |
---|
1361 | # num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) |
---|
1362 | |
---|
1363 | # iProc=0 |
---|
1364 | # while [ ${iProc} -lt ${num_proc} ] ; do |
---|
1365 | # Array containing Station as a number |
---|
1366 | # unset proc_stn |
---|
1367 | # set +A proc_stn $( grep "iophy_mpi rank ip lon lat $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | awk ' {print $2}' ) |
---|
1368 | # Number of stations produced by processor proc |
---|
1369 | # stationLast=${#proc_stn[*]} |
---|
1370 | # Proc number on 4 digits |
---|
1371 | # j4=${iProc} |
---|
1372 | # Init |
---|
1373 | # iStation=0 |
---|
1374 | # while [ ${iStation} -lt ${stationLast} ] ; do |
---|
1375 | # Station number on 3 digits |
---|
1376 | # j3=${proc_stn[${iStation}]} |
---|
1377 | # Extract station |
---|
1378 | # Invert Axis : t,x -> x,t |
---|
1379 | # t,pres,x -> x,t,pres |
---|
1380 | # So that we can concatenate along x |
---|
1381 | # IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc |
---|
1382 | # (( iStation = iStation + 1 )) |
---|
1383 | # done |
---|
1384 | # (( iProc = iProc + 1 )) |
---|
1385 | # done |
---|
1386 | |
---|
1387 | # Concatenate all station along x |
---|
1388 | # IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc |
---|
1389 | |
---|
1390 | # Re-invert file |
---|
1391 | # IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} |
---|
1392 | |
---|
1393 | # END reordering |
---|
1394 | |
---|
1395 | IGCM_debug_PopStack "IGCM_sys_rebuild_station" |
---|
1396 | } |
---|
1397 | |
---|
1398 | ############################################################ |
---|
1399 | # Activate Running Environnment Variables |
---|
1400 | |
---|
1401 | function IGCM_sys_activ_variables { |
---|
1402 | IGCM_debug_PushStack "IGCM_sys_activ_variables" |
---|
1403 | if ( $DEBUG_sys ) ; then |
---|
1404 | echo "IGCM_sys_activ_variables" |
---|
1405 | fi |
---|
1406 | IGCM_debug_PopStack "IGCM_sys_activ_variables" |
---|
1407 | } |
---|
1408 | |
---|
1409 | ############################################################ |
---|
1410 | # Desactivate Running Environnment Variables |
---|
1411 | |
---|
1412 | function IGCM_sys_desactiv_variables { |
---|
1413 | IGCM_debug_PushStack "IGCM_sys_desactiv_variables" |
---|
1414 | if ( $DEBUG_sys ) ; then |
---|
1415 | echo "IGCM_sys_desactiv_variables" |
---|
1416 | fi |
---|
1417 | IGCM_debug_PopStack "IGCM_sys_desactiv_variables" |
---|
1418 | } |
---|
1419 | |
---|
1420 | ############################################################ |
---|
1421 | # Build run file |
---|
1422 | |
---|
1423 | function IGCM_sys_build_run_file { |
---|
1424 | |
---|
1425 | IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " |
---|
1426 | |
---|
1427 | } |
---|
1428 | |
---|
1429 | ############################################################ |
---|
1430 | # Build MPI/OMP scripts |
---|
1431 | function IGCM_sys_build_execution_scripts |
---|
1432 | { |
---|
1433 | IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ |
---|
1434 | if ( $DEBUG_sys ) ; then |
---|
1435 | echo "IGCM_sys_build_execution_scripts " $@ |
---|
1436 | fi |
---|
1437 | typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut |
---|
1438 | typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc |
---|
1439 | typeset num_corempi nombre_restant_node nombre_restant_comp |
---|
1440 | |
---|
1441 | if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then |
---|
1442 | IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} " |
---|
1443 | fi |
---|
1444 | |
---|
1445 | if ( ${OK_PARA_MPMD} ) ; then |
---|
1446 | |
---|
1447 | if [ -f run_file ] ; then |
---|
1448 | IGCM_sys_Rm -f run_file |
---|
1449 | fi |
---|
1450 | touch run_file |
---|
1451 | |
---|
1452 | if ( ${OK_PARA_OMP} ) ; then |
---|
1453 | |
---|
1454 | # Hosts treatment |
---|
1455 | |
---|
1456 | ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp |
---|
1457 | |
---|
1458 | i=0 |
---|
1459 | rm -f hosts |
---|
1460 | IGCM_debug_Print 1 "sys $( hostname ), Hosts avaible :" |
---|
1461 | for nodes in `cat hosts.tmp` ; do |
---|
1462 | host[$i]=$nodes |
---|
1463 | echo "${host[$i]} slots=1 max_slots=1" >> hosts |
---|
1464 | IGCM_debug_Print 1 ${host[$i]} |
---|
1465 | i=$((i+1)) |
---|
1466 | done |
---|
1467 | rm -f hosts.tmp |
---|
1468 | |
---|
1469 | listnodes=${host[*]} |
---|
1470 | |
---|
1471 | EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" |
---|
1472 | |
---|
1473 | # Initialisation |
---|
1474 | |
---|
1475 | init_node=y |
---|
1476 | node_num_current=0 |
---|
1477 | start_num=0 |
---|
1478 | init_exec=n |
---|
1479 | |
---|
1480 | # Test : if oasis is there, we put it at the first position |
---|
1481 | |
---|
1482 | for comp in ${config_ListOfComponents[*]} ; do |
---|
1483 | |
---|
1484 | if [ "X${comp}" = "XCPL" ] ; then |
---|
1485 | |
---|
1486 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
1487 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
1488 | |
---|
1489 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
1490 | echo "" >> script_${ExeNameOut}.ksh |
---|
1491 | #echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh |
---|
1492 | #echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh |
---|
1493 | #echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh |
---|
1494 | echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh |
---|
1495 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
1496 | |
---|
1497 | init_node=n |
---|
1498 | |
---|
1499 | (( nombre_restant_node = NUM_COREPERNODE - 1 )) |
---|
1500 | node_num_current=0 |
---|
1501 | node_current=${host[${node_num_current}]} |
---|
1502 | |
---|
1503 | EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" |
---|
1504 | |
---|
1505 | init_exec=y |
---|
1506 | start_num=1 |
---|
1507 | |
---|
1508 | fi |
---|
1509 | |
---|
1510 | done |
---|
1511 | |
---|
1512 | # Then loop on the components (except for oasis) |
---|
1513 | |
---|
1514 | for comp in ${config_ListOfComponents[*]} ; do |
---|
1515 | |
---|
1516 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
1517 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
1518 | |
---|
1519 | # Only if we really have an executable for the component : |
---|
1520 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then |
---|
1521 | |
---|
1522 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
1523 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
1524 | |
---|
1525 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
1526 | # echo "set -vx" >> script_${ExeNameOut}.ksh |
---|
1527 | echo "" >> script_${ExeNameOut}.ksh |
---|
1528 | #echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh |
---|
1529 | #echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh |
---|
1530 | #echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh |
---|
1531 | echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh |
---|
1532 | echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >> script_${ExeNameOut}.ksh |
---|
1533 | echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh |
---|
1534 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
1535 | |
---|
1536 | node_num=0 |
---|
1537 | |
---|
1538 | # We define the number of MPI process to be assigned for the component |
---|
1539 | |
---|
1540 | nombre_restant_comp=${comp_proc_mpi_loc} |
---|
1541 | |
---|
1542 | # Loop on the allocated nodes |
---|
1543 | |
---|
1544 | for node in ${listnodes} ; do |
---|
1545 | |
---|
1546 | # We go to the current node |
---|
1547 | if [ ${node_num} = ${node_num_current} ] ; then |
---|
1548 | |
---|
1549 | node_current=${host[${node_num_current}]} |
---|
1550 | |
---|
1551 | # If first time on the node : initialisation |
---|
1552 | |
---|
1553 | if [ ${init_node} = y ] ; then |
---|
1554 | nombre_restant_node=${NUM_COREPERNODE} |
---|
1555 | fi |
---|
1556 | |
---|
1557 | # Test on the number of OMP threads |
---|
1558 | |
---|
1559 | if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then |
---|
1560 | (( node_num = node_num + 1 )) |
---|
1561 | node_num_current=${node_num} |
---|
1562 | init_node=y |
---|
1563 | continue |
---|
1564 | fi |
---|
1565 | |
---|
1566 | # Number of MPI process to assign |
---|
1567 | |
---|
1568 | (( num_corempi = nombre_restant_node / comp_proc_omp_loc )) |
---|
1569 | |
---|
1570 | if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then |
---|
1571 | num_corempi=${nombre_restant_comp} |
---|
1572 | fi |
---|
1573 | |
---|
1574 | (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc )) |
---|
1575 | (( nombre_restant_comp = nombre_restant_comp - num_corempi )) |
---|
1576 | |
---|
1577 | if [ ${init_exec} = y ] ; then |
---|
1578 | EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" |
---|
1579 | else |
---|
1580 | EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" |
---|
1581 | init_exec=y |
---|
1582 | fi |
---|
1583 | |
---|
1584 | (( start_num = num_corempi + start_num )) |
---|
1585 | |
---|
1586 | else |
---|
1587 | |
---|
1588 | (( node_num = node_num + 1 )) |
---|
1589 | continue |
---|
1590 | fi |
---|
1591 | |
---|
1592 | # Test on the number of core/process remaining on the node/component |
---|
1593 | |
---|
1594 | if [ ${nombre_restant_node} = 0 ] ; then |
---|
1595 | (( node_num = node_num + 1 )) |
---|
1596 | node_num_current=${node_num} |
---|
1597 | init_node=y |
---|
1598 | |
---|
1599 | if [ ${nombre_restant_comp} = 0 ] ; then |
---|
1600 | break 1 |
---|
1601 | fi |
---|
1602 | else |
---|
1603 | |
---|
1604 | node_num_current=${node_num} |
---|
1605 | init_node=n |
---|
1606 | |
---|
1607 | if [ ${nombre_restant_comp} = 0 ] ; then |
---|
1608 | break 1 |
---|
1609 | fi |
---|
1610 | fi |
---|
1611 | done |
---|
1612 | fi |
---|
1613 | done |
---|
1614 | |
---|
1615 | else |
---|
1616 | |
---|
1617 | # Then first loop on the components for the coupler ie oasis |
---|
1618 | |
---|
1619 | ## the coupler ie oasis must be the first one |
---|
1620 | for comp in ${config_ListOfComponents[*]} ; do |
---|
1621 | |
---|
1622 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
1623 | |
---|
1624 | # for CPL component only |
---|
1625 | if [ "X${comp}" = "XCPL" ] ; then |
---|
1626 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
1627 | echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file |
---|
1628 | fi |
---|
1629 | done |
---|
1630 | |
---|
1631 | # Then second loop on the components |
---|
1632 | |
---|
1633 | for comp in ${config_ListOfComponents[*]} ; do |
---|
1634 | |
---|
1635 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
1636 | |
---|
1637 | # Only if we really have an executable for the component and not the coupler ie oasis: |
---|
1638 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then |
---|
1639 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
1640 | echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file |
---|
1641 | fi |
---|
1642 | done |
---|
1643 | IGCM_sys_Chmod u+x run_file |
---|
1644 | |
---|
1645 | EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file" |
---|
1646 | |
---|
1647 | fi |
---|
1648 | |
---|
1649 | else # Only one executable. launch it. |
---|
1650 | |
---|
1651 | for comp in ${config_ListOfComponents[*]} ; do |
---|
1652 | |
---|
1653 | # Only if we really have an executable for the component : |
---|
1654 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
1655 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then |
---|
1656 | |
---|
1657 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
1658 | echo "" >> script_${ExeNameOut}.ksh |
---|
1659 | if ( ${OK_PARA_OMP} ) ; then |
---|
1660 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
1661 | echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh |
---|
1662 | fi |
---|
1663 | if ( ${OK_PARA_MPI} ) ; then |
---|
1664 | # Default : mpirun used if nb_proc gt 1 |
---|
1665 | # pour sortie out/err par process |
---|
1666 | # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}" >> script_${ExeNameOut}.ksh |
---|
1667 | echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
1668 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
1669 | EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh" |
---|
1670 | else |
---|
1671 | # Default : mpirun is NOT used if nb_proc eq 1 |
---|
1672 | # pour sortie out/err par process |
---|
1673 | # echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh |
---|
1674 | echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
1675 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
1676 | EXECUTION="time ./script_${ExeNameOut}.ksh" |
---|
1677 | fi |
---|
1678 | fi |
---|
1679 | done |
---|
1680 | |
---|
1681 | fi |
---|
1682 | |
---|
1683 | IGCM_debug_Print 1 "sys $( hostname ) : La commande d execution est " |
---|
1684 | IGCM_debug_Print 1 $EXECUTION |
---|
1685 | |
---|
1686 | IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" |
---|
1687 | } |
---|
1688 | |
---|
1689 | ############################################################ |
---|
1690 | # Check of space available on temporary filesytems |
---|
1691 | function IGCM_sys_check_quota { |
---|
1692 | IGCM_debug_PushStack "IGCM_sys_check_quota" |
---|
1693 | if ( $DEBUG_sys ) ; then |
---|
1694 | echo "IGCM_sys_check_quota" |
---|
1695 | fi |
---|
1696 | IGCM_debug_PopStack "IGCM_sys_check_quota" |
---|
1697 | } |
---|
1698 | |
---|
1699 | ############################################################## |
---|
1700 | # NCO OPERATOR |
---|
1701 | |
---|
1702 | function IGCM_sys_ncap2 { |
---|
1703 | IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ |
---|
1704 | if ( $DEBUG_sys ) ; then |
---|
1705 | echo "IGCM_sys_ncap2 :" $@ |
---|
1706 | fi |
---|
1707 | /usr/local/bin/ncap2 "$@" |
---|
1708 | if [ $? -gt 0 ] ; then |
---|
1709 | echo "IGCM_sys_ncap2 : erreur ${@}." |
---|
1710 | IGCM_debug_Exit "ncap2" |
---|
1711 | fi |
---|
1712 | |
---|
1713 | IGCM_debug_PopStack "IGCM_sys_ncap2" |
---|
1714 | } |
---|
1715 | |
---|
1716 | function IGCM_sys_ncatted { |
---|
1717 | IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ |
---|
1718 | if ( $DEBUG_sys ) ; then |
---|
1719 | echo "IGCM_sys_ncatted :" $@ |
---|
1720 | fi |
---|
1721 | /usr/local/bin/ncatted "$@" |
---|
1722 | if [ $? -gt 0 ] ; then |
---|
1723 | echo "IGCM_sys_ncatted : erreur ${@}." |
---|
1724 | IGCM_debug_Exit "ncatted" |
---|
1725 | fi |
---|
1726 | |
---|
1727 | IGCM_debug_PopStack "IGCM_sys_ncatted" |
---|
1728 | } |
---|
1729 | |
---|
1730 | function IGCM_sys_ncbo { |
---|
1731 | IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ |
---|
1732 | if ( $DEBUG_sys ) ; then |
---|
1733 | echo "IGCM_sys_ncbo :" $@ |
---|
1734 | fi |
---|
1735 | /usr/local/bin/ncbo $@ |
---|
1736 | if [ $? -gt 0 ] ; then |
---|
1737 | echo "IGCM_sys_ncbo : erreur ${@}." |
---|
1738 | IGCM_debug_Exit "ncbo" |
---|
1739 | fi |
---|
1740 | |
---|
1741 | IGCM_debug_PopStack "IGCM_sys_ncbo" |
---|
1742 | } |
---|
1743 | |
---|
1744 | function IGCM_sys_ncdiff { |
---|
1745 | IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ |
---|
1746 | if ( $DEBUG_sys ) ; then |
---|
1747 | echo "IGCM_sys_ncdiff :" $@ |
---|
1748 | fi |
---|
1749 | /usr/local/bin/ncdiff $@ |
---|
1750 | if [ $? -gt 0 ] ; then |
---|
1751 | echo "IGCM_sys_ncdiff : erreur ${@}." |
---|
1752 | IGCM_debug_Exit "ncdiff" |
---|
1753 | fi |
---|
1754 | |
---|
1755 | IGCM_debug_PopStack "IGCM_sys_ncdiff" |
---|
1756 | } |
---|
1757 | |
---|
1758 | function IGCM_sys_ncea { |
---|
1759 | IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ |
---|
1760 | if ( $DEBUG_sys ) ; then |
---|
1761 | echo "IGCM_sys_ncea :" $@ |
---|
1762 | fi |
---|
1763 | /usr/local/bin/ncea $@ |
---|
1764 | if [ $? -gt 0 ] ; then |
---|
1765 | echo "IGCM_sys_ncea : erreur ${@}." |
---|
1766 | IGCM_debug_Exit "ncea" |
---|
1767 | fi |
---|
1768 | |
---|
1769 | IGCM_debug_PopStack "IGCM_sys_ncea" |
---|
1770 | } |
---|
1771 | |
---|
1772 | function IGCM_sys_ncecat { |
---|
1773 | IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ |
---|
1774 | if ( $DEBUG_sys ) ; then |
---|
1775 | echo "IGCM_sys_ncecat :" $@ |
---|
1776 | fi |
---|
1777 | /usr/local/bin/ncecat $@ |
---|
1778 | if [ $? -gt 0 ] ; then |
---|
1779 | echo "IGCM_sys_ncecat : erreur ${@}." |
---|
1780 | IGCM_debug_Exit "ncecat" |
---|
1781 | fi |
---|
1782 | |
---|
1783 | IGCM_debug_PopStack "IGCM_sys_ncecat" |
---|
1784 | } |
---|
1785 | |
---|
1786 | function IGCM_sys_ncflint { |
---|
1787 | IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ |
---|
1788 | if ( $DEBUG_sys ) ; then |
---|
1789 | echo "IGCM_sys_ncflint :" $@ |
---|
1790 | fi |
---|
1791 | /usr/local/bin/ncflint $@ |
---|
1792 | if [ $? -gt 0 ] ; then |
---|
1793 | echo "IGCM_sys_ncflint : erreur ${@}." |
---|
1794 | IGCM_debug_Exit "ncflint" |
---|
1795 | fi |
---|
1796 | |
---|
1797 | IGCM_debug_PopStack "IGCM_sys_ncflint" |
---|
1798 | } |
---|
1799 | |
---|
1800 | function IGCM_sys_ncks { |
---|
1801 | IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ |
---|
1802 | if ( $DEBUG_sys ) ; then |
---|
1803 | echo "IGCM_sys_ncks :" $@ |
---|
1804 | fi |
---|
1805 | /usr/local/bin/ncks $@ |
---|
1806 | if [ $? -gt 0 ] ; then |
---|
1807 | echo "IGCM_sys_ncks : erreur ${@}." |
---|
1808 | IGCM_debug_Exit "ncks" |
---|
1809 | fi |
---|
1810 | |
---|
1811 | IGCM_debug_PopStack "IGCM_sys_ncks" |
---|
1812 | } |
---|
1813 | |
---|
1814 | function IGCM_sys_ncpdq { |
---|
1815 | IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ |
---|
1816 | if ( $DEBUG_sys ) ; then |
---|
1817 | echo "IGCM_sys_ncpdq :" $@ |
---|
1818 | fi |
---|
1819 | /usr/local/bin/ncpdq $@ |
---|
1820 | if [ $? -gt 0 ] ; then |
---|
1821 | echo "IGCM_sys_ncpdq : erreur ${@}." |
---|
1822 | IGCM_debug_Exit "ncpdq" |
---|
1823 | fi |
---|
1824 | |
---|
1825 | IGCM_debug_PopStack "IGCM_sys_ncpdq" |
---|
1826 | } |
---|
1827 | |
---|
1828 | function IGCM_sys_ncra { |
---|
1829 | IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ |
---|
1830 | if ( $DEBUG_sys ) ; then |
---|
1831 | echo "IGCM_sys_ncra :" $@ |
---|
1832 | fi |
---|
1833 | /usr/local/bin/ncra $@ |
---|
1834 | if [ $? -gt 0 ] ; then |
---|
1835 | echo "IGCM_sys_ncra : erreur ${@}." |
---|
1836 | IGCM_debug_Exit "ncra" |
---|
1837 | fi |
---|
1838 | |
---|
1839 | IGCM_debug_PopStack "IGCM_sys_ncra" |
---|
1840 | } |
---|
1841 | |
---|
1842 | function IGCM_sys_ncrcat { |
---|
1843 | IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ |
---|
1844 | if ( $DEBUG_sys ) ; then |
---|
1845 | echo "IGCM_sys_ncrcat :" $@ |
---|
1846 | fi |
---|
1847 | /usr/local/bin/ncrcat $@ |
---|
1848 | if [ $? -gt 0 ] ; then |
---|
1849 | echo "IGCM_sys_ncrcat : erreur ${@}." |
---|
1850 | # IGCM_debug_Exit "ncrcat" |
---|
1851 | fi |
---|
1852 | |
---|
1853 | IGCM_debug_PopStack "IGCM_sys_ncrcat" |
---|
1854 | } |
---|
1855 | |
---|
1856 | function IGCM_sys_ncrename { |
---|
1857 | IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ |
---|
1858 | if ( $DEBUG_sys ) ; then |
---|
1859 | echo "IGCM_sys_ncrename :" $@ |
---|
1860 | fi |
---|
1861 | /usr/local/bin/ncrename $@ |
---|
1862 | if [ $? -gt 0 ] ; then |
---|
1863 | echo "IGCM_sys_ncrename : erreur ${@}." |
---|
1864 | IGCM_debug_Exit "ncrename" |
---|
1865 | fi |
---|
1866 | |
---|
1867 | IGCM_debug_PopStack "IGCM_sys_ncrename" |
---|
1868 | } |
---|
1869 | |
---|
1870 | function IGCM_sys_ncwa { |
---|
1871 | IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ |
---|
1872 | if ( $DEBUG_sys ) ; then |
---|
1873 | echo "IGCM_sys_ncwa :" $@ |
---|
1874 | fi |
---|
1875 | /usr/local/bin/ncwa $@ |
---|
1876 | if [ $? -gt 0 ] ; then |
---|
1877 | echo "IGCM_sys_ncwa : erreur ${@}." |
---|
1878 | IGCM_debug_Exit "ncwa" |
---|
1879 | fi |
---|
1880 | |
---|
1881 | IGCM_debug_PopStack "IGCM_sys_ncwa" |
---|
1882 | } |
---|
1883 | |
---|
1884 | ############################################################## |
---|
1885 | # CDO OPERATOR |
---|
1886 | |
---|
1887 | function IGCM_sys_cdo { |
---|
1888 | IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ |
---|
1889 | |
---|
1890 | \cdo $@ |
---|
1891 | if [ $? -gt 0 ] ; then |
---|
1892 | echo "IGCM_sys_cdo : erreur ${@}." |
---|
1893 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
1894 | return 1 |
---|
1895 | else |
---|
1896 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
1897 | return 0 |
---|
1898 | fi |
---|
1899 | |
---|
1900 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
1901 | } |
---|