Ignore:
Timestamp:
03/01/11 09:48:22 (13 years ago)
Author:
mmaipsl
Message:

Add documentation.
Add a chain of jobs for long simulation treatments :
1) You must read 'Documentation' paragraph below to parameter the chain of jobs for
specific schedulers.
2) This script must only be used in a libIGCM directory (but submit from a CONFIG directory).
3) Default parameters in this job are given for mercure CCRT X64 frontend.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/AA_stomate_flux_correction

    • Property svn:keywords set to Date Author Revision
    r1310 r1322  
    3232#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) 
    3333#-Q- sx8brodie # @ notification = error 
     34#-Q- sx8brodie # @ environment  = $CURRENT_LOOP ; $imin ; $imax 
    3435#-Q- sx8brodie # @ queue 
    3536#-Q- aix6 #!/bin/ksh 
     
    4748#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) 
    4849#-Q- aix6 # @ notification = error 
     50#-Q- aix6 # @ environment  = $CURRENT_LOOP ; $imin ; $imax 
    4951#-Q- aix6 # @ queue 
    5052#-Q- ulam #!/bin/ksh 
     
    6264#-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) 
    6365#-Q- ulam # @ notification = error 
     66#-Q- ulam # @ environment  = $CURRENT_LOOP ; $imin ; $imax 
    6467#-Q- ulam # @ queue 
    6568#-Q- sx8mercure #!/bin/ksh 
     69#-Q- sx9mercure ######################### 
     70#-Q- sx9mercure ## CESIUM FOR SX9  CEA ## 
     71#-Q- sx9mercure ######################### 
     72#-Q- sx9mercure #MSUB -r SBGcorr             # Nom du job                 
     73#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud 
     74#-Q- sx9mercure #MSUB -n 1              # Reservation du processus 
     75#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job 
     76#-Q- sx9mercure #MSUB -E "-j o" 
     77#-Q- sx9mercure #MSUB -E "-S /bin/ksh" 
    6678#-Q- sx8mercure ###################### 
    6779#-Q- sx8mercure ## SX8MERCURE   CEA ## 
     
    108120 
    109121#************************************************************** 
    110 # Author: Sebastien Denvil 
    111 # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr 
    112 # $Revision:: 414                                      $ Revision of last commit 
    113 # $Author:: sdipsl                                     $ Author of last commit 
    114 # $Date:: 2011-01-31 10:38:05 +0100 (lun. 31 janv. 201#$ Date of last commit 
     122# Author: Martial Mancip 
     123# Contact: Martial.Mancip__at__ipsl.jussieu.fr 
     124# $Revision::                                          $ Revision of last commit 
     125# $Author::                                            $ Author of last commit 
     126# $Date::                                              $ Date of last commit 
    115127# IPSL (2006) 
    116128#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC 
     
    118130#************************************************************** 
    119131 
    120 #set -eu 
    121 #set -vx 
     132 
     133#************************************************************** 
     134# usage : 
     135# 
     136#  This script is only used for correction of stomate_ipcc_history files created  
     137# with orchidee_1_9_5 version of ORCHIDEE model checkouted before 01/0    
     138# Version of ORCHIDEE/src_stomate/stomate_lpj.f90 before CVS 1.26 had a bug 
     139# that give a wrong Land Cover Change (fLuc) variable and a wrong nbp balance variable. 
     140# This file will correct all those IPCC CMIP5 history files in a simulation. 
     141# You must read 'Documentation' paragraph below to parameter the chain of jobs for  
     142# specific schedulers. 
     143# This script must only be used in a libIGCM directory 
     144#     (but submit from a CONFIG directory). 
     145# Default parameters in this job are given for mercure CCRT X64 frontend.   
     146# 
     147#************************************************************** 
     148 
     149 
     150 
    122151 
    123152date 
     
    148177#D- Experience type : DEB(ug), DEV(elopment), RUN (default) 
    149178JobType=RUN 
     179 
     180 
     181### Documentation :  
     182##      1) To start again this script in StandAlone mode  
     183##         (because it fails with a problem with the system or a timeout, for example), 
     184##         you must check the initialisation of three variables after the "Start loop" line : 
     185##    CURRENT_LOOP=${CURRENT_LOOP:=1} give the iteration to begin the main loop 
     186##    imin=${imin:=0}                 give the corresponding min index in the list of stomate_history files 
     187##    imax=${imax:=${NbFilesLOOP}}    give the corresponding max index in the list of stomate_history files 
     188##         nb: the main loop is parametered by UNIX_MAX_LIMIT (in system library) value. 
     189##    imax is a factor of NbFilesLOOP = UNIX_MAX_LIMIT / 2 value 
     190##    imin is the previous imax (see previous output of the script if exist) 
     191##      2) This script will re-submit itself automaticly after calculate the next values of those three variables.  
     192 
     193##   To prevent timeout because of a large number of files (long simulation) and maximum elapse time  
     194## in the PBS queue, you must give the correct value of next line LOOP_MAX variable. 
     195## It gives the maximum of iterations of the MAIN LOOP during the elapse time required in the PBS. 
     196LOOP_MAX=15 
     197# 
     198## For example: if UNIX_MAX_LIMIT=360 and the number of stomate_history for a run if 3800, 
     199##              the number of files that has to be demigrated if 7600 (stomate_history + stomate_ipcc_history). 
     200##              The NBRE_TOUR (see previous output) calculate is 22. 
     201##              If the elasped time required is 24H (86400s) and each 10 years (120x2 = 240 files) take one hour, 
     202##              you must give LOOP_MAX= 240 * 24 / 360 = 16 max. 
     203##              To prevent system slow, the default value is 15. 
     204 
    150205 
    151206######################################################################## 
     
    231286echo "NbFilesLOOP = ${NbFilesLOOP} " 
    232287 
    233 CURRENT_LOOP=1 
    234 # THIS LOOP GIVES PARAMETERS FOR THE DATE'S LOOP ie : DATE_COURANTE, DATE_FIN. 
    235 # WE HAVE 3 LEVELS  
    236 #    - LEVEL 1 : JUST ONE LOOP TO COMPLETE 
    237 #    - LEVEL 2 : WE ARE IN THE "DEEP" LOOP 
    238 #    - LEVEL 3 : WE ARE IN THE LAST LOOP 
    239  
    240 imin=0 
    241 imax=${NbFilesLOOP} 
     288######################################################################## 
     289# 
     290#                          START THE MAIN LOOP 
     291# 
     292######################################################################## 
     293 
     294# PARAMETERS OF THE LOOP : 
     295# Cumultate CURRENT LOOP number over submitions 
     296CURRENT_LOOP=${CURRENT_LOOP:=1} 
     297# min index for list of local files 
     298imin=${imin:=0} 
     299# max index for list of local files 
     300imax=${imax:=${NbFilesLOOP}} 
     301 
     302# DEPEND OF THE ELAPSED TIME RESERVED FOR LOOP_MAX ITERATIONS 
     303LOOP_MAX=${LOOP_MAX:=NBRE_TOUR} 
     304 
     305IGCM_debug_Verif_Exit_Post 
     306 
     307# MAIN LOOP 
     308# LOCAL CURRENT LOOP number less than LOOP_MAX 
     309CURRENT_LOOP0=1 
    242310while [ ${CURRENT_LOOP} -le ${NBRE_TOUR} ] ; do 
     311 
     312    echo "###############################################################" 
     313    echo "LOOP : " ${CURRENT_LOOP} 
     314    echo "imin/imax : " $imin " / " $imax 
    243315     
    244316    unset liste_file 
     
    253325 
    254326        liste_file[${#liste_file[*]}]=${file} 
    255         liste_file[${#liste_file[*]}]=${file_ipcc} 
    256327        liste_file_local[${#liste_file_local[*]}]=$( basename ${file} ) 
    257328        RET=$? 
    258329        if [ ${RET} -gt 0 ] ; then 
    259             echo "erreur basename" 
     330            echo "erreur basename liste_file_local " ${file} 
    260331            echo "file = " ${file} 
    261332            exit 1 
    262333        fi 
    263         liste_file_local[${#liste_file_local[*]}]=$( basename ${file_ipcc} ) 
    264         RET=$? 
    265         if [ ${RET} -gt 0 ] ; then 
    266             echo "erreur basename" 
    267             echo "file = " ${file_ipcc} 
    268             exit 2 
    269         fi 
     334        liste_file[${#liste_file[*]}]=${file_ipcc} 
     335 
    270336        liste_file_ipcc[${#liste_file_ipcc[*]}]=${file_ipcc} 
    271337        liste_file_ipcc_local[${#liste_file_ipcc_local[*]}]=$( basename ${file_ipcc} ) 
    272338        RET=$? 
    273339        if [ ${RET} -gt 0 ] ; then 
    274             echo "erreur basename" 
     340            echo "erreur basename liste_file_ipcc_local " ${file_ipcc} 
    275341            echo "file = " ${file_ipcc} 
    276342            exit 3 
     
    334400    (( imin = imax )) 
    335401    (( CURRENT_LOOP = CURRENT_LOOP + 1 )) 
     402    (( CURRENT_LOOP0 = CURRENT_LOOP0 + 1 )) 
    336403    if [ ${CURRENT_LOOP} -lt ${NBRE_TOUR} ] ; then 
    337404        (( imax = imax + ${NbFilesLOOP} )) 
    338405    else 
    339         if [ ${NBRE_FILE_TOT}%${UNIX_MAX_LIMIT} -eq 0 ] ; then 
    340             (( imax = imax + ${NbFilesLOOP} )) 
    341         else 
     406        if [ ${CURRENT_LOOP} -eq ${NBRE_TOUR} ] ; then 
    342407            echo "Dernier tour : " 
    343             echo "reste = " $(( NBRE_FILE_TOT % UNIX_MAX_LIMIT ))        
    344             echo "imax = " ${imax} 
    345             echo "reste / 2 = " $(( ( NBRE_FILE_TOT % UNIX_MAX_LIMIT / 2 ) )) 
    346             (( imax = imax + ( NBRE_FILE_TOT % UNIX_MAX_LIMIT / 2 ) )) 
    347             echo "imax NEW = " ${imax} 
    348             echo "Nombre de stomate_history : " ${CountLISTE_FILE_SBG} 
     408            if [ ${NBRE_FILE_TOT}%${UNIX_MAX_LIMIT} -eq 0 ] ; then 
     409                echo "imin NEW = " ${imax} 
     410                (( imax = imax + ${NbFilesLOOP} )) 
     411                echo "imax NEW = " ${imax} 
     412            else 
     413                echo "imin NEW = " ${imax} 
     414                (( imax = imax + ( NBRE_FILE_TOT % UNIX_MAX_LIMIT ) / 2 )) 
     415                echo "imax NEW = " ${imax} 
     416            fi 
    349417        fi 
    350418    fi 
    351 done                 # while [ ${CURRENT_LOOP} -le  ${NBRE_TOUR} ] do 
     419    if ( [ ${CURRENT_LOOP} -le ${NBRE_TOUR} ] && \ 
     420         [ ${CURRENT_LOOP0} -gt ${LOOP_MAX} ] ) ; then 
     421        export CURRENT_LOOP 
     422        export imin 
     423        export imax 
     424        IGCM_sys_Cd ${SUBMIT_DIR} 
     425        Script_Post_Output=SBGcorr.${imin}.${imax} 
     426        listVarEnv="CURRENT_LOOP,imin,imax" 
     427        echo "Submit next job." 
     428        IGCM_sys_QsubPost stomate_flux_correction 
     429        break ;  
     430    fi 
     431done                 # while [ ${CURRENT_LOOP} -le  ${LOOP_MAX} ] do 
    352432# FINISH 
    353433 
     
    360440 
    361441# Clean RUN_DIR_PATH (necessary for cesium) 
     442IGCM_sys_Cd ${SUBMIT_DIR} 
    362443IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH} 
    363444 
Note: See TracChangeset for help on using the changeset viewer.