#-Q- cesium #!/bin/ksh #-Q- cesium ###################### #-Q- cesium ## CESIUM CEA ## #-Q- cesium ###################### #-Q- cesium #MSUB -r PACKDEBUG # 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- curie ###################### #-Q- curie ## CURIE TGCC/CEA ## #-Q- curie ###################### #-Q- curie #MSUB -r PACKDEBUG # Nom du job #-Q- curie #MSUB -eo #-Q- curie #MSUB -n 1 # Reservation du processus #-Q- curie #MSUB -T 86400 # Limite de temps elapsed du job #-Q- curie #MSUB -E '--no-requeue' #-Q- platine #!/usr/bin/ksh #-Q- platine ################### #-Q- platine ## PLATINE CEA ## #-Q- platine ################### #-Q- platine #BSUB -J PACKDEBUG # 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 = PACKDEBUG #-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 ; $DateEnd ; $PeriodPack ; $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 = PACKDEBUG #-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 ; $DateEnd ; $PeriodPack ; $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 = PACKDEBUG #-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 ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER #-Q- ulam # @ queue #-Q- sx8mercure #!/bin/ksh #-Q- sx8mercure ###################### #-Q- sx8mercure ## SX8MERCURE CEA ## #-Q- sx8mercure ###################### #-Q- sx8mercure #PBS -N PACKDEBUG # 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- sx8mercure #PBS -r n #-Q- sx9mercure #!/bin/ksh #-Q- sx9mercure ###################### #-Q- sx9mercure ## SX9MERCURE CCRT ## #-Q- sx9mercure ###################### #-Q- sx9mercure #PBS -N PACKDEBUG # Nom du job #-Q- sx9mercure #PBS -j o # regroupement des stdout et stderr #-Q- sx9mercure #PBS -S /usr/bin/ksh # shell de soumission #-Q- sx9mercure #PBS -l memsz_job=1gb # Limite memoire a 1 Go #-Q- sx9mercure #PBS -l elapstim_req=24:00:00 # Limite temps a 1 heures #-Q- sx9mercure #PBS -q scalaire #-Q- sx9mercure #PBS -r n #-Q- titane #!/bin/ksh #-Q- titane ###################### #-Q- titane ## TITANE CEA ## #-Q- titane ###################### #-Q- titane #MSUB -r PACKDEBUG # 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- titane #MSUB -E '-rn' #-Q- lxiv8 ###################### #-Q- lxiv8 ## OBELIX LSCE ## #-Q- lxiv8 ###################### #-Q- lxiv8 #PBS -N PACKDEBUG #-Q- lxiv8 #PBS -m a #-Q- lxiv8 #PBS -j oe #-Q- lxiv8 #PBS -q medium #-Q- lxiv8 #PBS -o PACKDEBUG.$$ #-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- Path to libIGCM #D- Default : value from AA_job if any # WARNING For StandAlone use : To run this script on some machine (ulam and cesium) # WARNING you must check MirrorlibIGCM variable in sys library. # WARNING If this variable is true, you must use libIGCM_POST path instead # WARNING of your running libIGCM directory. libIGCM=${libIGCM:=::modipsl::/libIGCM} #-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer. MASTER=${MASTER:=mercure|titane|brodie|vargas} #D- Flag to determine begin date for restart pack #D- Default : value from AA_job if any DateBegin=${DateBegin:=20000101} #D- Flag to determine end date for restart pack #D- Default : value from AA_job if any DateEnd=${DateEnd:=20691231} #D- Flag to determine pack period #D- Default : value from AA_job if any PeriodPack=${PeriodPack:=10Y} #D- Uncomment to run interactively #D- For testing purpose, will be remove #SUBMIT_DIR=${PWD} #RUN_DIR_PATH=${SCRATCHDIR}/Pack_Test #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} #D- Keep following comments for now. Will be remove. #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 # $2=PeriodPack 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} IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH} IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card ${RUN_DIR_PATH} IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP ${RUN_DIR_PATH} IGCM_sys_Get_Master ${SUBMIT_DIR}/POST ${RUN_DIR_PATH} fi #==================================================== # First of all # # Read config.card 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 # IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Ensemble typeset option for option in ${config_Ensemble[*]} ; do IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Ensemble ${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 IGCM_debug_PrintVariables 3 config_Ensemble_EnsembleName IGCM_debug_PrintVariables 3 config_Ensemble_EnsembleDate echo #==================================================== # Prepare environment #R_SAVE : Job output storage directory #R_BUFR : Job output buffered directory #STORE_DEBUG : Where we store tar files if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName} R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName} else 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} fi else if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName} R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName} else R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName} fi fi IGCM_sys_TestDirArchive ${R_SAVE} [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" #STORE_DEBUG=/ccc/store/cont003/dsm/p86denv/.../DEBUG STORE_DEBUG=${R_SAVE}/DEBUG IGCM_sys_MkdirArchive ${STORE_DEBUG} #cd ${STORE_DEBUG} #rm -f * # Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure) JobName=${config_UserChoices_JobName} echo $JobName $DateBegin $DateEnd # Clear txt file lists rm -f ${RUN_DIR}/liste_debug_files.txt rm -f ${RUN_DIR}/liste_out_files.txt rm -f ${RUN_DIR}/new_liste_debug_files.txt rm -f ${RUN_DIR}/liste_pack_*.txt # Create sorted debug list to work with find ${R_BUFR}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt # Rename debug files we will work with using symlinks. use ???_ prefix ie NF-2 #gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt # Add out_ : output of execution files find ${R_BUFR}/Out -type f -name '*out_*' | sort >> ${RUN_DIR}/liste_out_files.txt # Rename out files we will work with using symlinks. use Out_ prefix ie NF-1 gawk -F/ '{dest_name=$(NF-1)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_out_files.txt # List renamed debug files. Exclude Job_xxx files. find ${RUN_DIR} -maxdepth 1 -mindepth 1 -name "???_*${JobName}*" -ls | sort -k 11 > ${RUN_DIR}/new_liste_debug_files.txt # ------------------------------------------------------------------ # Test if all was right before proceeding further # ------------------------------------------------------------------ IGCM_debug_Verif_Exit_Post # Init loop date_begin_pack=${DateBegin} date_end_simulation=${DateEnd} 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 DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack} ) date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) ) for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_debug_files.txt ); do extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) 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} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt echo $( readlink ${file} ) >> ${RUN_DIR}/liste_remove_pack_${date_begin_pack}_${date_end_pack}.txt # Will not work. Need to find a better ordering. # elif [ ${date_file} -ge ${date_end_pack} ] ; then # break fi done # Create tar files IGCM_debug_Print 1 "Tar ongoing" 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 # Save it IGCM_sys_Put_Out ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar ${STORE_DEBUG} # Clean it IGCM_sys_Rm ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar # Clean links cat ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt | xargs rm # Clean files links pointed to cat ${RUN_DIR}/liste_remove_pack_${date_begin_pack}_${date_end_pack}.txt | xargs rm # Save the list of files that has been pack (tar) #mv ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt ${STORE_DEBUG} IGCM_debug_Print 1 "Tar and cleaning done" (( number_pack = number_pack + 1 )) # Add 1 day to date_end_pack to have the new date_begin_pack date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) done # Clean RUN_DIR_PATH (necessary for cesium and titane only) IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH} date