source: tags/libIGCM_v2.0_beta2/libIGCM_sys/libIGCM_sys_curie.ksh @ 1456

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