Changeset 380 for trunk


Ignore:
Timestamp:
11/09/10 16:02:49 (14 years ago)
Author:
sdipsl
Message:
  • Add a IGCM_config_Check function to test coherency between post-processing frequency. See #29. Will exit before execution if incoherency are found (example rebuild every 6 months, having a 1Y PeriodLenght? and a 2 months TimeSeriesFrequency?...)
  • libIGCM_post.ksh refactoring, making general function to handle frequency, easier to read hopefully. Still some simplification to add
  • DRYRUN was not maintain since a long time. Fix that. Minor adaptation still need to be done for sx8 and sx9 (ie when you want to DRYRUN from a machine initially devoted to the post-processing). DRYRUN is aimed for developpement purpose, prefer StandAlone? method to post-process after the fact.
  • we clean SUBMIT_DIR keeping only the 5 youngest Script_Output_* files. Good for workdir quota.
  • simplify rebuildFrom* options : remove R_SAVE and config_UserChoices_JobName used by IGCM_Patch_20091118_mask.ksh. rebuild.ksh will define that ; AA_create* already know that.
  • when exiting because of a RErun an old job : be more explicit and point the files who initiated this action, together with a link to clean_month.job
  • remove some redundant typeset
  • clean libIGCM_sys.ksh : remove machines
  • and cosmetics.
