#-Q- cesium #!/bin/ksh #-Q- cesium ###################### #-Q- cesium ## CESIUM CEA ## #-Q- cesium ###################### #-Q- cesium #MSUB -r PACKRESTART # Nom du job #-Q- cesium #MSUB -N 1 # Reservation du noeud #-Q- cesium #MSUB -n 1 # Reservation du processus #-Q- cesium #MSUB -T 86400 # Limite de temps elapsed du job #-Q- cesium #MSUB -E "-j o" #-Q- cesium #MSUB -E "-S /bin/ksh" #-Q- platine #!/usr/bin/ksh #-Q- platine ################### #-Q- platine ## PLATINE CEA ## #-Q- platine ################### #-Q- platine #BSUB -J PACKRESTART # Nom du job #-Q- platine #BSUB -N # message a la fin du job #-Q- platine #BSUB -n 1 # reservation des processeurs pour le job #-Q- platine #BSUB -W 4:00 # Limite temps #-Q- platine #BSUB -q post # Passage en queue post #-Q- platine #BSUB -L /bin/ksh #-Q- sx8brodie #!/bin/ksh #-Q- sx8brodie ####################### #-Q- sx8brodie ## SX8BRODIE IDRIS ## #-Q- sx8brodie ####################### #-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss #-Q- sx8brodie # @ wall_clock_limit = 10:00:00 #-Q- sx8brodie # Nom du travail LoadLeveler #-Q- sx8brodie # @ job_name = PACKRESTART #-Q- sx8brodie # Fichier de sortie standard du travail #-Q- sx8brodie # @ output = $(job_name).$(jobid) #-Q- sx8brodie # Fichier de sortie d'erreur du travail #-Q- sx8brodie # @ error = $(job_name).$(jobid) #-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) #-Q- sx8brodie # @ notification = error #-Q- sx8brodie # @ environment = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $StandAlone ; $MASTER #-Q- sx8brodie # @ queue #-Q- aix6 #!/bin/ksh #-Q- aix6 ####################### #-Q- aix6 ## VARGAS IDRIS ## #-Q- aix6 ####################### #-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss #-Q- aix6 # @ wall_clock_limit = 10:00:00 #-Q- aix6 # Nom du travail LoadLeveler #-Q- aix6 # @ job_name = PACKRESTART #-Q- aix6 # Fichier de sortie standard du travail #-Q- aix6 # @ output = $(job_name).$(jobid) #-Q- aix6 # Fichier de sortie d'erreur du travail #-Q- aix6 # @ error = $(job_name).$(jobid) #-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) #-Q- aix6 # @ notification = error #-Q- aix6 # @ environment = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $StandAlone ; $MASTER #-Q- aix6 # @ queue #-Q- ulam #!/bin/ksh #-Q- ulam ####################### #-Q- ulam ## VARGAS IDRIS ## #-Q- ulam ####################### #-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss #-Q- ulam # @ wall_clock_limit = 10:00:00 #-Q- ulam # Nom du travail LoadLeveler #-Q- ulam # @ job_name = PACKRESTART #-Q- ulam # Fichier de sortie standard du travail #-Q- ulam # @ output = $(job_name).$(jobid) #-Q- ulam # Fichier de sortie d'erreur du travail #-Q- ulam # @ error = $(job_name).$(jobid) #-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) #-Q- ulam # @ notification = error #-Q- ulam # @ environment = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $StandAlone ; $MASTER #-Q- ulam # @ queue #-Q- sx8mercure #!/bin/ksh #-Q- sx8mercure ###################### #-Q- sx8mercure ## SX8MERCURE CEA ## #-Q- sx8mercure ###################### #-Q- sx8mercure #PBS -N PACKRESTART # Nom du job #-Q- sx8mercure #PBS -j o # regroupement des stdout et stderr #-Q- sx8mercure #PBS -S /usr/bin/ksh # shell de soumission #-Q- sx8mercure #PBS -l memsz_job=1gb # Limite memoire a 1 Go #-Q- sx8mercure #PBS -l cputim_job=24:00:00 # Limite temps a 1 heures #-Q- sx8mercure #PBS -q scalaire #-Q- sx9mercure #!/bin/ksh #-Q- sx9mercure ###################### #-Q- sx9mercure ## CESIUM CEA ## #-Q- sx9mercure ###################### #-Q- sx9mercure #MSUB -r PACKRESTART # Nom du job #-Q- sx9mercure #MSUB -N 1 # Reservation du noeud #-Q- sx9mercure #MSUB -n 1 # Reservation du processus #-Q- sx9mercure #MSUB -T 86400 # Limite de temps elapsed du job #-Q- sx9mercure #MSUB -E "-j o" #-Q- sx9mercure #MSUB -E "-S /bin/ksh" #-Q- titane #!/bin/ksh #-Q- titane ###################### #-Q- titane ## TITANE CEA ## #-Q- titane ###################### #-Q- titane #MSUB -r PACKRESTART # Nom du job #-Q- titane #MSUB -eo #-Q- titane #MSUB -n 1 # Reservation du processus #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job #-Q- titane #MSUB -q mono #-Q- lxiv8 ###################### #-Q- lxiv8 ## OBELIX LSCE ## #-Q- lxiv8 ###################### #-Q- lxiv8 #PBS -N PACKRESTART #-Q- lxiv8 #PBS -m a #-Q- lxiv8 #PBS -j oe #-Q- lxiv8 #PBS -q medium #-Q- lxiv8 #PBS -o PACKRESTART.$$ #-Q- lxiv8 #PBS -S /bin/ksh #-Q- default #!/bin/ksh #-Q- default ################## #-Q- default ## DEFAULT HOST ## #-Q- default ################## #************************************************************** # Author: Sebastien Denvil # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr # $Revision:: $ Revision of last commit # $Author:: $ Author of last commit # $Date:: $ Date of last commit # IPSL (2006) # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC # #************************************************************** #set -eu #set -vx date ######################################################################## #D- Flag to determine if this job in a standalone mode #D- Default : value from AA_job if any StandAlone=${StandAlone:=true} #D- Flag to determine begin date for restart pack #D- Default : value from AA_job if any DateBegin=20000101 #D- Flag to determine end date for restart pack #D- Default : value from AA_job if any DateEnd=20691231 #D- Flag to determine pack period #D- Default : value from AA_job if any period_pack=${period_pack:=10Y} SUBMIT_DIR=${PWD} RUN_DIR_PATH=/scratch/cont003/p86denv/Pack_Test #-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer. MASTER=${MASTER:=mercure|titane|brodie|vargas} #D- Low level debug : to bypass lib test checks and stack construction #D- Default : value from AA_job if any libIGCM=${libIGCM:=/work/cont003/p86denv/PARA_XEON_CM5_IPSLCM5A.16122011_39L/modipsl/libIGCM} # WARNING for StandAlone use : To run this script on some machine, # you must check MirrorlibIGCM variable in sys library. # If this variable is true, you must use libIGCM_POST path instead # of your running libIGCM directory. #D- Increased verbosity (1, 2, 3) #D- Default : value from AA_job if any Verbosity=${Verbosity:=3} #D- Low level debug : to bypass lib test checks and stack construction #D- Default : value from AA_job if any DEBUG_debug=${DEBUG_debug:=false} #on veut archiver les fichiers restart #Dans le cadre du demenagement ils seront renommes #ATM/Restart/****.nc #OCE/Restart/****.nc #... #sous la forme #RESTART/ATM_****.nc #RESTART/OCE_****.nc #Attention de bien conserver les dates d'origines # #Dans le cadre de la production nouvelle chaine #ils auront directement le bon nom # #On veut egalement que l'archive soit par periode de temps # cette periode est definie par la taille du pack donc connue # en entree du script (1M, 1Y, 5Y, 10Y etc...) # # $1= PATH/config_card d'une simulation avec # TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd/PATH_SIMUL # $2=period_pack en M/m ou Y/y ######################################################################## . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ( ${DEBUG_debug} ) && IGCM_debug_Check . ${libIGCM}/libIGCM_card/libIGCM_card.ksh ( ${DEBUG_debug} ) && IGCM_card_Check . ${libIGCM}/libIGCM_date/libIGCM_date.ksh ( ${DEBUG_debug} ) && IGCM_date_Check #------- . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh . ${libIGCM}/libIGCM_post/libIGCM_post.ksh ######################################################################## #set -vx RUN_DIR=${RUN_DIR_PATH} IGCM_sys_MkdirWork ${RUN_DIR} IGCM_sys_Cd ${RUN_DIR} # ------------------------------------------------------------------ # Test if all was right before proceeding further # ------------------------------------------------------------------ IGCM_debug_Verif_Exit_Post if [ ${StandAlone} = true ] ; then CARD_DIR=${SUBMIT_DIR} else CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} ) IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH} fi # # First of all # #### 0- lecture de config.card #### on veut les renseignements suivants : #### JobName, PATH_SIMUL, DateBegin et DateEnd IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card UserChoices typeset option for option in ${config_UserChoices[*]} ; do IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option} done # echo IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" IGCM_debug_PrintVariables 3 config_UserChoices_JobName IGCM_debug_PrintVariables 3 config_UserChoices_LongName IGCM_debug_PrintVariables 3 config_UserChoices_TagName IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength echo #==================================================== #R_SAVE : Job output storage directory #R_BUFR : Job output buffered directory if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} else R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName} fi IGCM_sys_TestDirArchive ${R_SAVE} [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" #### Preparation de l'environnement # repertoire dans lequel seront crees les archives #STORE_RESTART=${R_SAVE}/RESTART #IGCM_sys_MkdirArchive ${STORE_RESTART} STORE_RESTART=/scratch/cont003/p86denv/Pack_Test/RESTART mkdir -p ${STORE_RESTART} #### 0- lecture de config.card #### on veut les renseignements suivants : #### JobName, PATH_SIMUL, DateBegin et DateEnd JobName=${config_UserChoices_JobName} #DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) #DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) PATH_SIMUL=${R_BUFR} echo $JobName $PATH_SIMUL $DateBegin $DateEnd #### 1- renommer les fichiers ###### #cd ${STORE_RESTART} #rm -rf * # On les copie sur le scratchdir en changeant le nom et conservant la date # Clear txt file lists rm -f ${RUN_DIR}/liste_restart_files.txt rm -f ${RUN_DIR}/new_liste_restart_files.txt rm -f ${RUN_DIR}/liste_pack_*.txt # Create sorted restart list to work with find ${PATH_SIMUL}/*/Restart -name "*nc" | sort >> ${RUN_DIR}/liste_restart_files.txt #sort ${RUN_DIR}/liste_restart_files.txt > ${RUN_DIR}/tmp.txt #mv ${RUN_DIR}/tmp.txt ${RUN_DIR}/liste_restart_files.txt ###cat ${RUN_DIR}/liste_restart_files.txt | xargs dmget # Rename restart files we will work with #gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_restart_files.txt gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_restart_files.txt # List renamed restart files ls -l ${RUN_DIR}/*.nc > ${RUN_DIR}/new_liste_restart_files.txt ### 2- creer les listes de fichiers par periode #### ### 2.1- dechiffrer period_pack et le separer en year et month ### case ${period_pack} in *Y|*y) periodpackinyear=$( echo ${period_pack} | sed -e 's/[yY]//' ) periodpackinmonth=0 ;; *M|*m) periodpackinyear=0 periodpackinmonth=$( echo ${period_pack} | sed -e 's/[mM]//' ) ;; *) echo "period_pack doit etre en mois ou annees" IGCM_debug_Exit "period pack unit" ;; esac ### 2.2- extraire l'annee et le mois de DateBegin ### date_begin=${DateBegin} date_end=${DateEnd} IGCM_date_GetYearMonth ${date_begin} year_begin month_begin IGCM_date_GetYearMonth ${date_end} year_end month_end # ------------------------------------------------------------------ # Test if all was right before proceeding further # ------------------------------------------------------------------ IGCM_debug_Verif_Exit_Post ### 2.3- creation des listes ### date_begin_pack=${date_begin} month_begin_pack=${month_begin} year_begin_pack=${year_begin} date_end_simulation=${date_end} number_pack=1 IGCM_debug_PrintVariables 3 date_begin_pack IGCM_debug_PrintVariables 3 date_end_simulation while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do IGCM_debug_PrintVariables 3 number_pack (( month_end_pack = month_begin_pack + periodpackinmonth )) (( add_year = ${month_end_pack} / 13 )) if [ ${month_end_pack} -ge 13 ] ; then (( month_end_pack = ${month_end_pack} % 12 )) fi (( year_end_pack = year_begin_pack + periodpackinyear + add_year )) date_end_pack=${year_end_pack}$( printf "%02i\n" ${month_end_pack} )01 for file in $( gawk '{print $9}' ${RUN_DIR}/new_liste_restart_files.txt ); do extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_//" ) date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt # elif [ ${date_file} -ge ${date_end_pack} ] ; then # break fi done month_begin_pack=${month_end_pack} year_begin_pack=${year_end_pack} date_begin_pack=${year_begin_pack}$( printf "%02i\n" ${month_begin_pack} )01 tar -cvf ${STORE_RESTART}/restart_pack_${number_pack}.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt cat ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm mv ${RUN_DIR}/liste_pack_${number_pack}.txt ${STORE_RESTART} (( number_pack = number_pack + 1 )) done