source: trunk/libIGCM/AA_pack_debug @ 1468

Last change on this file since 1468 was 1468, checked in by mafoipsl, 6 years ago

On curie : set output files for all jobs.

On irene :

  • set output files for all jobs like curie
  • add the possibility to use xlarge nodes (for free) for post-processing or skylake nodes
  • add a question to set project used for post-processing and delete -A option in libIGCM_sys_irene
  • display only available projects for computing or post-processing on irene
  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Revision Author Date
File size: 11.2 KB
Line 
1#-Q- curie ######################
2#-Q- curie ## CURIE   TGCC/CEA ##
3#-Q- curie ######################
4#-Q- curie #MSUB -r PACKDEBUG      # Nom du job
5#-Q- curie #MSUB -o PACKDEBUG.out_%I
6#-Q- curie #MSUB -e PACKDEBUG.out_%I
7#-Q- curie #MSUB -n 1              # Reservation du processus
8#-Q- curie #MSUB -T 3600          # Limite de temps elapsed du job
9#-Q- curie #MSUB -q ::default_node::
10#-Q- curie #MSUB -c ::default_core::
11#-Q- curie #MSUB -Q normal
12#-Q- curie #MSUB -A ::default_project::
13#-Q- curie set +x
14#-Q- irene ######################
15#-Q- irene ## IRENE   TGCC/CEA ##
16#-Q- irene ######################
17#-Q- irene #MSUB -r PACKDEBUG     # Job name
18#-Q- irene #MSUB -o PACKDEBUG.out_%I
19#-Q- irene #MSUB -e PACKDEBUG.out_%I
20#-Q- irene #MSUB -n 1             # Number of cores
21#-Q- irene #MSUB -T 3600          # Maximum elapsed time
22#-Q- irene #MSUB -q ::default_node::
23#-Q- irene #MSUB -c ::default_core::
24#-Q- irene #MSUB -Q normal
25#-Q- irene #MSUB -A ::default_post_project::
26#-Q- irene #MSUB -m store,work,scratch
27#-Q- irene set +x
28#-Q- ada #!/bin/ksh
29#-Q- ada #######################
30#-Q- ada ## ADA         IDRIS ##
31#-Q- ada #######################
32#-Q- ada # @ job_type = mpich
33#-Q- ada # @ requirements = (Feature == "prepost")
34#-Q- ada # Temps Elapsed max. d'une requete hh:mm:ss
35#-Q- ada # @ wall_clock_limit = 10:00:00
36#-Q- ada # Nom du travail LoadLeveler
37#-Q- ada # @ job_name   = PACKDEBUG
38#-Q- ada # Fichier de sortie standard du travail
39#-Q- ada # @ output     = $(job_name).$(jobid)
40#-Q- ada # Fichier de sortie d'erreur du travail
41#-Q- ada # @ error      =  $(job_name).$(jobid)
42#-Q- ada # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
43#-Q- ada # @ notification = error
44#-Q- ada # @ environment  = $DEBUG_debug ; $BigBrother ; $postProcessingStopLevel ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $POST_DIR ; $Script_Post_Output ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER ; wall_clock_limit=$(wall_clock_limit)
45#-Q- ada # @ queue
46#-Q- lxiv8 ######################
47#-Q- lxiv8 ## OBELIX      LSCE ##
48#-Q- lxiv8 ######################
49#-Q- lxiv8 #PBS -N PACKDEBUG
50#-Q- lxiv8 #PBS -m a
51#-Q- lxiv8 #PBS -j oe
52#-Q- lxiv8 #PBS -q medium
53#-Q- lxiv8 #PBS -o PACKDEBUG.$$
54#-Q- lxiv8 #PBS -S /bin/ksh
55#-Q- ifort_CICLAD ######################
56#-Q- ifort_CICLAD ##   CICLAD    IPSL ##
57#-Q- ifort_CICLAD ######################
58#-Q- ifort_CICLAD #PBS -N PACKDEBUG
59#-Q- ifort_CICLAD #PBS -m a
60#-Q- ifort_CICLAD #PBS -j oe
61#-Q- ifort_CICLAD #PBS -q std
62#-Q- ifort_CICLAD #PBS -S /bin/ksh
63#-Q- default #!/bin/ksh
64#-Q- default ##################
65#-Q- default ## DEFAULT HOST ##
66#-Q- default ##################
67
68#**************************************************************
69# Author: Sebastien Denvil
70# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
71# $Revision::                                          $ Revision of last commit
72# $Author::                                            $ Author of last commit
73# $Date::                                              $ Date of last commit
74# IPSL (2006)
75#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
76#
77#**************************************************************
78
79#set -eu
80#set -vx
81
82date
83
84#D- Task type DO NOT CHANGE (computing, post-processing or checking)
85TaskType=post-processing
86
87########################################################################
88
89#D- Flag to determine if this job in a standalone mode
90#D- Default : value from AA_job if any
91StandAlone=${StandAlone:=true}
92
93#D- Path to libIGCM
94#D- Default : value from AA_job if any
95# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
96# WARNING you must check MirrorlibIGCM variable in sys library.
97# WARNING If this variable is true, you must use libIGCM_POST path instead
98# WARNING of your running libIGCM directory.
99libIGCM=${libIGCM:=::modipsl::/libIGCM}
100
101#-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
102MASTER=${MASTER:=ada|curie}
103
104#D- Flag to determine begin date for restart pack
105#D- Default : value from AA_job if any
106DateBegin=${DateBegin:=20000101}
107
108#D- Flag to determine end date for restart pack
109#D- Default : value from AA_job if any
110DateEnd=${DateEnd:=20691231}
111
112#D- Flag to determine pack period
113#D- Default : value from AA_job if any
114PeriodPack=${PeriodPack:=10Y}
115
116#D- Uncomment to run interactively
117#D- For testing purpose, will be remove
118#SUBMIT_DIR=${PWD}
119#RUN_DIR_PATH=${SCRATCHDIR}/Pack_Test
120
121#D- Increased verbosity (1, 2, 3)
122#D- Default : value from AA_job if any
123Verbosity=${Verbosity:=3}
124
125#D- Low level debug : to bypass lib test checks and stack construction
126#D- Default : value from AA_job if any
127DEBUG_debug=${DEBUG_debug:=false}
128
129#D- Keep following comments for now. Will be remove.
130
131#on veut archiver les fichiers restart
132#Dans le cadre du demenagement ils seront renommes
133#ATM/Restart/****.nc
134#OCE/Restart/****.nc
135#...
136#sous la forme
137#RESTART/ATM_****.nc
138#RESTART/OCE_****.nc
139#Attention de bien conserver les dates d'origines
140#
141#Dans le cadre de la production nouvelle chaine
142#ils auront directement le bon nom
143#
144#On veut egalement que l'archive soit par periode de temps
145# cette periode est definie par la taille du pack donc connue
146# en entree du script (1M, 1Y, 5Y, 10Y etc...)
147#
148# $1= PATH/config_card d'une simulation avec
149# TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd
150# $2=PeriodPack en M/m ou Y/y
151
152########################################################################
153
154. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
155. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
156. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
157#-------
158. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
159. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
160. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
161#-------
162RUN_DIR=${RUN_DIR_PATH}
163IGCM_sys_MkdirWork ${RUN_DIR}
164IGCM_sys_Cd ${RUN_DIR}
165#-------
166( ${DEBUG_debug} ) && IGCM_debug_Check
167( ${DEBUG_debug} ) && IGCM_card_Check
168( ${DEBUG_debug} ) && IGCM_date_Check
169
170########################################################################
171
172#set -vx
173
174# ------------------------------------------------------------------
175# Test if all was right before proceeding further
176# ------------------------------------------------------------------
177IGCM_debug_Verif_Exit
178
179if [ ${StandAlone} = true ] ; then
180    CARD_DIR=${SUBMIT_DIR}
181else
182    CARD_DIR=${RUN_DIR_PATH}
183    IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH}
184    IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card    ${RUN_DIR_PATH}
185    IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP        ${RUN_DIR_PATH}
186    IGCM_sys_Get_Master ${SUBMIT_DIR}/POST        ${RUN_DIR_PATH}
187fi
188
189#==================================
190# First of all
191#
192# Read libIGCM compatibility version in config.card
193# Read UserChoices section
194# Read Ensemble section
195# Read Post section
196# Define all netcdf output directories
197#==================================
198IGCM_config_CommonConfiguration ${CARD_DIR}/config.card
199
200# ------------------------------------------------------------------
201# Activate BigBrother so as to supervise this job
202# ------------------------------------------------------------------
203IGCM_debug_BigBro_Initialize
204
205#==================================
206# Test and set up directories
207#==================================
208IGCM_sys_TestDirArchive ${R_SAVE}
209[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
210
211STORE_DEBUG=${R_SAVE}/DEBUG
212IGCM_sys_MkdirArchive ${STORE_DEBUG}
213
214# Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure)
215JobName=${config_UserChoices_JobName}
216echo $JobName $DateBegin $DateEnd
217
218# Clear txt file lists
219rm -f ${RUN_DIR}/liste_debug_files.txt
220rm -f ${RUN_DIR}/liste_out_files.txt
221rm -f ${RUN_DIR}/new_liste_debug_files.txt
222rm -f ${RUN_DIR}/liste_pack_*.txt
223
224# Create sorted debug list to work with
225find ${R_BUFR}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt
226
227# Rename debug files we will work with using symlinks. use ???_ prefix ie NF-2
228#gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt
229gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt
230
231# Add out_ : output of execution files
232find ${R_BUFR}/Out -type f -name '*out_*' | sort >> ${RUN_DIR}/liste_out_files.txt
233
234# Rename out files we will work with using symlinks. use Out_ prefix ie NF-1
235gawk -F/ '{dest_name=$(NF-1)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_out_files.txt
236
237# List renamed debug files. Exclude Job_xxx files.
238find ${RUN_DIR} -maxdepth 1 -mindepth 1 -name "???_*${JobName}*" -ls | sort -k 11 > ${RUN_DIR}/new_liste_debug_files.txt
239
240# ------------------------------------------------------------------
241# Test if all was right before proceeding further
242# ------------------------------------------------------------------
243IGCM_debug_Verif_Exit
244
245# Init loop
246date_begin_pack=${DateBegin}
247date_end_simulation=${DateEnd}
248number_pack=1
249
250IGCM_debug_PrintVariables 3 date_begin_pack
251IGCM_debug_PrintVariables 3 date_end_simulation
252
253while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do
254
255  IGCM_debug_PrintVariables 3 number_pack
256
257  DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack} )
258  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) )
259
260  for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_debug_files.txt ); do
261    extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_[0-9]*_//" )
262    date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
263#   echo pack n°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack}
264    if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then
265        echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt
266        echo $( readlink ${file} ) >> ${RUN_DIR}/liste_remove_pack_${date_begin_pack}_${date_end_pack}.txt
267    fi
268  done
269
270  # Create tar files
271  IGCM_debug_Print 1 "Tar ongoing"
272  tar -cvf ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar --dereference --files-from ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt
273  # Save it
274  IGCM_sys_Put_Out ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar ${STORE_DEBUG}
275  # Clean it
276  IGCM_sys_Rm ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar
277  # ------------------------------------------------------------------
278  # Test if all was right before proceeding cleaning
279  # ------------------------------------------------------------------
280  IGCM_debug_Verif_Exit
281  # Clean links
282  cat ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt | xargs rm
283  # Clean files links pointed to
284  cat ${RUN_DIR}/liste_remove_pack_${date_begin_pack}_${date_end_pack}.txt | xargs rm
285  # Save the list of files that has been pack (tar)
286  #mv ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt ${STORE_DEBUG}
287  IGCM_debug_Print 1 "Tar and cleaning done"
288
289  (( number_pack = number_pack + 1 ))
290
291  # Add 1 day to date_end_pack to have the new date_begin_pack
292  date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 )
293
294done
295
296# Clean RUN_DIR_PATH (necessary for cesium and titane only)
297IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
298
299# ------------------------------------------------------------------
300# Finalize BigBrother to inform that the jobs end
301# ------------------------------------------------------------------
302IGCM_debug_BigBro_Finalize
303
304date
Note: See TracBrowser for help on using the repository browser.