Location:
trunk/libIGCM
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/AA_create_ts

    r377 r380  
    481481            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 
    482482        *) 
    483             IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 
     483            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D." 
    484484            IGCM_debug_Verif_Exit_Post ;; 
    485485    esac 
     
    536536            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 
    537537        *) 
    538             IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 
     538            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D." 
    539539            IGCM_debug_Verif_Exit_Post ;; 
    540540    esac 
  • trunk/libIGCM/AA_job

    r373 r380  
    285285#D- Will stop here if something is wrong 
    286286# --------------------------------------------------------------------== 
    287 #IGCM_config_Check 
     287IGCM_config_Check 
     288 
     289# ------------------------------------------------------------------ 
     290#D- Test if all was right before entering the period loop 
     291# ------------------------------------------------------------------ 
     292IGCM_debug_Verif_Exit 
    288293 
    289294#D--------------------------------------------------------------------== 
     
    487492    #D- 
    488493    # ------------------------------------------------------------------ 
     494    #D- Configure asynchronous post-treatment (Level 0) when necessary (rebuild) 
     495    #D- Configure classic post-treatment (Level 1) when necessary (TimeSeries/Seasonal) 
     496    # ------------------------------------------------------------------ 
     497    IGCM_post_Configure 
     498 
     499    #D- 
     500    # ------------------------------------------------------------------ 
    489501    #D- Launch remote rebuild or/and post-treatment process if necessary 
    490502    # ------------------------------------------------------------------ 
    491     IGCM_post_Configure 
     503    IGCM_post_Submit 
    492504 
    493505    #D- 
     
    497509    #D- Write in run.card user, system and elapse time 
    498510    #D- Check that everything went well ! No ? then we stop. 
    499     #D- Determine next computed period  
     511    #D- Determine next computed period 
    500512    # ------------------------------------------------------------------ 
    501513    IGCM_config_PeriodEnd 
  • trunk/libIGCM/AA_rebuild_fromArchive

    r373 r380  
    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  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE 
     34#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive 
    3535#-Q- sx8brodie # @ queue 
    3636#-Q- aix6 #!/bin/ksh 
     
    4848#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) 
    4949#-Q- aix6 # @ notification = error 
    50 #-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE 
     50#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive 
    5151#-Q- aix6 # @ queue 
    5252#-Q- sx8mercure #!/bin/ksh 
     
    153153LastPeriodForRebuild=${PeriodDateBegin:=18901201} 
    154154 
    155 #D- Name of the job to work in a standalone mode (needed for mask patch) 
    156 #D- Default : value from config.card if any 
    157 config_UserChoices_JobName=${config_UserChoices_JobName:=name_of_the_job} 
    158  
    159 #D- Directory where output data are stored (needed in standalone mode for mask patch) 
    160 #D- Default : value from AA_job if any 
    161 R_SAVE=${R_SAVE:=/path/to/your/ARCHIVE/FILES} 
    162  
    163155#D- Flag to determine atlas job's output directory 
    164156#D- Default : value from libIGCM_post.ksh if any 
  • trunk/libIGCM/AA_rebuild_fromWorkdir

    r373 r380  
    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  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE 
     34#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive 
    3535#-Q- sx8brodie # @ queue 
    3636#-Q- aix6 #!/bin/ksh 
     
    4949#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) 
    5050#-Q- aix6 # @ notification = error 
    51 #-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE 
     51#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive 
    5252#-Q- aix6 # @ queue 
    5353#-Q- sx8mercure #!/bin/ksh 
     
    154154LastPeriodForRebuild=${PeriodDateBegin:=18901201} 
    155155 
    156 #D- Name of the job to work in a standalone mode (needed for mask patch) 
    157 #D- Default : value from config.card if any 
    158 config_UserChoices_JobName=${config_UserChoices_JobName:=name_of_the_job} 
    159  
    160 #D- Directory where output data are stored (needed in standalone mode for mask patch) 
    161 #D- Default : value from AA_job if any 
    162 R_SAVE=${R_SAVE:=/path/to/your/ARCHIVE/FILES} 
    163  
    164156#D- Flag to determine atlas job's output directory 
    165157#D- Default : value from libIGCM_post.ksh if any 
  • trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh

    r373 r380  
    109109            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    110110            # 
    111             typeset i 
    112111            i=2 
    113112            # 
     
    159158                            if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then 
    160159                                if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then 
    161                                     IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post} according to ${card}" 
     160                                    IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post}" 
    162161                                    eval TimeSeries${Dimension}=true 
    163162                                fi 
     
    169168                                chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) 
    170169                                if [ ! ${chunck_size} = NONE ] &&  [ ! ${chunck_size} = OFF ] ; then 
    171                                     IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post} according to ${card}" 
     170                                    IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post}" 
    172171                                    eval TimeSeriesChunck${Dimension}=true 
    173172                                    eval set +A CHUNCK${Dimension}_COMP \${CHUNCK${Dimension}_COMP[*]} ${comp} 
     
    266265              if [ X${FileName0} != X${NULL_STR} ] ; then 
    267266                  eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    268                   typeset i 
    269267                  (( i=0 )) 
    270268                  until [ $i -ge $NbFiles ]; do 
     
    369367            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    370368 
    371             typeset i 
    372369            (( i=0 )) 
    373370            until [ $i -ge $NbFiles ]; do 
     
    433430            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    434431 
    435             typeset i 
    436432            (( i=0 )) 
    437433            until [ $i -ge $NbFiles ]; do 
     
    459455                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    460456                 
    461                 typeset i 
    462457                (( i=0 )) 
    463458                until [ $i -ge $NbFiles ]; do 
     
    529524            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    530525 
    531             typeset i 
    532526            (( i=0 )) 
    533527            until [ $i -ge $NbFiles ]; do 
     
    613607                    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    614608 
    615                     typeset i 
    616609                    (( i=1 )) 
    617610                    until [ $i -gt $NbFiles ]; do 
     
    666659                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    667660 
    668                 typeset i 
    669661                (( i=1 )) 
    670662                until [ $i -gt $NbFiles ]; do 
     
    828820            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    829821             
    830             typeset i 
    831822            (( i=0 )) 
    832823            until [ $i -ge $NbFiles ]; do 
     
    893884            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    894885 
    895             typeset i 
    896886            (( i=0 )) 
    897887            until [ $i -ge $NbFiles ]; do 
     
    931921                            echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    932922                            echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     923                            echo "export R_SAVE=${R_SAVE}                             " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     924                            echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    933925                            fi 
    934926                        fi 
     
    10271019            eval NbFiles=\${#${ListTextName}[@]} > /dev/null 2>&1 
    10281020 
    1029             typeset i 
    10301021            (( i=0 )) 
    10311022            until [ $i -eq $NbFiles ]; do 
  • trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r373 r380  
    269269            IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}" 
    270270            PeriodLengthInDays=0 
    271             typeset i 
    272271            i=0 
    273272            until [ $i -ge $PeriodLengthInYears ] ; do  
     
    280279            IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 
    281280            PeriodLengthInDays=0 
    282             typeset i 
    283281            i=0 
    284282            until [ $i -ge $PeriodLengthInMonths ] ; do  
     
    300298 
    301299    IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength" 
    302  
     300} 
     301 
     302#=================================== 
     303function IGCM_config_Check 
     304{ 
     305    IGCM_debug_PushStack "IGCM_config_Check" 
     306 
     307    # If one of the following modulo is not zero : 
     308    # we will issue an error then explain and exit in 
     309    # AA_job IGCM_debug_Verif_Exit call before binary submission 
     310 
     311    echo 
     312    IGCM_debug_Print 1 "IGCM_config_Check :" 
     313    echo 
     314 
     315    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 
     316        AsynchronousRebuild=true 
     317        IGCM_debug_Print 1 "Asynchronous rebuild has been activated." 
     318        echo 
     319        # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero 
     320        IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 
     321        IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency 
     322        IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency 
     323    else 
     324        AsynchronousRebuild=false 
     325        IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" 
     326        IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" 
     327        echo 
     328        #modulo (TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero 
     329        IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength 
     330        IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency   config_UserChoices_PeriodLength 
     331    fi 
     332 
     333    IGCM_debug_PopStack "IGCM_config_Check" 
    303334} 
    304335 
     
    435466        if [ ${DRYRUN} -le 0 ] ; then 
    436467            if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then 
    437                 IGCM_debug_Exit "IGCM_config_PeriodStart" "RErun an old job." 
     468                IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." 
    438469                IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" 
    439470                IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " 
    440                 IGCM_debug_Print 1 " the whole ${R_SAVE} tree." 
     471                IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." 
     472                IGCM_debug_Print 1 " This exit has been initiated because at least ${R_OUT_KSH}/${PREFIX}_${Exe_Output} exists." 
    441473                IGCM_debug_Verif_Exit 
    442474            fi 
     
    476508    #==================================# 
    477509 
    478     typeset i 
    479     (( i=0 )) 
    480     if ( ${FirstInitialize} ) ; then 
    481         run_Log_LastExeSize="" 
    482         for comp in ${config_ListOfComponents[*]} ; do 
    483             run_Log_LastExeSize[$i]=0 
    484             (( i=i+1 )) 
    485         done 
    486     else 
    487         IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
    488     fi 
    489  
     510    if [ ${DRYRUN} -le 1 ] ; then 
     511        (( i=0 )) 
     512        if ( ${FirstInitialize} ) ; then 
     513            run_Log_LastExeSize="" 
     514            for comp in ${config_ListOfComponents[*]} ; do 
     515                run_Log_LastExeSize[$i]=0 
     516                (( i=i+1 )) 
     517            done 
     518        else 
     519            IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
     520        fi 
     521    fi 
    490522    #==================================# 
    491523    #         And Build ExeDate        # 
     
    532564        (( i=i+1 )) 
    533565 
    534         if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
    535             if ( ${FirstInitialize} ) ; then 
    536                 IGCM_debug_Print 1 "Put first ${ExeNameIn} in ${R_OUT_EXE} !" 
    537             else 
    538                 IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
    539                 eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
     566        if [ ${DRYRUN} -le 1 ] ; then 
     567            if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
     568                if ( ${FirstInitialize} ) ; then 
     569                    IGCM_debug_Print 1 "Put first ${ExeNameIn} in ${R_OUT_EXE} !" 
     570                else 
     571                    IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
     572                    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
     573                fi 
     574                eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
    540575            fi 
    541             eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
    542576        fi 
    543577    done 
    544578 
    545579    if [ ${DRYRUN} -le 1 ] ; then 
    546         typeset ExeCpuLog 
    547580        tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt 
    548581        ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) 
     
    688721 
    689722    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then 
    690  
    691723        #==========================# 
    692724        # End of entire simulation # 
     
    704736            IGCM_sys_Tree ${R_SAVE} 
    705737        fi 
    706      
    707738    else 
    708  
    709739        #=================# 
    710740        # Submit next job # 
     
    719749        # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR 
    720750        IGCM_sys_Cd ${SUBMIT_DIR} 
     751        # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName} 
     752        ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? > /dev/null 2>&1 | wc -l ) 
     753        [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) ) 
     754        # Submit next job and come back 
    721755        IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} 
    722756        IGCM_sys_Cd - 
  • trunk/libIGCM/libIGCM_post/libIGCM_post.ksh

    r373 r380  
    2222    IGCM_debug_Print 1 "IGCM_post_Configure :" 
    2323    echo 
    24  
    25     typeset NbDays PeriodEndJul PostEndJul PeriodPost 
     24    # 
     25    # Initialize 
     26    # 
     27    POST=false 
    2628    RebuildFrequency=false 
    27  
    28     if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 
    29  
    30         IGCM_debug_Print 1 "Asynchronous rebuild has been activated." 
    31         echo 
    32  
    33         case ${config_Post_RebuildFrequency} in 
    34             *y|*Y) 
    35                 PeriodYear=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[yY]//" ) 
    36                 case ${config_UserChoices_PeriodLength} in 
    37                     *Y|*y) 
    38                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" ) 
    39                         if [ ${PeriodPost} -le ${PeriodYear} ] ; then 
    40                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear}  ) -eq 0 ] ;  then 
    41                                 RebuildFrequency=true 
    42                                 NbRebuildDir=$( expr ${PeriodYear} / ${PeriodPost} ) 
    43                             fi 
    44                         else 
    45                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    46                             IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
    47                         fi ;; 
    48                     *M|*m) 
    49                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
    50                         if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then 
    51                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then 
    52                                 RebuildFrequency=true 
    53                                 NbRebuildDir=$( expr $(( 12 * ${PeriodYear} )) / ${PeriodPost} ) 
    54                             fi 
    55                         else 
    56                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    57                             IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
    58                         fi ;; 
    59                     *D|*d) 
    60                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 
    61                         NbDays=$( IGCM_date_DaysInYear ${year} ) 
    62                         if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then 
    63                             if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then 
    64                                 if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then 
    65                                     RebuildFrequency=true 
    66                                     NbRebuildDir=$( expr $(( ${NbDays} * ${PeriodYear} )) / ${PeriodPost} ) 
    67                                 fi 
    68                             else 
    69                                 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    70                                 IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
    71                             fi 
    72                         else 
    73 #                           if [ ${PeriodYear} -eq 1 ] ; then 
    74 #                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) 
    75 #                               PostEndJul=${year}${NbDays} 
    76 #                               #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}" 
    77 #                               #echo "PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}" 
    78 #                               if [ ${PostEndJul} -eq ${PeriodEndJul} ] ; then 
    79 #                                   RebuildFrequency=true 
    80 #                                   NbRebuildDir=$( expr ${NbDays} / ${PeriodPost} ) 
    81 #                               fi 
    82 #                           else 
    83                             IGCM_debug_Print 3 "For RebuildFrequency with leap calendar:" 
    84                             IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y." 
    85                             IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment." 
    86 #                           fi 
    87                         fi;; 
    88                 esac ;; 
    89             *M|*m) 
    90                 PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" ) 
    91                 case ${config_UserChoices_PeriodLength} in 
    92                     *Y|*y) 
    93                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    94                         IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;; 
    95                     *M|*m) 
    96                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
    97                         if [ ${PeriodPost} -le ${PeriodMonth} ] ; then 
    98                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth}  ) -eq 0 ] ;  then 
    99                                 RebuildFrequency=true 
    100                                 NbRebuildDir=$( expr ${PeriodMonth} / ${PeriodPost} ) 
    101                             fi 
    102                         else 
    103                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    104                             IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
    105                         fi ;; 
    106                     *D|*d) 
    107                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    108                         IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" ;; 
    109                 esac 
    110                 ;; 
    111             *D|*d) 
    112                 PeriodDay=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[dD]//" ) 
    113                 case ${config_UserChoices_PeriodLength} in 
    114                     *Y|*y) 
    115                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    116                         IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;; 
    117                     *M|*m) 
    118                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    119                         IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;; 
    120                     *D|*d) 
    121                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 
    122                         if [ ${PeriodPost} -le ${PeriodDay} ] ; then 
    123                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodDay}  ) -eq 0 ] ;  then 
    124                                 RebuildFrequency=true 
    125                                 NbRebuildDir=$( expr ${PeriodDay} / ${PeriodPost} ) 
    126                             fi 
    127                         else 
    128                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    129                             IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
    130                         fi ;; 
    131  
    132                 esac 
    133                 ;; 
    134             NONE|none) 
    135                 ;; 
    136             *) 
    137                 IGCM_debug_Print 3 "KeyWord not allowed for RebuildFrequency in config.card" 
    138                 ;; 
    139         esac 
    140     else 
    141         # 
    142         IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" 
    143         IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" 
    144         echo 
    145         # 
    146     fi 
    147  
    148     IGCM_debug_Print 1 "RebuildFrequency flag value : ${RebuildFrequency}" 
    149     IGCM_post_Initialize 
    150  
    151     IGCM_debug_PopStack "IGCM_post_Configure" 
    152 } 
    153  
    154 function IGCM_post_Initialize 
    155 { 
    156     IGCM_debug_PushStack "IGCM_post_Initialize" 
    157  
    158     # Debug Print : 
    159     echo 
    160     IGCM_debug_Print 1 "IGCM_post_Initialize :" 
    161     echo 
    162  
    163     typeset NbDays PeriodEndJul PostEndJul 
    164     # 
    165     # Initialize 
    166     # 
    167     POST=false 
    16829    TimeSeriesFrequency=false 
    16930    SeasonalFrequency=false 
     
    17132    # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS 
    17233    # 
     34    if [ X${AsynchronousRebuild} = Xtrue ] ; then 
     35        list_post="RebuildFrequency" 
     36    fi 
     37    # 
    17338    if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] ) ; then 
    174         list_post=TimeSeriesFrequency 
     39        list_post="${list_post} TimeSeriesFrequency" 
    17540    fi 
    17641    # 
     
    17843        list_post="${list_post} SeasonalFrequency" 
    17944    fi 
    180     # 
    181     # READ TIME SERIES OR SEASONAL FREQUENCY 
     45 
     46    # Overrule special cases 
     47    if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ 
     48         [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \ 
     49         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 
     50        TimeSeriesFrequency=true 
     51        POST=true 
     52    fi 
     53    # 
     54    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \ 
     55         [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \ 
     56         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 
     57        RebuildFrequency=true 
     58        POST=true 
     59    fi 
     60 
     61    # READ REBUILD OR TIME SERIES OR SEASONAL FREQUENCY 
    18262    # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO 
    183     # 
    18463    for post_freq in ${list_post} ; do 
    185         # 
    18664        # Extract frequency from previously defined variable 
    187         # 
    18865        config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} ) 
    189         # 
    19066        # Offset for Seasonal Average starting period 
    191         # 
    19267        if [ ${post_freq} = SeasonalFrequency ] ; then 
    19368            if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then 
     
    19974            PeriodOffset=0 
    20075        fi 
    201         # 
    202         if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then 
    203             # 
    204             continue 
    205             # 
    206         fi 
    207         # 
    208         case ${config_Post_post_freq} in 
    209             *y|*Y) 
    210                 PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" ) 
    211                 # 
    212                 case ${config_UserChoices_PeriodLength} in 
    213                     *Y|*y) 
    214                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" ) 
    215                         if [ ${PeriodPost} -le ${PeriodYear} ] ; then 
    216                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodYear} ) -eq 0 ] ;  then 
    217                                 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true 
    218                                 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true 
    219                             fi 
    220                         else 
    221                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    222                             IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
    223                         fi ;; 
    224                     *M|*m) 
    225                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
    226                         if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then 
    227                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then 
    228                                 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && eval ${post_freq}=true 
    229                                 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && POST=true 
    230                             fi 
    231                         else 
    232                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    233                             IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
    234                         fi ;; 
    235                     *D|*d) 
    236                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 
    237                         NbDays=$( IGCM_date_DaysInYear ${year} ) 
    238                         if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then 
    239                             if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then 
    240                                 if [ $( expr $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) % \ 
    241                                     $(( ${NbDays} * ${PeriodYear} / ${PeriodPost} )) ) -eq 0 ] ; then 
    242                                     [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] && eval ${post_freq}=true 
    243                                     [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] POST=true 
    244                                 fi 
    245                             else 
    246                                 IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    247                                 IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
    248                             fi 
    249                         else 
    250 #                                           if [ ${PeriodYear} -eq 1 ] ; then 
    251 #                                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) 
    252 #                                               PostEndJul=${year}${NbDays} 
    253 #                                                #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}" 
    254 #                                               #echo PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}" 
    255 #                                               if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then 
    256 #                                                   eval ${post_freq}=true 
    257 #                                                   POST=true 
    258 #                                               fi 
    259 #                                           else 
    260                             IGCM_debug_Print 3 "For ${post_freq} with leap calendar, for ${comp} and ${file_in} :" 
    261                             IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y." 
    262                             IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment." 
    263 #                                           fi 
    264                         fi;; 
    265                 esac ;; 
    266             *M|*m) 
    267                 PeriodMonth=$( echo ${config_Post_post_freq} | sed -e "s/[mM]//" ) 
    268                 case ${config_UserChoices_PeriodLength} in 
    269                     *Y|*y) 
    270                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    271                         IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 
    272                     *M|*m) 
    273                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
    274                         if [ ${PeriodPost} -le ${PeriodMonth} ] ; then 
    275                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) % ${PeriodMonth}  ) -eq 0 ] ;  then 
    276                                 [ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true 
    277                                 [ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && POST=true 
    278                             fi 
    279                         else 
    280                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    281                             IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
    282                         fi;; 
    283                     *D|*d) 
    284                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    285                         IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 
    286                 esac ;; 
    287             *D|*d) 
    288                 PeriodDay=$( echo ${config_Post_post_freq} | sed -e "s/[dD]//" ) 
    289                 case ${config_UserChoices_PeriodLength} in 
    290                     *Y|*y) 
    291                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    292                         IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 
    293                     *M|*m) 
    294                         IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    295                         IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 
    296                     *D|*d) 
    297                         PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 
    298                         if [ ${PeriodPost} -le ${PeriodDay} ] ; then 
    299                             if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodDay}  ) -eq 0 ] ;  then 
    300                                 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true 
    301                                 [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true 
    302                             fi 
    303                         else 
    304                             IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
    305                             IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
    306                         fi;; 
    307                 esac ;; 
    308             NONE|none) 
    309                 ;; 
    310             *) 
    311                 IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card" 
    312                 ;; 
    313         esac 
     76        # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\) 
     77        # RebuildFrequency needs additionnal information 
     78        if [ ${post_freq} = RebuildFrequency ] ; then 
     79            IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbRebuildDir 
     80        else 
     81            IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength 
     82        fi 
     83        # 
     84        IGCM_debug_Print 1 "${post_freq} flag value : ${RebuildFrequency}" 
    31485    done 
    31586    # 
    316     if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \ 
    317          [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \ 
    318          [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 
    319         TimeSeriesFrequency=true 
    320         POST=true 
    321     fi 
    322  
    323     if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \ 
    324          [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \ 
    325          [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then 
    326         RebuildFrequency=true 
    327         POST=true 
    328     fi 
    329  
    330     # 
     87    echo 
    33188    IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}" 
    33289    # 
    333     IGCM_post_Submit 
    334  
    335     IGCM_debug_PopStack "IGCM_post_Initialize" 
     90    IGCM_debug_PopStack "IGCM_post_Configure" 
    33691} 
    33792 
     
    365120 
    366121        typeset listVarEnv 
    367         listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG,config_UserChoices_JobName,R_SAVE" 
     122        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 
    368123        # 
    369124        jLoop=${#ListDimension[*]} 
     
    405160                        echo "export RESOL_SRF=${RESOL_SRF}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    406161                        echo "export RESOL_SBG=${RESOL_SBG}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    407                         echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    408                         echo "export R_SAVE=${R_SAVE}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    409162                        echo "export listVarEnv=${listVarEnv}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    410163                        echo "IGCM_sys_MkdirWork ${POST_DIR}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     
    435188                    export RESOL_SRF=${RESOL_SRF} 
    436189                    export RESOL_SBG=${RESOL_SBG} 
    437                     export config_UserChoices_JobName=${config_UserChoices_JobName} 
    438                     export R_SAVE=${R_SAVE} 
    439190                    export listVarEnv=${listVarEnv} 
    440191                    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     
    502253                            echo "export RESOL_SRF=${RESOL_SRF}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    503254                            echo "export RESOL_SBG=${RESOL_SBG}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    504                             echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    505                             echo "export R_SAVE=${R_SAVE}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    506255                            echo "export listVarEnv=${listVarEnv}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    507256                            echo "IGCM_sys_MkdirWork ${POST_DIR}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     
    534283                        export RESOL_SRF=${RESOL_SRF} 
    535284                        export RESOL_SBG=${RESOL_SBG} 
    536                         export config_UserChoices_JobName=${config_UserChoices_JobName} 
    537                         export R_SAVE=${R_SAVE} 
    538285                        export listVarEnv=${listVarEnv} 
    539286                        . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     
    563310        # 
    564311        typeset listVarEnv 
    565         listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG,config_UserChoices_JobName,R_SAVE" 
     312        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 
    566313 
    567314        if [ ${RebuildFrequency} = true ] && [ ${DRYRUN} -le 1 ] ; then 
     
    584331            echo "export RESOL_SRF=${RESOL_SRF}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    585332            echo "export RESOL_SBG=${RESOL_SBG}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    586             echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    587             echo "export R_SAVE=${R_SAVE}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    588333            echo "export listVarEnv=${listVarEnv}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
    589334            echo "IGCM_sys_MkdirWork ${POST_DIR}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     
    611356            export RESOL_SRF=${RESOL_SRF} 
    612357            export RESOL_SBG=${RESOL_SBG} 
    613             export config_UserChoices_JobName=${config_UserChoices_JobName} 
    614             export R_SAVE=${R_SAVE} 
    615358            export listVarEnv=${listVarEnv} 
    616359            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     
    648391            # 
    649392            typeset listVarEnv 
    650             listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG,config_UserChoices_JobName,R_SAVE" 
     393            listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 
    651394            IGCM_sys_RshPost <<-EOF 
    652395            export DEBUG_debug=${DEBUG_debug} 
     
    670413            export RESOL_SRF=${RESOL_SRF} 
    671414            export RESOL_SBG=${RESOL_SBG} 
    672             export config_UserChoices_JobName=${config_UserChoices_JobName} 
    673             export R_SAVE=${R_SAVE} 
    674415            export listVarEnv=${listVarEnv} 
    675416            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     
    685426            # 
    686427            typeset listVarEnv 
    687             listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG,config_UserChoices_JobName,R_SAVE" 
     428            listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" 
    688429            IGCM_sys_RshPost <<-EOF 
    689430            export DEBUG_debug=${DEBUG_debug} 
     
    707448            export RESOL_SRF=${RESOL_SRF} 
    708449            export RESOL_SBG=${RESOL_SBG} 
    709             export config_UserChoices_JobName=${config_UserChoices_JobName} 
    710             export R_SAVE=${R_SAVE} 
    711450            export listVarEnv=${listVarEnv} 
    712451            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     
    721460    IGCM_debug_PopStack "IGCM_post_Submit" 
    722461} 
     462 
     463#=================================== 
     464function IGCM_post_CheckModuloFrequency 
     465{ 
     466    IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $* 
     467 
     468    set -vx 
     469 
     470    # Used by IGCM_config_Check 
     471    # from 2 libIGCM compatible frequency (*Y, *M, *D, *y, *m, *d) 
     472    # Issue an exit instruction IGCM_debug_Exit if there modulo is not zero 
     473    # Input parameter are the name of the variable, not the frequency value itself 
     474    # example 
     475    # IGCM_post_ModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 
     476 
     477    typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay 
     478 
     479    # Get the name of the variable 
     480    MasterName=$1 
     481    SlaveName=$2 
     482    # Get the value the above name points to 
     483    MasterFrequency=$( eval echo \${${1}} ) 
     484    SlaveFrequency=$( eval echo \${${2}} ) 
     485 
     486    echo 
     487    IGCM_debug_Print 1 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}" 
     488    echo 
     489 
     490    case ${MasterFrequency} in 
     491        *y|*Y) 
     492            PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) 
     493            case ${SlaveFrequency} in 
     494                *Y|*y) 
     495                    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 
     496                    if ( [ ${PeriodSlaveYear} -gt ${PeriodMasterYear} ] || \ 
     497                        [ $(( ${PeriodMasterYear} % ${PeriodSlaveYear} )) -ne 0 ] );  then 
     498                        IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     499                        IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 
     500                        IGCM_debug_Exit "Check your frequency" 
     501                    fi ;; 
     502                *M|*m) 
     503                    PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 
     504                    if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \ 
     505                        [ $(( ( ${PeriodMasterYear} * 12 ) % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then 
     506                        IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     507                        IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 
     508                        IGCM_debug_Exit "Check your frequency" 
     509                    fi ;; 
     510                *D|*d) 
     511                    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 
     512                    NbDays=$( IGCM_date_DaysInYear ${year} ) 
     513                    if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then 
     514                        if ( [ ${PeriodSlaveDay} -gt $(( ${PeriodMasterYear} * ${NbDays} )) ] || \ 
     515                            [ $(( ( ${PeriodMasterYear} * ${NbDays} ) % ${PeriodSlaveDay} )) -ne 0 ] ; ) then 
     516                            IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     517                            IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 
     518                            IGCM_debug_Exit "Check your frequency" 
     519                        fi 
     520                    else 
     521                        IGCM_debug_Print 3 "For ${MasterName} with leap calendar:" 
     522                        IGCM_debug_Print 3 "We have a daily ${SlaveName} frequency and ${MasterName}=${MasterFrequency}" 
     523                        IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment." 
     524                        IGCM_debug_Exit "Check your frequency" 
     525                    fi ;; 
     526            esac ;; 
     527        *M|*m) 
     528            PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) 
     529            case ${SlaveFrequency} in                
     530                *Y|*y) 
     531                    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 
     532                    if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \ 
     533                        [ $(( ${PeriodMasterMonth} % ( ${PeriodSlaveYear} * 12 ) )) -ne 0 ] ) ; then 
     534                        IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     535                        IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 
     536                        IGCM_debug_Exit "Check your frequency" 
     537                    fi ;; 
     538                *M|*m) 
     539                    PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 
     540                    if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \ 
     541                        [ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ;  then            
     542                        IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     543                        IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 
     544                        IGCM_debug_Exit "Check your frequency" 
     545                    fi ;; 
     546                *D|*d) 
     547                    IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     548                    IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 
     549                    IGCM_debug_Exit "Check your frequency" ;; 
     550            esac ;; 
     551        *D|*d) 
     552            PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) 
     553            case ${SlaveFrequency} in 
     554                *Y|*y) 
     555                    IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     556                    IGCM_debug_Print 3 "${MasterName} frequency ${MasterFrequency}" 
     557                    IGCM_debug_Exit "Check your frequency" ;; 
     558                *M|*m) 
     559                    IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     560                    IGCM_debug_Print 3 "${MasterName} frequency ${MasterFrequency}" 
     561                    IGCM_debug_Exit "Check your frequency" ;; 
     562                *D|*d) 
     563                    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 
     564                    if ( [ ${PeriodSlaveDay} -gt ${PeriodMasterDay} ] || \ 
     565                        [ $(( ${PeriodMasterDay} % ${PeriodSlaveDay} )) -ne 0 ] ) ;  then 
     566                        IGCM_debug_Print 3 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" 
     567                        IGCM_debug_Print 3 "${MasterName} frequency : ${MasterFrequency}" 
     568                        IGCM_debug_Exit "Check your frequency" 
     569                    fi ;; 
     570            esac ;; 
     571        NONE|none)  
     572            ;; 
     573        *) 
     574            IGCM_debug_Print 3 "KeyWord ${MasterFrequency} not allowed for ${MasterName} in config.card" 
     575            IGCM_debug_Exit "Check your ${MasterName} in config.card" ;; 
     576    esac 
     577 
     578    IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency" 
     579} 
     580 
     581#=================================== 
     582function IGCM_post_ModuloRuntimeFrequency 
     583{ 
     584    IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $* 
     585 
     586    set -vx 
     587 
     588    # Used by IGCM_post_Configure 
     589    # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and  
     590    # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d) 
     591    # --> turn on post-processing submission when their modulo is zero 
     592    # Input parameter are the name of the variable, not the frequency value itself 
     593    # example 
     594    # IGCM_post_ModuloRuntimeFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength 
     595 
     596    typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay 
     597 
     598    # Get the name of the variable 
     599    MasterName=$1 
     600    SlaveName=$2 
     601  
     602    # Get the value the above name points to 
     603    eval MasterFrequency=\${${1}} 
     604    eval SlaveFrequency=\${${2}} 
     605 
     606    echo 
     607    IGCM_debug_Print 1 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}" 
     608    echo 
     609 
     610    case ${MasterFrequency} in 
     611        *y|*Y) 
     612            PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) 
     613            case ${SlaveFrequency} in 
     614                *Y|*y) 
     615                    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 
     616                    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} ) % ${PeriodMasterYear} )) -eq 0 ] ;  then 
     617                        if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then 
     618                            eval ${post_freq}=true ; POST=true 
     619                            [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) 
     620                        fi 
     621                    fi;; 
     622                *M|*m) 
     623                    PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 
     624                    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then 
     625                        if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 )) -ne 0 ] ; then 
     626                            eval ${post_freq}=true ; POST=true 
     627                            [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) 
     628                        fi 
     629                    fi;; 
     630                *D|*d) 
     631                    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 
     632                    NbDays=$( IGCM_date_DaysInYear ${year} ) 
     633                    if [ $(( ( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) ) % ( ${NbDays} * ${PeriodMasterYear} / ${PeriodSlaveDay} ) )) -eq 0 ] ; then 
     634                        if [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) )) -ne 0 ] ; then 
     635                            eval ${post_freq}=true ; POST=true 
     636                            [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( ${NbDays} * ${PeriodMasterYear} ) / ${PeriodSlaveDay} )) 
     637                        fi 
     638                    fi;; 
     639            esac ;; 
     640        *M|*m) 
     641            PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) 
     642            case ${SlaveFrequency} in 
     643                *Y|*y) 
     644                    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) 
     645                    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} ) % ( ${PeriodMasterMonth} ) )) -eq 0 ] ; then 
     646                        if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} )) -ne 0 ] ; then 
     647                            eval ${post_freq}=true ; POST=true 
     648                            [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) 
     649                        fi 
     650                    fi;; 
     651                *M|*m) 
     652                    PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) 
     653                    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ;  then 
     654                        if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} -  ${PeriodOffset} )) -ne 0 ] ; then  
     655                            eval ${post_freq}=true ; POST=true 
     656                            [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) 
     657                        fi 
     658                    fi;; 
     659                *D|*d) 
     660                    IGCM_debug_Print 3 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 
     661                    IGCM_debug_Print 3 "${flag_post} frequency : ${MasterFrequency} " ;; 
     662            esac ;; 
     663        *D|*d) 
     664            PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) 
     665            case ${SlaveFrequency} in 
     666                *Y|*y) 
     667                    IGCM_debug_Print 3 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 
     668                    IGCM_debug_Print 3 "${flag_post} frequency : ${MasterFrequency} " ;; 
     669                *M|*m) 
     670                    IGCM_debug_Print 3 "PeriodLength frequency ${SlaveFrequency} not compatbile with" 
     671                    IGCM_debug_Print 3 "${flag_post} frequency : ${MasterFrequency} " ;; 
     672                *D|*d) 
     673                    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) 
     674                    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} ) % ${PeriodMasterDay} )) -eq 0 ] ;  then 
     675                        if [ $(( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} )) -ne 0 ] ; then 
     676                            eval ${post_freq}=true ; POST=true 
     677                            [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) 
     678                        fi 
     679                    fi;; 
     680            esac ;; 
     681        NONE|none) 
     682            ;; 
     683        *) 
     684            IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card" 
     685            ;; 
     686    esac 
     687 
     688    IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency" 
     689} 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys.ksh

    r373 r380  
    4949        . ${libIGCM}/libIGCM_sys/libIGCM_sys_ulam.ksh;; 
    5050 
    51     mercure) 
    52         echo "sys source mercure frontend TX7 IA-64 lib." 
    53         . ${libIGCM}/libIGCM_sys/libIGCM_sys_mercureTX.ksh;; 
    54  
    5551    mercure0?) 
    5652        echo "sys source mercure frontend X-64 lib." 
     
    7773        . ${libIGCM}/libIGCM_sys/libIGCM_sys_cesium.ksh;; 
    7874 
    79     claude|nougaro|ghio|grebil|robin) 
    80         echo "sys source LMD lib." 
    81         . ${libIGCM}/libIGCM_sys/libIGCM_sys_claude.ksh;; 
    82  
    83     calculo) 
    84         echo "sys source calculo lib." 
    85         . ${libIGCM}/libIGCM_sys/libIGCM_sys_calculo.ksh;; 
    86  
    8775    obelix*) 
    8876        echo "sys source obelix lib." 
Note: See TracChangeset for help on using the changeset viewer.