source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh @ 853

Last change on this file since 853 was 853, checked in by sdipsl, 11 years ago
  • Clean up job submission
  • Property svn:keywords set to Revision Author Date
File size: 69.8 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil, Martial Mancip, Christian Laguerre
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 for obelix
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 |            |         |                           |
46# |          |  Chmod 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=${MASTER:=$( hostname )}
71
72#D-
73#D-#==================================================
74#D-Program used in libIGCM
75#D-#==================================================
76
77# Submit command
78typeset SUBMIT=${SUBMIT:=qsub}
79# rsync with path
80typeset -r RSYNC=/usr/bin/rsync
81# RSYNC_opt args to rsync
82typeset -r RSYNC_opt="-va"
83# ie storage filesystem
84typeset -r STOREHOST=${MASTER}
85
86#====================================================
87# Set environment tools (ferret, nco, cdo)
88#====================================================
89. /home/users/brock/.atlas_env_asterix_ksh
90
91#====================================================
92# Set lf95 environment
93#====================================================
94. /usr/local/install/lf6481/bash_laheyfort_setup
95
96#====================================================
97# Host specific DIRECTORIES
98#====================================================
99
100#====================================================
101#- MirrorlibIGCM for frontend
102typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
103
104#====================================================
105#- libIGCM_POST for frontend
106typeset -r libIGCM_POST=${libIGCM}
107
108#====================================================
109#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
110typeset -r R_EXE="${MODIPSL}/bin"
111
112#====================================================
113#- SUBMIT_DIR : submission dir
114if [ X${PBS_O_WORKDIR} != X ] ; then
115  typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
116else
117  typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
118fi
119
120#====================================================
121#- IN
122typeset -r R_IN=${R_IN:=/home/orchidee01/mmancip/IGCM}
123
124#====================================================
125#- ARCHIVE
126typeset ARCHIVE=${ARCHIVE:=/home/scratch01/${LOGIN}}
127
128#====================================================
129#- STORAGE (dedicated to small/medium files)
130typeset STORAGE=${ARCHIVE}
131
132#====================================================
133#- R_OUT
134typeset R_OUT=${ARCHIVE}/IGCM_OUT
135
136#====================================================
137#- R_FIG (hosting figures : monitoring and atlas, and/or small files)
138typeset R_FIG=${STORAGE}/IGCM_OUT
139
140#====================================================
141#- R_BUF (ONLY FOR double copy an scratch)
142typeset -r R_BUF=${STORAGE}/IGCM_OUT
143
144#====================================================
145#- RUN_DIR_PATH : Temporary working directory (=> TMP)
146if [ X${PBS_JOBID} != X ] ; then
147  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/scratch/$PBS_O_LOGNAME.$PBS_JOBID}
148else
149  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/tmp/tmp$$}
150fi
151
152#====================================================
153#- HOST_MPIRUN_COMMAND
154typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"}
155
156#====================================================
157#- Max number of arguments passed to nco operator or demigration command
158UNIX_MAX_LIMIT=360
159
160#====================================================
161#- Number of core per node (max number of OpenMP task)
162NUM_COREPERNODE=1
163
164#====================================================
165#- Default number of MPI task for IPSL coupled model
166#- required for backward compatibility
167#-
168DEFAULT_NUM_PROC_OCE=1
169DEFAULT_NUM_PROC_CPL=1
170(( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL ))
171DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT}
172
173#D-#==================================================
174#D-function IGCM_sys_ChangeArchive
175#D-* Purpose: Just a dummy call on this machine
176#D-* Examples:
177#D-
178function IGCM_sys_ChangeArchive {
179  IGCM_debug_Print 1 " dummy function : IGCM_sys_ChangeArchive "
180}
181
182#D-#==================================================
183#D-function IGCM_sys_RshMaster
184#D-* Purpose: Connection to frontend machine.
185#D-* Examples:
186#D-
187function IGCM_sys_RshMaster {
188  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
189  ssh obelix3 /bin/ksh  <<-EOF
190    export libIGCM=${libIGCM}
191    export DEBUG_debug=${DEBUG_debug}
192    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
193    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
194    ${@}
195EOF
196  if [ $? -gt 0 ] ; then
197    echo "IGCM_sys_RshMaster : erreur."
198    IGCM_debug_Exit "IGCM_sys_RshMaster"
199  fi
200  IGCM_debug_PopStack "IGCM_sys_RshMaster"
201}
202
203#D-#==================================================
204#D-function IGCM_sys_RshArchive
205#D-* Purpose: Archive rsh command
206#D-* Examples:
207#D-
208function IGCM_sys_RshArchive {
209  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
210  /bin/ksh <<-EOF
211    ${@}
212EOF
213  status=$?
214  if [ ${status} -gt 0 ] ; then
215    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}"
216    IGCM_debug_Exit "IGCM_sys_RshArchive"
217  fi
218  IGCM_debug_PopStack "IGCM_sys_RshArchive"
219}
220
221#D-#==================================================
222#D-function IGCM_sys_RshPost
223#D-* Purpose: Post-process rsh command
224#D-* Examples:
225#D-
226function IGCM_sys_RshPost {
227  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
228  if ( $DEBUG_sys ) ; then
229    echo "IGCM_sys_RshPost :" $@
230  fi
231
232  # keep standard input (stdin) for the loop onto temporary file
233  cat >tmp_IGCM_sys_RshPost_$$
234
235# ============ FRONTEND START ============ #
236
237  ssh obelix3 exec /bin/ksh <tmp_IGCM_sys_RshPost_$$
238  if [ $? -gt 0 ] ; then
239    echo "IGCM_sys_RshPost : erreur."
240    IGCM_debug_Exit "IGCM_sys_RshPost"
241  fi
242  # delete temporary file
243  \rm tmp_IGCM_sys_RshPost_$$
244  IGCM_debug_PopStack "IGCM_sys_RshPost"
245}
246
247#D-#==================================================
248#D-function IGCM_sys_SendMail
249#D-* Purpose: Send mail when simulation is over
250#D-* Examples:
251#D-
252function IGCM_sys_SendMail {
253  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
254  if ( $DEBUG_sys ) ; then
255    echo "IGCM_sys_SendMail :" $@
256  fi
257
258  if ( ${ExitFlag} ) ; then
259    status=failed
260  else
261    status=completed
262  fi
263
264  cat  << END_MAIL > job_end.mail
265Dear ${LOGIN},
266
267  Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`.
268  Job started : ${DateBegin}
269  Job ended   : ${DateEnd}
270  Output files are available in ${R_SAVE}
271  Files to be rebuild are temporarily available in ${REBUILD_DIR}
272  Pre-packed files are temporarily available in ${R_BUFR}
273  Script files, Script Outputs and Debug files (if necessary) are available in ${SUBMIT_DIR}
274END_MAIL
275
276  if [ ! -z ${config_UserChoices_MailName} ] ; then
277    mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
278  elif [ -f ~/.forward ] ; then
279    mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
280  fi
281
282  sleep 10
283  rm -f job_end.mail
284
285  if [ $? -gt 0 ] ; then
286    echo "IGCM_sys_SendMail : erreur."
287    IGCM_debug_Exit "IGCM_sys_SendMail"
288  fi
289  IGCM_debug_PopStack "IGCM_sys_SendMail"
290}
291
292#D-#==================================================
293#D-function IGCM_sys_Mkdir
294#D-* Purpose: Master locale mkdir command
295#D-* Examples:
296#D-
297function IGCM_sys_Mkdir {
298  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
299  if ( $DEBUG_sys ) ; then
300    echo "IGCM_sys_Mkdir :" $@
301  fi
302  if [ ! -d ${1} ]; then
303    \mkdir -p $1
304    if [ $? -gt 0 ] ; then
305      echo "IGCM_sys_Mkdir : erreur."
306      IGCM_debug_Exit "IGCM_sys_Mkdir"
307    fi
308  fi
309  # vérification :
310  if [ ! -d ${1} ] ; then
311    echo "IGCM_sys_Mkdir : erreur."
312    IGCM_debug_Exit "IGCM_sys_Mkdir"
313  fi
314  IGCM_debug_PopStack "IGCM_sys_Mkdir"
315}
316
317#D-#==================================================
318#D-function IGCM_sys_MkdirArchive
319#D-* Purpose: Mkdir on Archive
320#D-* Examples:
321#D-
322function IGCM_sys_MkdirArchive {
323  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
324  if ( $DEBUG_sys ) ; then
325    echo "IGCM_sys_MkdirArchive :" $@
326  fi
327  #- creation de repertoire sur le serveur fichier
328  if [ ! -d ${1} ]; then
329    mkdir -p $1
330    status=$?
331
332    if [ ${status} -gt 0 ] ; then
333      IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}"
334      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
335    fi
336  fi
337  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
338}
339
340#D-#==================================================
341#D-function IGCM_sys_MkdirWork
342#D-* Purpose: Mkdir on Work
343#D-* Examples:
344#D-
345function IGCM_sys_MkdirWork {
346  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
347  if ( $DEBUG_sys ) ; then
348    echo "IGCM_sys_MkdirWork :" $@
349  fi
350  #- creation de repertoire sur le serveur fichier
351  if [ ! -d ${1} ]; then
352    \mkdir -p $1
353    if [ $? -gt 0 ] ; then
354      echo "IGCM_sys_MkdirWork : erreur."
355      IGCM_debug_Exit "IGCM_sys_MkdirWork"
356    fi
357  fi
358  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
359}
360
361#D-#==================================================
362#D-function IGCM_sys_Cd
363#D-* Purpose: master cd command
364#D-* Examples:
365#D-
366function IGCM_sys_Cd {
367  IGCM_debug_PushStack "IGCM_sys_Cd" $@
368  if ( $DEBUG_sys ) ; then
369    echo "IGCM_sys_Cd :" $@
370  fi
371  \cd $1
372  if [ $? -gt 0 ] ; then
373    echo "IGCM_sys_Cd : erreur."
374    IGCM_debug_Exit "IGCM_sys_Cd"
375  fi
376  IGCM_debug_PopStack "IGCM_sys_Cd"
377}
378
379#D-#==================================================
380#D-function IGCM_sys_Chmod
381#D-* Purpose: Chmod
382#D-* Examples:
383#D-
384function IGCM_sys_Chmod {
385  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
386  if ( $DEBUG_sys ) ; then
387    echo "IGCM_sys_Chmod :" $@
388  fi
389  \chmod $@
390  if [ $? -gt 0 ] ; then
391    echo "IGCM_sys_Chmod : erreur."
392    IGCM_debug_Exit "IGCM_sys_Chmod"
393  fi
394  IGCM_debug_PopStack "IGCM_sys_Chmod"
395}
396
397#D-#==================================================
398#D-function IGCM_sys_FileSize
399#D-* Purpose: Filesize
400#D-* Examples:
401#D-
402function IGCM_sys_FileSize {
403  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
404
405  typeset sizeF
406  set +A sizeF -- $( ls -la ${1} )
407  if [ $? -gt 0 ] ; then
408    IGCM_debug_Exit "IGCM_sys_FileSize"
409  fi
410  eval ${2}=${sizeF[4]}
411
412  IGCM_debug_PopStack "IGCM_sys_FileSize"
413}
414
415#D-#==================================================
416#D-function IGCM_sys_TestDir
417#D-* Purpose: Test Directory that must exists
418#D-* Examples:
419#D-
420function IGCM_sys_TestDir {
421  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
422  if ( $DEBUG_sys ) ; then
423    echo "IGCM_sys_TestDir :" $@
424  fi
425  typeset ExistFlag
426  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
427  IGCM_debug_PopStack "IGCM_sys_TestDir"
428
429  return ${ExistFlag}
430}
431
432#D-#==================================================
433#D-function IGCM_sys_TestDirArchive
434#D-* Purpose: Test Directory that must exists on Archive
435#D-* Examples:
436#D-
437function IGCM_sys_TestDirArchive {
438  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
439  if ( $DEBUG_sys ) ; then
440    echo "IGCM_sys_TestDirArchive :" $@
441  fi
442  typeset ExistFlag
443  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
444  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
445  return ${ExistFlag}
446}
447
448#D-#==================================================
449#D-function IGCM_sys_IsFileArchived
450#D-* Purpose: Test file that must NOT EXISTS on Archive
451#D-* Examples:
452#D-
453function IGCM_sys_IsFileArchived {
454  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
455  if ( $DEBUG_sys ) ; then
456    echo "IGCM_sys_IsFileArchived :" $@
457  fi
458  typeset IsArchivedFlag
459  # Never archived for this system
460  IsArchivedFlag=1
461  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
462
463  return ${IsArchivedFlag}
464}
465
466#D-#==================================================
467#D-function IGCM_sys_TestFileArchive
468#D-* Purpose: Test file that must NOT EXISTS on Archive
469#D-* Examples:
470#D-
471function IGCM_sys_TestFileArchive {
472  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
473  typeset ExistFlag
474  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
475  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
476
477  return ${ExistFlag}
478}
479
480#D-#==================================================
481#D-function IGCM_sys_TestFileBuffer
482#D-* Purpose: Test file that must NOT EXISTS on Buffer
483#D-* Examples:
484#D-
485function IGCM_sys_TestFileBuffer {
486  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
487  typeset ExistFlag
488  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
489  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
490
491  return ${ExistFlag}
492}
493
494#D-#==================================================
495#D-function IGCM_sys_CountFileArchive
496#D-* Purpose: Count files on Archive filesystem
497#D-* Examples:
498#D-
499function IGCM_sys_CountFileArchive {
500  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
501  ls ${@} 2>/dev/null | wc -l
502  if [ $? -gt 0 ] ; then
503    echo "IGCM_sys_CountFileArchive : erreur."
504  fi
505  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
506}
507
508#D-#==================================================
509#D-function IGCM_sys_CountFileBuffer
510#D-* Purpose: Count files on Scratch filesystem
511#D-* Examples:
512#D-
513function IGCM_sys_CountFileBuffer {
514  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
515  ls ${@} 2>/dev/null | wc -l
516  if [ $? -gt 0 ] ; then
517    echo "IGCM_sys_CountFileBuffer : erreur."
518  fi
519  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
520}
521
522#D-#==================================================
523#D-function IGCM_sys_Tree
524#D-* Purpose: Tree directories with files on ${ARCHIVE}
525#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
526#D-
527function IGCM_sys_Tree {
528  IGCM_debug_PushStack "IGCM_sys_Tree" $@
529  if ( $DEBUG_sys ) ; then
530    echo "IGCM_sys_Tree :" $@
531  fi
532
533  \tree -f $@
534
535  IGCM_debug_PopStack "IGCM_sys_Tree"
536}
537
538#D-#==================================================
539#D-function IGCM_sys_Tar
540#D-* Purpose: master tar command
541#D-* Examples:
542#D-
543function IGCM_sys_Tar {
544  IGCM_debug_PushStack "IGCM_sys_Tar" $@
545  if ( $DEBUG_sys ) ; then
546    echo "IGCM_sys_Tar :" $@
547  fi
548  \tar cf $@
549  if [ $? -gt 0 ] ; then
550    echo "IGCM_sys_Tar : erreur."
551    IGCM_debug_Exit "IGCM_sys_Tar"
552  fi
553  IGCM_debug_PopStack "IGCM_sys_Tar"
554}
555
556#D-#==================================================
557#D-function IGCM_sys_UnTar
558#D-* Purpose: master un-tar command
559#D-* Examples:
560#D-
561function IGCM_sys_UnTar {
562  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
563  if ( $DEBUG_sys ) ; then
564    echo "IGCM_sys_UnTar :" $@
565  fi
566  \tar xvf $1
567  if [ $? -gt 0 ] ; then
568    echo "IGCM_sys_UnTar : erreur."
569    IGCM_debug_Exit "IGCM_sys_UnTar"
570  fi
571  IGCM_debug_PopStack "IGCM_sys_UnTar"
572}
573
574#D-#==================================================
575#D-function IGCM_sys_Qsub
576#D-* Purpose: Qsub new job
577#D-* Examples:
578#D-
579function IGCM_sys_Qsub {
580  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
581  if ( $DEBUG_sys ) ; then
582    echo "IGCM_sys_Qsub :" $@
583  fi
584  typeset status
585  /usr/local/bin/qsub -q medium -o ${SUBMIT_DIR}/${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
586  status=$?
587  if [ ${status} -gt 0 ] ; then
588    IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}"
589    IGCM_debug_Exit "IGCM_sys_Qsub"
590  fi
591  IGCM_debug_PopStack "IGCM_sys_Qsub"
592}
593
594#D-#==================================================
595#D-function IGCM_sys_QsubPost
596#D-* Purpose: Qsub new job on scalaire
597#D-* Examples:
598#D-
599function IGCM_sys_QsubPost {
600  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
601  if ( $DEBUG_sys ) ; then
602    echo "IGCM_sys_QsubPost :" $@
603  fi
604  typeset status
605  /usr/local/bin/qsub -q medium -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job -v ${listVarEnv}
606  status=$?
607  if [ ${status} -gt 0 ] ; then
608    IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}"
609    IGCM_debug_Exit "IGCM_sys_QsubPost"
610  fi
611  IGCM_debug_PopStack "IGCM_sys_QsubPost"
612}
613
614#D-*************************
615#D- File transfer functions
616#D-*************************
617#D-
618
619#D-#==================================================
620#D-function IGCM_sys_Rsync_out
621#D-* Purpose: treat return val of rsync
622#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
623#D-  Error values and explanations can depend on your system version.
624function IGCM_sys_Rsync_out {
625  status=$1
626  if [ ! $status ] ; then
627    echo "rsync error !"
628  fi
629
630  if [ $MYLANG = "fr" ]; then
631    case $status in
632    0)  return ;;
633    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
634      echo "Erreur de syntaxe ou d'utilisation."
635      return;;
636    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
637      echo "Incompatibilité de protocole."
638      return;;
639    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
640      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
641      echo "répertoires"
642      return;;
643    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
644      echo "Action demandée non supportée : une tentative de manipulation de"
645      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
646      echo "été faite ; ou une option qui est supportée par le  client  mais"
647      echo "pas par le serveur a été spécifiée."
648      return;;
649    10) echo "Erreur de rsync ; RERR_SOCKETIO"
650      echo "Erreur dans le socket d'entrée sortie"
651      return;;
652    11) echo "Erreur de rsync ; RERR_FILEIO"
653      echo "Erreur d'entrée sortie fichier"
654      return;;
655    12) echo "Erreur de rsync ; RERR_STREAMIO"
656      echo "Erreur dans flux de donnée du protocole rsync"
657      return;;
658    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
659      echo "Erreur avec les diagnostics du programme"
660      return;;
661    14) echo "Erreur de rsync ; RERR_IPC"
662      echo "Erreur dans le code IPC"
663      return;;
664    20) echo "Erreur de rsync ; RERR_SIGNAL"
665      echo "SIGUSR1 ou SIGINT reçu"
666      return;;
667    21) echo "Erreur de rsync ; RERR_WAITCHILD"
668      echo "Une erreur retournée par waitpid()"
669      return;;
670    22) echo "Erreur de rsync ; RERR_MALLOC"
671      echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
672      return;;
673    23) echo ""
674      echo "Erreur fichier inexistant"
675      return;;
676    30) echo "Erreur de rsync ; RERR_TIMEOUT"
677      echo "Temps d'attente écoulé dans l'envoi/réception de données"
678      return;;
679    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $status
680      return;;
681    esac
682  elif [ $MYLANG = "en" ] ; then
683    case $status in
684    0)  return;;
685    1)  echo "rsync error : Syntax or usage error "
686      return;;
687    2)  echo "rsync error : Protocol incompatibility "
688      return;;
689    3)  echo "rsync error : Errors selecting input/output files, dirs"
690      return;;
691    4)  echo "rsync error : Requested action not supported: an attempt"
692      echo "was made to manipulate 64-bit files on a platform that cannot support"
693      echo "them; or an option was specified that is supported by the client and"
694      echo "not by the server."
695      return;;
696    5)  echo "rsync error : Error starting client-server protocol"
697      return;;
698    10) echo "rsync error : Error in socket I/O "
699      return;;
700    11) echo "rsync error : Error in file I/O "
701      return;;
702    12) echo "rsync error : Error in rsync protocol data stream "
703      return;;
704    13) echo "rsync error : Errors with program diagnostics "
705      return;;
706    14) echo "rsync error : Error in IPC code "
707      return;;
708    20) echo "rsync error : Received SIGUSR1 or SIGINT "
709      return;;
710    21) echo "rsync error : Some error returned by waitpid() "
711      return;;
712    22) echo "rsync error : Error allocating core memory buffers "
713      return;;
714    23) echo "rsync error : Partial transfer due to error"
715      return;;
716    24) echo "rsync error : Partial transfer due to vanished source files"
717      return;;
718    30) echo "rsync error : Timeout in data send/receive "
719      return;;
720    *)  echo "rsync error : return code of rsync unknown :" $status
721      return;;
722    esac
723  else
724    echo "unknown language $MYLANG."
725    return
726  fi
727}
728
729#D-#==================================================
730#D-function IGCM_sys_Miror_libIGCM
731#D-* Purpose: Mirror libIGCM PATH and lib to frontend
732#D-* Examples:
733#D-
734function IGCM_sys_Mirror_libIGCM {
735  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
736  if ( $DEBUG_sys ) ; then
737    echo "IGCM_sys_Mirror_libIGCM"
738  fi
739
740  typeset status
741
742  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
743
744  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
745  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
746  status=$?
747
748  if [ ${status} -gt 0 ] ; then
749    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend."
750    cat out_rsync
751  fi
752  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
753}
754
755#D-#==================================================
756#D-function IGCM_sys_Cp
757#D-* Purpose: generic cp
758#D-* Examples:
759#D-
760function IGCM_sys_Cp {
761  IGCM_debug_PushStack "IGCM_sys_Cp" $@
762  if ( $DEBUG_sys ) ; then
763    echo "IGCM_sys_Cp :" $@
764  fi
765
766  typeset status
767
768  echo cp $@ > out_rsync 2>&1
769  \cp $@ >> out_rsync 2>&1
770  status=$?
771
772  if [ ${status} -gt 0 ] ; then
773    echo "IGCM_sys_Cp : error code ${status}"
774    cat out_rsync
775    IGCM_debug_Exit "IGCM_sys_Cp"
776  else
777    \rm out_rsync
778  fi
779  IGCM_debug_PopStack "IGCM_sys_Cp"
780}
781
782#D-#==================================================
783#D-function IGCM_sys_Rm
784#D-* Purpose: generic rm
785#D-* Examples:
786#D-
787function IGCM_sys_Rm {
788  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
789  if ( $DEBUG_sys ) ; then
790    echo "IGCM_sys_Rm :" $@
791  fi
792
793  typeset status
794
795  echo rm $@ > out_rsync 2>&1
796  \rm $@ >> out_rsync 2>&1
797  status=$?
798
799  if [ ${status} -gt 0 ] ; then
800    echo "IGCM_sys_Rm : error code ${status}"
801    cat out_rsync
802    IGCM_debug_Exit "IGCM_sys_Rm"
803  else
804    \rm out_rsync
805  fi
806  IGCM_debug_PopStack "IGCM_sys_Rm"
807}
808
809#D-#==================================================
810#D-function IGCM_sys_RmRunDir
811#D-* Purpose: rm tmpdir (dummy function most of the time batch
812#D-                      scheduler will do the job)
813#D-* Examples:
814#D-
815function IGCM_sys_RmRunDir {
816  IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
817  if ( $DEBUG_sys ) ; then
818    echo "IGCM_sys_RmRunDir :" $@
819  fi
820
821  typeset status
822
823  echo rm $@ > out_rsync 2>&1
824  \rm $@ >> out_rsync 2>&1
825  status=$?
826
827  if [ ${status} -gt 0 ] ; then
828    echo "IGCM_sys_RmRunDir : rm error code is ${status}."
829    cat out_rsync
830    IGCM_debug_Exit "IGCM_sys_RmRunDir"
831  else
832    \rm out_rsync
833  fi
834  IGCM_debug_PopStack "IGCM_sys_RmRunDir"
835}
836
837#D-#==================================================
838#D-function IGCM_sys_Mv
839#D-* Purpose: generic move
840#D-* Examples:
841#D-
842function IGCM_sys_Mv {
843  IGCM_debug_PushStack "IGCM_sys_Mv" $@
844  if ( $DEBUG_sys ) ; then
845    echo "IGCM_sys_Mv :" $@
846  fi
847
848  if [ $DRYRUN = 0 ]; then
849
850    typeset status
851
852    echo mv $@ > out_rsync 2>&1
853    \mv $@ >> out_rsync 2>&1
854    status=$?
855
856    if [ ${status} -gt 0 ] ; then
857      echo "IGCM_sys_Mv : error code ${status}"
858      cat out_rsync
859      IGCM_debug_Exit "IGCM_sys_Mv"
860    else
861      \rm out_rsync
862    fi
863  fi
864  IGCM_debug_PopStack "IGCM_sys_Mv"
865}
866
867#D-#==================================================
868#D-function IGCM_sys_Put_Dir
869#D-* Purpose: Copy a complete directory on $(ARCHIVE)
870#D-* Examples:
871#D-
872function IGCM_sys_Put_Dir {
873  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
874  if ( $DEBUG_sys ) ; then
875    echo "IGCM_sys_Put_Dir :" $@
876  fi
877  if [ $DRYRUN = 0 ]; then
878    if [ ! -d ${1} ] ; then
879      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
880      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
881      return
882    fi
883
884    typeset status
885
886    # Only if we use rsync
887    #IGCM_sys_TestDirArchive $( dirname $2 )
888    #
889    #USUAL WAY
890    \cp -r $1 $2 > out_rsync 2>&1
891    status=$?
892
893    if [ ${status} -gt 0 ] ; then
894      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}"
895      cat out_rsync
896      IGCM_debug_Exit "IGCM_sys_Put_Dir"
897    else
898      \rm out_rsync
899    fi
900  fi
901  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
902}
903
904#D-#==================================================
905#D-function IGCM_sys_Get_Dir
906#D-* Purpose: Copy a complete directory from ${ARCHIVE}
907#D-* Examples:
908#D-
909function IGCM_sys_Get_Dir {
910  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
911  if ( $DEBUG_sys ) ; then
912    echo "IGCM_sys_Get_Dir :" $@
913  fi
914  if [ $DRYRUN = 0 ]; then
915    if [ ! -d ${1} ] ; then
916      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
917      IGCM_debug_PopStack "IGCM_sys_Get_Dir"
918      return
919    fi
920
921    typeset status
922
923    #USUAL WAY
924    \cp -ur $1 $2 > out_rsync 2>&1
925    status=$?
926
927    if [ ${status} -gt 0 ] ; then
928      IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}"
929      cat out_rsync
930      IGCM_debug_Exit "IGCM_sys_Get_Dir"
931    else
932      \rm out_rsync
933    fi
934  fi
935  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
936}
937
938#D-#==================================================
939#D-function IGCM_sys_Get_Master
940#D-* Purpose: Copy a complete directory from MASTER filesystem
941#D-* Examples:
942#D-
943function IGCM_sys_Get_Master {
944  IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
945  if ( $DEBUG_sys ) ; then
946    echo "IGCM_sys_Get_Master :" $@
947  fi
948  if [ $DRYRUN = 0 ]; then
949    if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then
950      echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
951      IGCM_debug_PopStack "IGCM_sys_Get_Master"
952      return
953    fi
954
955    typeset NB_ESSAI DELAI status i
956    # number of tentative
957    NB_ESSAI=3
958    # time delay between tentative
959    DELAI=2
960
961    i=0
962    while [ $i -lt $NB_ESSAI ] ; do
963      \cp -urL $1 $2 > out_rsync 2>&1
964      status=$?
965      if [ ${status} -gt 0 ]; then
966        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}"
967        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."
968        sleep $DELAI
969      else
970        break
971      fi
972      (( i = i + 1 ))
973    done
974
975    if [ ${status} -gt 0 ] ; then
976      echo "IGCM_sys_Get_Master : error."
977      cat out_rsync
978      IGCM_debug_Exit "IGCM_sys_Get_Master"
979    else
980      \rm out_rsync
981    fi
982  fi
983  IGCM_debug_PopStack "IGCM_sys_Get_Master"
984}
985
986#====================================================
987#- Call IGCM_sys_Mirror_libIGCM now !
988if ( $MirrorlibIGCM ) ; then
989  IGCM_sys_Mirror_libIGCM
990fi
991
992#D-#==================================================
993#D-function IGCM_sys_Put_Rest
994#D-* Purpose: Put computied restarts on ${ARCHIVE}.
995#D-           File and target directory must exist.
996#D-* Examples:
997#D-
998function IGCM_sys_Put_Rest {
999  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
1000  if ( $DEBUG_sys ) ; then
1001    echo "IGCM_sys_Put_Rest :" $@
1002  fi
1003  if [ $DRYRUN = 0 ]; then
1004    if [ ! -f ${1} ] ; then
1005      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
1006      IGCM_debug_Exit "IGCM_sys_Put_Rest"
1007    fi
1008
1009    typeset status
1010    #
1011    if [ X${JobType} = XRUN ] ; then
1012      IGCM_sys_Chmod 444 ${1}
1013    fi
1014    #
1015    # Only if we use rsync
1016    #IGCM_sys_MkdirArchive $( dirname $2 )
1017    #
1018    #USUAL WAY
1019    \cp $1 $2 > out_rsync 2>&1
1020    status=$?
1021
1022#       #RSYNC WITH NETWORK SSH CALL
1023#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
1024#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
1025
1026#       #RSYNC WITH NFS USE
1027#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
1028#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
1029
1030#       status=$?
1031#       IGCM_sys_Rsync_out $status
1032
1033#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1034#       (( status=status+$? ))
1035
1036    if [ ${status} -gt 0 ] ; then
1037      echo "IGCM_sys_Put_Rest : cp failed error code ${status}"
1038      cat out_rsync
1039      IGCM_debug_Exit "IGCM_sys_Put_Rest"
1040    else
1041      \rm out_rsync
1042    fi
1043  fi
1044  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
1045}
1046
1047#D-#==================================================
1048#D-function IGCM_sys_PutBuffer_Rest
1049#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
1050#D-           File and target directory must exist.
1051#D-* Examples:
1052#D-
1053function IGCM_sys_PutBuffer_Rest {
1054  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
1055  if ( $DEBUG_sys ) ; then
1056    echo "IGCM_sys_PutBuffer_Rest :" $@
1057  fi
1058  if [ $DRYRUN = 0 ]; then
1059    if [ ! -f ${1} ] ; then
1060      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
1061      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
1062    fi
1063
1064    typeset status
1065    #
1066    if [ X${JobType} = XRUN ] ; then
1067      IGCM_sys_Chmod 444 ${1}
1068    fi
1069
1070    #
1071    # USUAL WAY
1072    \cp $1 $2 > out_rsync 2>&1
1073    status=$?
1074
1075    if [ ${status} -gt 0 ] ; then
1076      echo "IGCM_sys_PutBuffer_Rest : error code ${status}"
1077      [ -f ${2} ] && ls -l ${2}
1078      [ -f ${2}/${1} ] && ls -l ${2}/${1}
1079      cat out_rsync
1080      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
1081    else
1082      \rm out_rsync
1083    fi
1084  fi
1085  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
1086}
1087
1088#D-#==================================================
1089#D-function IGCM_sys_PrepareTaredRestart
1090#D-* Purpose: Prepare tared restart to be access by computing job. Identity here.
1091#D-* Examples:
1092#D-
1093function IGCM_sys_PrepareTaredRestart {
1094  IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@
1095  echo $1
1096  IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart"
1097}
1098
1099#D-#==================================================
1100#D-function IGCM_sys_Put_Out
1101#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
1102#D-* Examples:
1103#D-
1104function IGCM_sys_Put_Out {
1105  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
1106  if ( $DEBUG_sys ) ; then
1107    echo "IGCM_sys_Put_Out :" $@
1108  fi
1109
1110  typeset status
1111
1112  if [ $DRYRUN = 0 ]; then
1113    if [ ! -f ${1} ] ; then
1114      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
1115      IGCM_debug_PopStack "IGCM_sys_Put_Out"
1116      return 1
1117    fi
1118    #
1119    IGCM_sys_MkdirArchive $( dirname $2 )
1120    #
1121    if [ X${JobType} = XRUN ] ; then
1122      if [ X${3} = X ] ; then
1123        IGCM_sys_Chmod 444 ${1}
1124      fi
1125    fi
1126    #
1127
1128    echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
1129    ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
1130    status=$?
1131    IGCM_sys_Rsync_out $status
1132
1133    ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1134    (( status=status+$? ))
1135
1136    if [ ${status} -gt 0 ] ; then
1137      IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}"
1138      cat out_rsync
1139      IGCM_debug_Exit "IGCM_sys_Put_Out"
1140    else
1141      \rm out_rsync
1142    fi
1143  fi
1144  IGCM_debug_PopStack "IGCM_sys_Put_Out"
1145  return 0
1146}
1147
1148#D-#==================================================
1149#D-function IGCM_sys_PutBuffer_Out
1150#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly
1151#D-* Examples:
1152#D-
1153function IGCM_sys_PutBuffer_Out {
1154  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
1155  if ( $DEBUG_sys ) ; then
1156    echo "IGCM_sys_PutBuffer_Out :" $@
1157  fi
1158
1159  typeset NB_ESSAI DELAI status i exist skip
1160
1161  # number of tentative
1162  NB_ESSAI=3
1163  # time delay between tentative
1164  DELAI=2
1165
1166  if [ $DRYRUN = 0 ]; then
1167    if [ ! -f ${1} ] ; then
1168      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
1169      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
1170      return 1
1171    fi
1172    #
1173    IGCM_sys_Mkdir $( dirname $2 )
1174    #
1175
1176    exist=false
1177    skip=false
1178    if [ -f $2 ] ; then
1179      IGCM_debug_Print 1 "$2 already exist"
1180      exist=true
1181      if [ "X$( diff $1 $2 )" = X ] ; then
1182        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
1183        status=0
1184        skip=true
1185      else
1186        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
1187        skip=false
1188      fi
1189    fi
1190    #
1191    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
1192      IGCM_sys_Chmod u+w $2
1193    fi
1194
1195    if [ X${skip} = Xfalse ] ; then
1196      i=0
1197      while [ $i -lt $NB_ESSAI ] ; do
1198        # USUAL WAY
1199        \cp $1 $2 > out_rsync 2>&1
1200        status=$?
1201        if [ ${status} -gt 0 ]; then
1202          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}"
1203          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again."
1204          [ -f ${2} ] && ls -l ${2}
1205          [ -f ${2}/${1} ] && ls -l ${2}/${1}
1206          sleep $DELAI
1207        else
1208          break
1209        fi
1210        (( i = i + 1 ))
1211      done
1212    fi
1213
1214    if [ ${status} -gt 0 ] ; then
1215      echo "IGCM_sys_PutBuffer_Out : error."
1216      [ -f ${2} ] && ls -l ${2}
1217      [ -f ${2}/${1} ] && ls -l ${2}/${1}
1218      cat out_rsync
1219      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
1220    else
1221
1222      if [ X${JobType} = XRUN ] ; then
1223        if [ X${3} = X ] ; then
1224          [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}
1225          [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}
1226        fi
1227      fi
1228
1229      \rm out_rsync
1230    fi
1231  fi
1232  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
1233  return 0
1234}
1235
1236#D-#==================================================
1237#D-function IGCM_sys_Get
1238#D-* Purpose: Get a file from ${ARCHIVE}
1239#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
1240#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
1241function IGCM_sys_Get {
1242  IGCM_debug_PushStack "IGCM_sys_Get" $@
1243
1244  typeset DEST status dm_liste
1245
1246  if ( $DEBUG_sys ) ; then
1247    echo "IGCM_sys_Get :" $@
1248  fi
1249  if [ $DRYRUN -le 2 ]; then
1250    if [ X${1} = X'/l' ] ; then
1251      # test if the first file is present in the old computation :
1252      eval set +A dm_liste \${${2}}
1253    else
1254      dm_liste=${1}
1255    fi
1256    eval DEST=\${${#}}
1257
1258    # test if the (first) file is present in the old computation :
1259    IGCM_sys_TestFileArchive ${dm_liste[0]}
1260    status=$?
1261    if [ ${status} -gt 0 ] ; then
1262      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
1263      IGCM_debug_Exit "IGCM_sys_Get"
1264      return
1265    fi
1266
1267    #USUAL WAY
1268    \cp ${dm_liste[*]} ${DEST} > out_rsync 2>&1
1269    status=$?
1270
1271    if [ ${status} -gt 0 ] ; then
1272      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}"
1273      cat out_rsync
1274      IGCM_debug_Exit "IGCM_sys_Get"
1275    else
1276      \rm out_rsync
1277    fi
1278  fi
1279  IGCM_debug_PopStack "IGCM_sys_Get"
1280}
1281
1282#D-#==================================================
1283#D-function IGCM_sys_GetBuffer
1284#D-* Purpose: Get a file from ${SCRATCHDIR}
1285#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
1286#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
1287function IGCM_sys_GetBuffer {
1288  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
1289
1290  typeset DEST buf_liste target file_work
1291  typeset NB_ESSAI DELAI status i
1292
1293  if ( $DEBUG_sys ) ; then
1294    echo "IGCM_sys_GetBuffer :" $@
1295  fi
1296
1297  # number of tentative
1298  NB_ESSAI=3
1299  # time delay between tentative
1300  DELAI=2
1301
1302  if [ $DRYRUN -le 2 ]; then
1303    if [ X${1} = X'/l' ] ; then
1304      # test if the first file is present in the old computation :
1305      eval set +A buf_liste \${${2}}
1306    else
1307      eval set +A buf_liste ${1}
1308    fi
1309    eval DEST=\${${#}}
1310
1311    #USUAL WAY
1312    if [ X${1} = X'/l' ] ; then
1313      for target in ${buf_liste[*]} ; do
1314        local_file=$( basename ${target} )
1315        i=0
1316        while [ $i -lt $NB_ESSAI ] ; do
1317          \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
1318          status=$?
1319          if [ ${status} -gt 0 ]; then
1320            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"
1321            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."
1322            sleep $DELAI
1323          else
1324            break
1325          fi
1326          (( i = i + 1 ))
1327        done
1328        if [ ${status} -gt 0 ] ; then
1329          echo "IGCM_sys_Get : error"
1330          cat out_rsync
1331          \rm out_rsync
1332          IGCM_debug_Exit "IGCM_sys_GetBuffer"
1333        else
1334          \rm out_rsync
1335        fi
1336      done
1337    else
1338      i=0
1339      while [ $i -lt $NB_ESSAI ] ; do
1340        \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
1341        status=$?
1342        if [ ${status} -gt 0 ]; then
1343          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"
1344          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."
1345          sleep $DELAI
1346        else
1347          break
1348        fi
1349        (( i = i + 1 ))
1350      done
1351      if [ ${status} -gt 0 ] ; then
1352        echo "IGCM_sys_Get : error"
1353        cat out_rsync
1354        \rm out_rsync
1355        IGCM_debug_Exit "IGCM_sys_GetBuffer"
1356      else
1357        \rm out_rsync
1358      fi
1359    fi
1360  fi
1361  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
1362}
1363
1364#D-#==================================================
1365#D-function IGCM_sys_GetDate_FichWork
1366#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
1367#D-* Examples:
1368#D-
1369function IGCM_sys_GetDate_FichWork {
1370  IGCM_debug_PushStack "IGCM_sys_FichWork" $@
1371  if ( $DEBUG_sys ) ; then
1372    echo "IGCM_sys_GetDate_FichWork :" $@
1373  fi
1374  typeset dateF
1375  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
1376  eval ${2}=${dateF[5]}
1377
1378  # donne la date filesys d'un fichier sur la machine work
1379  IGCM_debug_PopStack "IGCM_sys_FichWork"
1380}
1381
1382#D-#==================================================
1383#D-function IGCM_sys_GetDate_FichArchive
1384#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
1385#D-* Examples:
1386#D-
1387function IGCM_sys_GetDate_FichArchive {
1388  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
1389  if ( $DEBUG_sys ) ; then
1390    echo "IGCM_sys_GetDate_FichArchive :" $@
1391  fi
1392  typeset dateF
1393  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
1394  eval ${2}=${dateF[5]}
1395
1396  IGCM_debug_PopStack "IGCM_sys_FichArchive"
1397}
1398
1399#D-#==================================================
1400#D-function IGCM_sys_Dods_Rm
1401#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole.
1402#D-* Examples:
1403#D-
1404function IGCM_sys_Dods_Rm {
1405  if ( $DEBUG_sys ) ; then
1406    echo "IGCM_sys_Dods_Rm :" $@
1407  fi
1408  return 0
1409}
1410
1411#D-#==================================================
1412#D-function IGCM_sys_Dods_Cp
1413#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole.
1414#D-* Examples:
1415#D-
1416function IGCM_sys_Dods_Cp {
1417  if ( $DEBUG_sys ) ; then
1418    echo "IGCM_sys_Dods_Cp :" $@
1419  fi
1420  return 0
1421}
1422
1423#D-#==================================================
1424#D-function IGCM_sys_Put_Dods
1425#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here
1426#D-* Examples:
1427#D-
1428function IGCM_sys_Put_Dods {
1429  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
1430  if ( $DEBUG_sys ) ; then
1431    echo "IGCM_sys_Put_Dods :" $@
1432  fi
1433  IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1434}
1435
1436##############################################################
1437# REBUILD OPERATOR
1438
1439#D-#==================================================
1440#D-function IGCM_sys_rebuild
1441#D-* Purpose: rebuild parallel files
1442#D-* Examples:
1443#D-
1444function IGCM_sys_rebuild {
1445  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
1446  if ( $DEBUG_sys ) ; then
1447    echo "IGCM_sys_rebuild :" $@
1448  fi
1449
1450  typeset NB_ESSAI DELAI status i firstArg
1451  # number of tentative
1452  NB_ESSAI=3
1453  # time delay between tentative
1454  DELAI=2
1455
1456  i=0
1457  while [ $i -lt $NB_ESSAI ] ; do
1458    /home/users/igcmg/rebuild/bin/rebuild -f -o $@ > out_rsync 2>&1
1459    status=$?
1460    if [ ${status} -gt 0 ] ; then
1461      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}"
1462      cat out_rsync
1463      \rm out_rsync
1464      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1465      firstArg=${1}
1466      \rm ${firstArg}
1467      sleep $DELAI
1468    else
1469      \rm out_rsync
1470      break
1471    fi
1472    (( i = i + 1 ))
1473  done
1474
1475  if [ ${status} -gt 0 ] ; then
1476    echo "IGCM_sys_rebuild : rebuild error code is ${status}"
1477    IGCM_debug_Exit "rebuild"
1478  fi
1479
1480  IGCM_debug_PopStack "IGCM_sys_rebuild"
1481}
1482
1483#D-#==================================================
1484#D-function IGCM_sys_rebuild_station
1485#D-* Purpose: rebuild parallel files describing station
1486#D-* Examples:
1487#D-
1488function IGCM_sys_rebuild_station {
1489  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@
1490  typeset i list_opt file_in file_out prefix_invert list_invert
1491  if ( $DEBUG_sys ) ; then
1492    echo "IGCM_sys_rebuild_station :" $@
1493  fi
1494  list_opt=$@
1495
1496  # Invert Axis : t,x -> x,t
1497  #               t,pres,x -> x,t,pres
1498  # So that we can concatenate along x
1499  i=0
1500  for file_in in ${list_opt} ; do
1501    (( i = i + 1))
1502    [ ${i} = 1 ] && file_out=${file_in} && continue
1503    prefix_invert=$( basename ${file_in} .nc )
1504    IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc
1505    list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc
1506  done
1507
1508  # Concatenate
1509  IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc
1510
1511  # Re-ivert file
1512  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out}
1513
1514  # Station re-ordering is too expansive to be run within libICGM
1515  # This is due to (ncpdq - nrcat - ncpdq) I/O sequence.
1516  # This re-ordering must be done "in memory" by the cmorization process
1517  # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq)
1518  # BEGIN reordering
1519
1520  # Only LMDZ text output contains the exact ordering of the station.
1521  # We isolate this in the code below:
1522  #  0  38  -157.5000000000000  70.98591549295774
1523  #  0  54  27.49999999999999   67.18309859154928
1524  #  0  56  -62.50000000000001  82.39436619718309
1525  #  0  79  12.49999999999999   78.59154929577466
1526  #  0  116 -165.0000000000000  76.05633802816901
1527  #  0  117 130.0000000000000   70.98591549295774
1528  #  0  118 110.0000000000000   87.46478873239437
1529  #  1  40  4.999999999999995   51.97183098591550
1530#  typeset iStation iProc list_opt file_in file_out prefix_invert
1531#  typeset -Z4 j4
1532#  typeset -Z3 j3
1533
1534#  unset list_opt
1535#  set +A list_opt $@
1536
1537  # Filename after rebuild
1538#  file_out=${list_opt[0]}
1539  # Prefix of output files
1540#  prefix_invert=$( basename ${file_out} .nc )
1541  # Number of procs
1542#  num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l )
1543
1544#  iProc=0
1545#  while [ ${iProc} -lt ${num_proc} ] ; do
1546    # Array containing Station as a number
1547#    unset proc_stn
1548#    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}' )
1549    # Number of stations produced by processor proc
1550#    stationLast=${#proc_stn[*]}
1551    # Proc number on 4 digits
1552#    j4=${iProc}
1553    # Init
1554#    iStation=0
1555#    while [ ${iStation} -lt ${stationLast} ] ; do
1556      # Station number on 3 digits
1557#      j3=${proc_stn[${iStation}]}
1558      # Extract station
1559      # Invert Axis : t,x -> x,t
1560      #               t,pres,x -> x,t,pres
1561      # So that we can concatenate along x
1562#      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
1563#      (( iStation = iStation + 1 ))
1564#    done
1565#    (( iProc = iProc + 1 ))
1566#  done
1567
1568  # Concatenate all station along x
1569#  IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc
1570
1571  # Re-invert file
1572#  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out}
1573
1574  # END reordering
1575
1576  IGCM_debug_PopStack "IGCM_sys_rebuild_station"
1577}
1578
1579############################################################
1580# Activate Running Environnment Variables
1581
1582#D-#==================================================
1583#D-function IGCM_sys_desactiv_variables
1584#D-* Purpose: set environement variables prior to execution
1585#D-* Examples:
1586#D-
1587function IGCM_sys_activ_variables {
1588  IGCM_debug_PushStack "IGCM_sys_activ_variables"
1589  if ( $DEBUG_sys ) ; then
1590    echo "IGCM_sys_activ_variables"
1591  fi
1592
1593# --------------------------------------------------------------------
1594#D- MPI specifications
1595# --------------------------------------------------------------------
1596
1597# --------------------------------------------------------------------
1598#D- Other specifications
1599# --------------------------------------------------------------------
1600
1601  IGCM_debug_PopStack "IGCM_sys_activ_variables"
1602}
1603
1604############################################################
1605# Desactivate Running Environnment Variables
1606
1607#D-#==================================================
1608#D-function IGCM_sys_desactiv_variables
1609#D-* Purpose: unset environement variables after execution
1610#D-* Examples:
1611#D-
1612function IGCM_sys_desactiv_variables {
1613  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
1614  if ( $DEBUG_sys ) ; then
1615    echo "IGCM_sys_desactiv_variables"
1616  fi
1617# --------------------------------------------------------------------
1618#D- MPI specifications
1619# --------------------------------------------------------------------
1620
1621# --------------------------------------------------------------------
1622#D- Other specifications
1623# --------------------------------------------------------------------
1624
1625  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
1626}
1627
1628############################################################
1629# Build MPI/OMP scripts run file (dummy function)
1630
1631#D-#==================================================
1632#D-function IGCM_sys_build_run_file
1633#D-* Purpose: build run file (deprecated)
1634#D-* Examples:
1635#D-
1636function IGCM_sys_build_run_file {
1637
1638  IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file "
1639
1640}
1641
1642############################################################
1643# Build MPI/OMP scripts
1644
1645#D-#==================================================
1646#D-function IGCM_sys_build_execution_scripts
1647#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND}
1648#D-* Examples:
1649#D-
1650function IGCM_sys_build_execution_scripts
1651{
1652  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@
1653  if ( $DEBUG_sys ) ; then
1654    echo "IGCM_sys_build_execution_scripts " $@
1655  fi
1656  typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut
1657  typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc
1658  typeset num_corempi nombre_restant_node nombre_restant_comp
1659
1660  if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then
1661    IGCM_debug_Exit "IGCM_sys_obelix build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} "
1662  fi
1663
1664  if ( ${OK_PARA_MPMD} ) ; then
1665
1666    if [ -f run_file ] ; then
1667      IGCM_sys_Rm -f run_file
1668    fi
1669    touch run_file
1670
1671    if ( ${OK_PARA_OMP} ) ; then
1672
1673      #  Hosts treatment
1674
1675      ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp
1676
1677      i=0
1678      rm -f hosts
1679      IGCM_debug_Print 1 "sys Obelix, Hosts avaible :"
1680      for nodes in `cat hosts.tmp` ; do
1681        host[$i]=$nodes
1682        echo "${host[$i]} slots=1 max_slots=1" >> hosts
1683        IGCM_debug_Print 1 ${host[$i]}
1684        i=$((i+1))
1685      done
1686      rm -f hosts.tmp
1687
1688      listnodes=${host[*]}
1689
1690      EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts"
1691
1692      # Initialisation
1693
1694      init_node=y
1695      node_num_current=0
1696      start_num=0
1697      init_exec=n
1698
1699      # Test : if oasis is there, we put it at the first position
1700
1701      for comp in ${config_ListOfComponents[*]} ; do
1702
1703        if [ "X${comp}" = "XCPL" ]  ; then
1704
1705          eval ExeNameIn=\${config_Executable_${comp}[0]}
1706          eval ExeNameOut=\${config_Executable_${comp}[1]}
1707
1708          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1709          echo ""  >> script_${ExeNameOut}.ksh
1710          #echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
1711          #echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
1712          #echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
1713          echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err"  >> script_${ExeNameOut}.ksh
1714          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1715
1716          init_node=n
1717
1718          (( nombre_restant_node = NUM_COREPERNODE - 1 ))
1719          node_num_current=0
1720          node_current=${host[${node_num_current}]}
1721
1722          EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh"
1723
1724          init_exec=y
1725          start_num=1
1726
1727        fi
1728
1729      done
1730
1731      # Then loop on the components (except for oasis)
1732
1733      for comp in ${config_ListOfComponents[*]} ; do
1734
1735        eval ExeNameIn=\${config_Executable_${comp}[0]}
1736        eval ExeNameOut=\${config_Executable_${comp}[1]}
1737
1738        # Only if we really have an executable for the component :
1739        if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then
1740
1741          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1742          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1743
1744          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1745          # echo "set -vx" >> script_${ExeNameOut}.ksh
1746          echo ""  >> script_${ExeNameOut}.ksh
1747          #echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
1748          #echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
1749          #echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
1750          echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
1751          echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >>  script_${ExeNameOut}.ksh
1752          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}"  >> script_${ExeNameOut}.ksh
1753          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1754
1755          node_num=0
1756
1757          # We define the number of MPI process to be assigned for the component
1758
1759          nombre_restant_comp=${comp_proc_mpi_loc}
1760
1761          # Loop on the allocated nodes
1762
1763          for node in ${listnodes} ; do
1764
1765            # We go to the current node
1766            if [ ${node_num} = ${node_num_current} ] ; then
1767
1768              node_current=${host[${node_num_current}]}
1769
1770              # If first time on the node : initialisation
1771
1772              if [ ${init_node} = y ] ; then
1773                nombre_restant_node=${NUM_COREPERNODE}
1774              fi
1775
1776              # Test on the number of OMP threads
1777
1778              if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then
1779                (( node_num = node_num + 1 ))
1780                node_num_current=${node_num}
1781                init_node=y
1782                continue
1783              fi
1784
1785              # Number of MPI process to assign
1786
1787              (( num_corempi = nombre_restant_node / comp_proc_omp_loc ))
1788
1789              if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then
1790                num_corempi=${nombre_restant_comp}
1791              fi
1792
1793              (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc ))
1794              (( nombre_restant_comp = nombre_restant_comp - num_corempi ))
1795
1796              if [ ${init_exec} = y ] ; then
1797                EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
1798              else
1799                EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
1800                init_exec=y
1801              fi
1802
1803              ((  start_num = num_corempi + start_num ))
1804
1805            else
1806
1807              (( node_num = node_num + 1 ))
1808              continue
1809            fi
1810
1811            # Test on the number of core/process remaining on the node/component
1812
1813            if [ ${nombre_restant_node} = 0 ] ; then
1814              (( node_num = node_num + 1 ))
1815              node_num_current=${node_num}
1816              init_node=y
1817
1818              if [ ${nombre_restant_comp} = 0 ] ; then
1819                break 1
1820              fi
1821            else
1822
1823              node_num_current=${node_num}
1824              init_node=n
1825
1826              if [ ${nombre_restant_comp} = 0 ] ; then
1827                break 1
1828              fi
1829            fi
1830          done
1831        fi
1832      done
1833
1834    else
1835
1836      # Then first loop on the components for the coupler ie oasis
1837
1838      ## the coupler ie oasis must be the first one
1839      for comp in ${config_ListOfComponents[*]} ; do
1840
1841        eval ExeNameOut=\${config_Executable_${comp}[1]}
1842
1843        # for CPL component only
1844        if [ "X${comp}" = "XCPL" ] ; then
1845          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1846          echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file
1847        fi
1848      done
1849
1850      # Then second loop on the components
1851
1852      for comp in ${config_ListOfComponents[*]} ; do
1853
1854        eval ExeNameOut=\${config_Executable_${comp}[1]}
1855
1856        # Only if we really have an executable for the component and not the coupler ie oasis:
1857        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then
1858          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1859          echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file
1860        fi
1861      done
1862      IGCM_sys_Chmod u+x run_file
1863
1864      EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file"
1865
1866    fi
1867
1868  else # Only one executable. launch it.
1869
1870    for comp in ${config_ListOfComponents[*]} ; do
1871
1872      # Only if we really have an executable for the component :
1873      eval ExeNameOut=\${config_Executable_${comp}[1]}
1874      if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then
1875
1876        echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1877        echo ""  >> script_${ExeNameOut}.ksh
1878        if ( ${OK_PARA_OMP} ) ; then
1879          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1880          echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
1881        fi
1882        if  ( ${OK_PARA_MPI} ) ; then
1883          # Default : mpirun used if nb_proc gt 1
1884          # pour sortie out/err par process
1885          # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}"  >> script_${ExeNameOut}.ksh
1886          echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1887          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1888          EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh"
1889        else
1890          # Default : mpirun is NOT used if nb_proc eq 1
1891          # pour sortie out/err par process
1892          # echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh
1893          echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1894          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1895          EXECUTION="time ./script_${ExeNameOut}.ksh"
1896        fi
1897      fi
1898    done
1899
1900  fi
1901
1902  IGCM_debug_Print 1 "sys Obelix : execution command is"
1903  IGCM_debug_Print 1 "$EXECUTION"
1904
1905  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts"
1906}
1907
1908############################################################
1909# Check of space available on temporary filesytems. Dummy function here
1910
1911#D-#==================================================
1912#D-function IGCM_sys_check_quota. Dummy call here
1913#D-* Purpose: check user quota. Stop the simulation if quota above 90%
1914#D-* Examples:
1915#D-
1916function IGCM_sys_check_quota {
1917  IGCM_debug_PushStack "IGCM_sys_check_quota"
1918  if ( $DEBUG_sys ) ; then
1919    echo "IGCM_sys_check_quota"
1920  fi
1921  IGCM_debug_PopStack "IGCM_sys_check_quota"
1922}
1923
1924#D-#==================================================
1925#D-function IGCM_sys_CountJobInQueue
1926#D-* Purpose: Check if job_name is currently
1927#D-  running or in queue
1928#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun
1929#D-
1930function IGCM_sys_CountJobInQueue {
1931  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue"
1932  if ( $DEBUG_sys ) ; then
1933    echo "IGCM_sys_CountJobInQueue"
1934  fi
1935  IGCM_debug_PopStack "IGCM_sys_CountJobInQueue"
1936}
1937
1938##############################################################
1939# NCO OPERATOR
1940
1941#D-#==================================================
1942#D-function IGCM_sys_ncap2
1943#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry
1944#D-* Examples:
1945#D-
1946function IGCM_sys_ncap2 {
1947  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
1948  if ( $DEBUG_sys ) ; then
1949    echo "IGCM_sys_ncap2 :" $@
1950  fi
1951
1952  typeset NB_ESSAI DELAI status i
1953  # number of tentative
1954  NB_ESSAI=3
1955  # time delay between tentative
1956  DELAI=2
1957
1958  i=0
1959  while [ $i -lt $NB_ESSAI ] ; do
1960    ncap2 "$@" > out_rsync 2>&1
1961    status=$?
1962    if [ ${status} -gt 0 ] ; then
1963      IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}"
1964      cat out_rsync
1965      \rm out_rsync
1966      IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1967      sleep $DELAI
1968    else
1969      \rm out_rsync
1970      break
1971    fi
1972    (( i = i + 1 ))
1973  done
1974
1975  if [ ${status} -gt 0 ] ; then
1976    echo "IGCM_sys_ncap2 : ncap2 error"
1977    IGCM_debug_Exit "ncap2"
1978  fi
1979
1980  IGCM_debug_PopStack "IGCM_sys_ncap2"
1981}
1982
1983#D-#==================================================
1984#D-function IGCM_sys_ncatted
1985#D-* Purpose: encapsulate ncatted call so as to manage error code and retry
1986#D-* Examples:
1987#D-
1988function IGCM_sys_ncatted {
1989  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
1990  if ( $DEBUG_sys ) ; then
1991    echo "IGCM_sys_ncatted :" $@
1992  fi
1993
1994  typeset NB_ESSAI DELAI status i
1995  # number of tentative
1996  NB_ESSAI=3
1997  # time delay between tentative
1998  DELAI=2
1999
2000  i=0
2001  while [ $i -lt $NB_ESSAI ] ; do
2002    ncatted "$@" > out_rsync 2>&1
2003    status=$?
2004    if [ ${status} -gt 0 ] ; then
2005      IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}"
2006      cat out_rsync
2007      \rm out_rsync
2008      IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2009      sleep $DELAI
2010    else
2011      \rm out_rsync
2012      break
2013    fi
2014    (( i = i + 1 ))
2015  done
2016
2017  if [ ${status} -gt 0 ] ; then
2018    echo "IGCM_sys_ncatted : ncatted error"
2019    IGCM_debug_Exit "ncatted"
2020  fi
2021
2022  IGCM_debug_PopStack "IGCM_sys_ncatted"
2023}
2024
2025#D-#==================================================
2026#D-function IGCM_sys_ncbo
2027#D-* Purpose: encapsulate ncbo call so as to manage error code and retry
2028#D-* Examples:
2029#D-
2030function IGCM_sys_ncbo {
2031  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
2032  if ( $DEBUG_sys ) ; then
2033    echo "IGCM_sys_ncbo :" $@
2034  fi
2035
2036  typeset NB_ESSAI DELAI status i
2037  # number of tentative
2038  NB_ESSAI=3
2039  # time delay between tentative
2040  DELAI=2
2041
2042  i=0
2043  while [ $i -lt $NB_ESSAI ] ; do
2044    ncbo $@ > out_rsync 2>&1
2045    status=$?
2046    if [ ${status} -gt 0 ] ; then
2047      IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}"
2048      cat out_rsync
2049      \rm out_rsync
2050      IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2051      sleep $DELAI
2052    else
2053      \rm out_rsync
2054      break
2055    fi
2056    (( i = i + 1 ))
2057  done
2058
2059  if [ ${status} -gt 0 ] ; then
2060    echo "IGCM_sys_ncbo : ncbo error"
2061    IGCM_debug_Exit "ncbo"
2062  fi
2063
2064  IGCM_debug_PopStack "IGCM_sys_ncbo"
2065}
2066
2067#D-#==================================================
2068#D-function IGCM_sys_ncdif
2069#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry
2070#D-* Examples:
2071#D-
2072function IGCM_sys_ncdiff {
2073  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
2074  if ( $DEBUG_sys ) ; then
2075    echo "IGCM_sys_ncdiff :" $@
2076  fi
2077
2078  typeset NB_ESSAI DELAI status i
2079  # number of tentative
2080  NB_ESSAI=3
2081  # time delay between tentative
2082  DELAI=2
2083
2084  i=0
2085  while [ $i -lt $NB_ESSAI ] ; do
2086    ncdiff $@ > out_rsync 2>&1
2087    status=$?
2088    if [ ${status} -gt 0 ] ; then
2089      IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}"
2090      cat out_rsync
2091      \rm out_rsync
2092      IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2093      sleep $DELAI
2094    else
2095      \rm out_rsync
2096      break
2097    fi
2098    (( i = i + 1 ))
2099  done
2100
2101  if [ ${status} -gt 0 ] ; then
2102    echo "IGCM_sys_ncdiff : ncdiff error"
2103    IGCM_debug_Exit "ncdiff"
2104  fi
2105
2106  IGCM_debug_PopStack "IGCM_sys_ncdiff"
2107}
2108
2109#D-#==================================================
2110#D-function IGCM_sys_ncea
2111#D-* Purpose: encapsulate ncea call so as to manage error code and retry
2112#D-* Examples:
2113#D-
2114function IGCM_sys_ncea {
2115  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
2116  if ( $DEBUG_sys ) ; then
2117    echo "IGCM_sys_ncea :" $@
2118  fi
2119
2120  typeset NB_ESSAI DELAI status i
2121  # number of tentative
2122  NB_ESSAI=3
2123  # time delay between tentative
2124  DELAI=2
2125
2126  i=0
2127  while [ $i -lt $NB_ESSAI ] ; do
2128    ncea $@ > out_rsync 2>&1
2129    status=$?
2130    if [ ${status} -gt 0 ] ; then
2131      IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}"
2132      cat out_rsync
2133      \rm out_rsync
2134      IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2135      sleep $DELAI
2136    else
2137      \rm out_rsync
2138      break
2139    fi
2140    (( i = i + 1 ))
2141  done
2142
2143  if [ ${status} -gt 0 ] ; then
2144    echo "IGCM_sys_ncea : ncea error"
2145    IGCM_debug_Exit "ncea"
2146  fi
2147
2148  IGCM_debug_PopStack "IGCM_sys_ncea"
2149}
2150
2151#D-#==================================================
2152#D-function IGCM_sys_ncecat
2153#D-* Purpose: encapsulate ncecat call so as to manage error code and retry
2154#D-* Examples:
2155#D-
2156function IGCM_sys_ncecat {
2157  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
2158  if ( $DEBUG_sys ) ; then
2159    echo "IGCM_sys_ncecat :" $@
2160  fi
2161
2162  typeset NB_ESSAI DELAI status i
2163  # number of tentative
2164  NB_ESSAI=3
2165  # time delay between tentative
2166  DELAI=2
2167
2168  i=0
2169  while [ $i -lt $NB_ESSAI ] ; do
2170    ncecat $@ > out_rsync 2>&1
2171    status=$?
2172    if [ ${status} -gt 0 ] ; then
2173      IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}"
2174      cat out_rsync
2175      \rm out_rsync
2176      IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2177      sleep $DELAI
2178    else
2179      \rm out_rsync
2180      break
2181    fi
2182    (( i = i + 1 ))
2183  done
2184
2185  if [ ${status} -gt 0 ] ; then
2186    echo "IGCM_sys_ncecat : ncecat error"
2187    IGCM_debug_Exit "ncecat"
2188  fi
2189
2190  IGCM_debug_PopStack "IGCM_sys_ncecat"
2191}
2192
2193#D-#==================================================
2194#D-function IGCM_sys_ncflint
2195#D-* Purpose: encapsulate ncflint call so as to manage error code and retry
2196#D-* Examples:
2197#D-
2198function IGCM_sys_ncflint {
2199  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
2200  if ( $DEBUG_sys ) ; then
2201    echo "IGCM_sys_ncflint :" $@
2202  fi
2203
2204  typeset NB_ESSAI DELAI status i
2205  # number of tentative
2206  NB_ESSAI=3
2207  # time delay between tentative
2208  DELAI=2
2209
2210  i=0
2211  while [ $i -lt $NB_ESSAI ] ; do
2212    ncflint $@ > out_rsync 2>&1
2213    status=$?
2214    if [ ${status} -gt 0 ] ; then
2215      IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}"
2216      cat out_rsync
2217      \rm out_rsync
2218      IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2219      sleep $DELAI
2220    else
2221      \rm out_rsync
2222      break
2223    fi
2224    (( i = i + 1 ))
2225  done
2226
2227  if [ ${status} -gt 0 ] ; then
2228    echo "IGCM_sys_ncflint : ncflint error"
2229    IGCM_debug_Exit "ncflint"
2230  fi
2231
2232  IGCM_debug_PopStack "IGCM_sys_ncflint"
2233}
2234
2235#D-#==================================================
2236#D-function IGCM_sys_ncks
2237#D-* Purpose: encapsulate ncks call so as to manage error code and retry
2238#D-* Examples:
2239#D-
2240function IGCM_sys_ncks {
2241  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
2242  if ( $DEBUG_sys ) ; then
2243    echo "IGCM_sys_ncks :" $@
2244  fi
2245
2246  typeset NB_ESSAI DELAI status i
2247  # number of tentative
2248  NB_ESSAI=3
2249  # time delay between tentative
2250  DELAI=2
2251
2252  i=0
2253  while [ $i -lt $NB_ESSAI ] ; do
2254    ncks $@ > out_rsync 2>&1
2255    status=$?
2256    if [ ${status} -gt 0 ] ; then
2257      IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}"
2258      cat out_rsync
2259      \rm out_rsync
2260      IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2261      sleep $DELAI
2262    else
2263      \rm out_rsync
2264      break
2265    fi
2266    (( i = i + 1 ))
2267  done
2268
2269  if [ ${status} -gt 0 ] ; then
2270    echo "IGCM_sys_ncks : ncks error"
2271    IGCM_debug_Exit "ncks"
2272  fi
2273
2274  IGCM_debug_PopStack "IGCM_sys_ncks"
2275}
2276
2277#D-#==================================================
2278#D-function IGCM_sys_ncpdq
2279#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry
2280#D-* Examples:
2281#D-
2282function IGCM_sys_ncpdq {
2283  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
2284  if ( $DEBUG_sys ) ; then
2285    echo "IGCM_sys_ncpdq :" $@
2286  fi
2287
2288  typeset NB_ESSAI DELAI status i
2289  # number of tentative
2290  NB_ESSAI=3
2291  # time delay between tentative
2292  DELAI=2
2293
2294  i=0
2295  while [ $i -lt $NB_ESSAI ] ; do
2296    ncpdq $@ > out_rsync 2>&1
2297    status=$?
2298    if [ ${status} -gt 0 ] ; then
2299      IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}"
2300      cat out_rsync
2301      \rm out_rsync
2302      IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2303      sleep $DELAI
2304    else
2305      \rm out_rsync
2306      break
2307    fi
2308    (( i = i + 1 ))
2309  done
2310
2311  if [ ${status} -gt 0 ] ; then
2312    echo "IGCM_sys_ncpdq : ncpdq error"
2313    IGCM_debug_Exit "ncpdq"
2314  fi
2315
2316  IGCM_debug_PopStack "IGCM_sys_ncpdq"
2317}
2318
2319#D-#==================================================
2320#D-function IGCM_sys_ncra
2321#D-* Purpose: encapsulate ncra call so as to manage error code and retry
2322#D-* Examples:
2323#D-
2324function IGCM_sys_ncra {
2325  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
2326  if ( $DEBUG_sys ) ; then
2327    echo "IGCM_sys_ncra :" $@
2328  fi
2329
2330  typeset NB_ESSAI DELAI status i
2331  # number of tentative
2332  NB_ESSAI=3
2333  # time delay between tentative
2334  DELAI=2
2335
2336  i=0
2337  while [ $i -lt $NB_ESSAI ] ; do
2338    ncra $@ > out_rsync 2>&1
2339    status=$?
2340    if [ ${status} -gt 0 ] ; then
2341      IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}"
2342      cat out_rsync
2343      \rm out_rsync
2344      IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2345      sleep $DELAI
2346    else
2347      \rm out_rsync
2348      break
2349    fi
2350    (( i = i + 1 ))
2351  done
2352
2353  if [ ${status} -gt 0 ] ; then
2354    echo "IGCM_sys_ncra : ncra error"
2355    IGCM_debug_Exit "ncra"
2356  fi
2357
2358  IGCM_debug_PopStack "IGCM_sys_ncra"
2359}
2360
2361#D-#==================================================
2362#D-function IGCM_sys_ncrcat
2363#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry
2364#D-* Examples:
2365#D-
2366function IGCM_sys_ncrcat {
2367  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
2368  if ( $DEBUG_sys ) ; then
2369    echo "IGCM_sys_ncrcat :" $@
2370  fi
2371
2372  typeset NB_ESSAI DELAI status i lastArg
2373  # number of tentative
2374  NB_ESSAI=3
2375  # time delay between tentative
2376  DELAI=2
2377
2378  i=0
2379  while [ $i -lt $NB_ESSAI ] ; do
2380    ncrcat $@ > out_rsync 2>&1
2381    status=$?
2382    if [ ${status} -gt 0 ] ; then
2383      IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}"
2384      cat out_rsync
2385      \rm out_rsync
2386      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2387      sleep $DELAI
2388    elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" out_rsync )" = "X" ] ; then
2389      IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity"
2390      cat out_rsync
2391      # remove files having corrupted time axis
2392      eval lastArg=\${$#}
2393      IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}"
2394      \rm ${lastArg}
2395      \rm out_rsync
2396      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2397      sleep $DELAI
2398    else
2399      \rm out_rsync
2400      break
2401    fi
2402    (( i = i + 1 ))
2403  done
2404
2405  if [ ${status} -gt 0 ] ; then
2406    echo "IGCM_sys_ncrcat : ncrcat error"
2407    #IGCM_debug_Exit "ncrcat"
2408  fi
2409
2410  IGCM_debug_PopStack "IGCM_sys_ncrcat"
2411}
2412
2413#D-#==================================================
2414#D-function IGCM_sys_ncrename
2415#D-* Purpose: encapsulate ncrename call so as to manage error code and retry
2416#D-* Examples:
2417#D-
2418function IGCM_sys_ncrename {
2419  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
2420  if ( $DEBUG_sys ) ; then
2421    echo "IGCM_sys_ncrename :" $@
2422  fi
2423
2424  typeset NB_ESSAI DELAI status i
2425  # number of tentative
2426  NB_ESSAI=3
2427  # time delay between tentative
2428  DELAI=2
2429
2430  i=0
2431  while [ $i -lt $NB_ESSAI ] ; do
2432    ncrename $@ > out_rsync 2>&1
2433    status=$?
2434    if [ ${status} -gt 0 ] ; then
2435      IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}"
2436      cat out_rsync
2437      \rm out_rsync
2438      IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2439      sleep $DELAI
2440    else
2441      \rm out_rsync
2442      break
2443    fi
2444    (( i = i + 1 ))
2445  done
2446
2447  if [ ${status} -gt 0 ] ; then
2448    echo "IGCM_sys_ncrename : ncrename error"
2449    IGCM_debug_Exit "ncrename"
2450  fi
2451
2452  IGCM_debug_PopStack "IGCM_sys_ncrename"
2453}
2454
2455#D-#==================================================
2456#D-function IGCM_sys_ncwa
2457#D-* Purpose: encapsulate ncwa call so as to manage error code and retry
2458#D-* Examples:
2459#D-
2460function IGCM_sys_ncwa {
2461  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
2462  if ( $DEBUG_sys ) ; then
2463    echo "IGCM_sys_ncwa :" $@
2464  fi
2465
2466  typeset NB_ESSAI DELAI status i
2467  # number of tentative
2468  NB_ESSAI=3
2469  # time delay between tentative
2470  DELAI=2
2471
2472  i=0
2473  while [ $i -lt $NB_ESSAI ] ; do
2474    ncwa $@ > out_rsync 2>&1
2475    status=$?
2476    if [ ${status} -gt 0 ] ; then
2477      IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}"
2478      cat out_rsync
2479      \rm out_rsync
2480      IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2481      sleep $DELAI
2482    else
2483      \rm out_rsync
2484      break
2485    fi
2486    (( i = i + 1 ))
2487  done
2488
2489  if [ ${status} -gt 0 ] ; then
2490    echo "IGCM_sys_ncwa : ncwa error"
2491    IGCM_debug_Exit "ncwa"
2492  fi
2493
2494  IGCM_debug_PopStack "IGCM_sys_ncwa"
2495}
2496
2497##############################################################
2498# CDO OPERATOR
2499
2500#D-#==================================================
2501#D-function IGCM_sys_cdo
2502#D-* Purpose: encapsulate cdo call so as to manage error code and retry
2503#D-* Examples:
2504#D-
2505function IGCM_sys_cdo {
2506  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
2507  if ( $DEBUG_sys ) ; then
2508    echo "IGCM_sys_cdo :" $@
2509  fi
2510
2511  typeset status
2512
2513  \cdo $@ > out_rsync 2>&1
2514  status=$?
2515  if [ ${status} -gt 0 ] ; then
2516    echo "IGCM_sys_cdo : error code ${status}"
2517    cat out_rsync
2518    \rm out_rsync
2519    IGCM_debug_PopStack "IGCM_sys_cdo"
2520    return 1
2521  else
2522    IGCM_debug_PopStack "IGCM_sys_cdo"
2523    return 0
2524  fi
2525
2526  IGCM_debug_PopStack "IGCM_sys_cdo"
2527}
Note: See TracBrowser for help on using the repository browser.