Ignore:
Timestamp:
04/13/11 10:32:33 (13 years ago)
Author:
sdipsl
Message:
  • Bugfix on titane. Exe files has never been saved and ExeFileSize? in the run.card has always been false. Due to ExeSize? variable scope, decalare local to a function but assigned in another function. It works by chance on some machine, because ExeSize? is not initialized...
  • Bugfix of the revision [433]. out_orchidee was always save in SUBMIT_DIR.
  • Now if a job fail : all concatenated debug files (OutputTextFiles?) will be place in SUBMIT_DIR/Debug for convenience.
  • Continuation of [431], concatenate text files following numerical instead of alphabetical order. MAF.
  • Cosmetic and verbosty has been revisited.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r455 r457  
    1919    # Debug Print : 
    2020    echo 
    21     IGCM_debug_Print 1 "IGCM_config_Initialize :" 
    22     echo 
     21    IGCM_debug_Print 1 "IGCM_config_Initialize" 
    2322 
    2423    if [ ! -r ${SUBMIT_DIR}/run.card ]; then  
     
    6564        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option} 
    6665    done 
    67  
     66    echo 
    6867    IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices" 
    6968    # Name Space of this experience  
     
    9392    IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents" 
    9493    IGCM_debug_Print 3 ${config_ListOfComponents[*]} 
    95     echo 
    9694 
    9795    NbComponents=${#config_ListOfComponents[*]} 
     
    105103    #================================== 
    106104    # Define Outputs Name 
    107     IGCM_debug_Print 1 "Define Script_Output_Prefix and Exe_Output" 
     105    IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output" 
    108106    eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} 
    109107    IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" 
     
    160158    # and PeriodNb through config.card 
    161159    R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT} 
    162     echo 
    163     IGCM_debug_Print 1 "(Re)Define R_INIT, R_BC and PeriodNb" 
     160    IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb" 
    164161    IGCM_debug_Print 3 "R_INIT=${R_INIT}" 
    165162    R_BC=${config_UserChoices_R_BC:=${R_IN}/BC} 
     
    188185        IGCM_sys_MkdirArchive ${R_SAVE} 
    189186    else 
     187        IGCM_sys_TestDirArchive ${R_SAVE} 
     188        [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" 
    190189        #Test state of run in run.card 
    191190        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 
     191         
    192192        if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 
    193193            echo  
    194             IGCM_debug_Print 1 "!!!! IGCM_config_Initialize Error PeriodState : " ${run_Configuration_PeriodState} "!!!!!!!!!!" 
    195             echo  
    196             IGCM_debug_Exit "IGCM_config_Initialize Error PeriodState : " ${run_Configuration_PeriodState} 
     194            IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 
     195            IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 
     196            IGCM_debug_Exit 
    197197            IGCM_debug_Verif_Exit 
    198198        fi 
    199199    fi 
    200     IGCM_sys_TestDirArchive ${R_SAVE} 
    201     [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" 
    202200 
    203201    #================================== 
     
    278276        *Y|*y) 
    279277            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' )  
    280             IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}" 
     278            IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}" 
    281279            PeriodLengthInDays=0 
    282280            i=0 
     
    288286        *M|*m) 
    289287            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' )  
    290             IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 
     288            IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 
    291289            PeriodLengthInDays=0 
    292290            i=0 
     
    321319 
    322320    echo 
    323     IGCM_debug_Print 1 "IGCM_config_Check :" 
     321    IGCM_debug_Print 1 "IGCM_config_Check" 
    324322    echo 
    325323 
     
    331329        echo 
    332330        # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero 
    333         IGCM_debug_Print 1 "Coherence between RebuildFrequency and PeriodLength:" 
     331        IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength" 
    334332        IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength 
    335         IGCM_debug_Print 1 "Coherence between TimeSeriesFrequency and RebuildFrequency:" 
     333        IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency" 
    336334        IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency 
    337         IGCM_debug_Print 1 "Coherence between SeasonalFrequency and RebuildFrequency:" 
     335        IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency" 
    338336        IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency 
    339337    else 
     
    343341        echo 
    344342        #modulo (TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero 
    345         IGCM_debug_Print 1 "Coherence between TimeSeriesFrequency and PeriodLength:" 
     343        IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength" 
    346344        IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength 
    347         IGCM_debug_Print 1 "Coherence between SeasonalFrequency and PeriodLength:" 
     345        IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength" 
    348346        IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency   config_UserChoices_PeriodLength 
    349347    fi 
     
    354352    until [ $i -ge $NbJob ]; do 
    355353        value=${CHUNCK2D_SIZE[${i}]} 
    356         IGCM_debug_Print 1 "Coherence between All Chunck2D frequency and TimeSeriesFrequency:" 
     354        IGCM_debug_Print 1 "Check coherence between All Chunck2D frequency and TimeSeriesFrequency" 
    357355        IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 
    358356        case ${value} in   
    359357            *Y|*y) ;;  
    360             *)  IGCM_debug_Print 3 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" 
     358            *)  IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" 
    361359                IGCM_debug_Exit "This will stop the job" ;; 
    362360        esac 
     
    369367    until [ $i -ge $NbJob ]; do 
    370368        value=${CHUNCK3D_SIZE[${i}]} 
    371         IGCM_debug_Print 1 "Coherence between All Chunck3D frequency and TimeSeriesFrequency:" 
     369        IGCM_debug_Print 1 "Check coherence between All Chunck3D frequency and TimeSeriesFrequency" 
    372370        IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 
    373371        case ${value} in   
    374372            *Y|*y) ;;  
    375             *)  IGCM_debug_Print 3 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" 
     373            *)  IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" 
    376374                IGCM_debug_Exit "This will stop the job" ;; 
    377375        esac 
     
    388386 
    389387    echo 
    390     IGCM_debug_Print 1 "IGCM_config_PeriodStart :" 
     388    IGCM_debug_Print 1 "IGCM_config_PeriodStart" 
    391389    echo 
    392390 
     
    426424        if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 
    427425            echo  
    428             IGCM_debug_Print 1 "!!!!!! IGCM_config_PeriodStart Error PeriodState : " ${run_Configuration_PeriodState} "!!!!!!!!!!" 
    429             echo  
    430             IGCM_debug_Exit "IGCM_config_PeriodStart Error PeriodState : " ${run_Configuration_PeriodState} 
     426            IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 
     427            IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 
     428            echo 
     429            IGCM_debug_Exit 
    431430            IGCM_debug_Verif_Exit 
    432431        fi 
     
    454453            #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name} 
    455454            #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1 
    456             IGCM_debug_Print 1 "Try to save previous ksh job output" 
     455            IGCM_debug_Print 2 "Try to save previous ksh job output" 
    457456            IGCM_sys_Cd ${SUBMIT_DIR}/ 
    458457            IGCM_sys_Put_Out ${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name}.$$ rw 
     
    483482    # Debug Print : 
    484483    IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution" 
    485     IGCM_debug_Print 3 "Year of simulation      : ${year}" 
    486     IGCM_debug_Print 3 "Month of simulation     : ${month}" 
    487     IGCM_debug_Print 3 "PeriodLengthInDays      : ${PeriodLengthInDays}" 
    488     IGCM_debug_Print 3 "PeriodDateBegin         : ${PeriodDateBegin}" 
    489     IGCM_debug_Print 3 "PeriodDateEnd           : ${PeriodDateEnd}" 
    490     IGCM_debug_Print 3 "SimulationLengthInDays  : ${SimulationLengthInDays}" 
    491     IGCM_debug_Print 3 "ExperienceLengthInDays  : ${ExperienceLengthInDays}" 
     484    IGCM_debug_Print 1 "Year of simulation      : ${year}" 
     485    IGCM_debug_Print 1 "Month of simulation     : ${month}" 
     486    IGCM_debug_Print 1 "PeriodLengthInDays      : ${PeriodLengthInDays}" 
     487    IGCM_debug_Print 1 "PeriodDateBegin         : ${PeriodDateBegin}" 
     488    IGCM_debug_Print 1 "PeriodDateEnd           : ${PeriodDateEnd}" 
     489    IGCM_debug_Print 1 "SimulationLengthInDays  : ${SimulationLengthInDays}" 
     490    IGCM_debug_Print 1 "ExperienceLengthInDays  : ${ExperienceLengthInDays}" 
    492491 
    493492    #================================================================# 
     
    518517    else 
    519518        if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then 
    520             IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. DEBUG of DEV mode." 
     519            IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode." 
    521520        fi 
    522521    fi 
     
    531530 
    532531    echo 
    533     IGCM_debug_Print 1 "IGCM_config_PeriodEnd :" 
     532    IGCM_debug_Print 1 "IGCM_config_PeriodEnd" 
    534533    echo 
    535534 
     
    539538    IGCM_sys_Put_Out ${Exe_Output} ${R_OUT_KSH}/${PREFIX}_${Exe_Output} 
    540539    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}" 
    541  
    542540    IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/run.card rw 
    543      
    544     typeset LS_comp LS_bin ExeDate ExeCpuLog ExeSize NextExeSize LastCompExeSize 
     541 
     542    IGCM_debug_Print 1 "Check components binary : size and creation date" 
     543 
     544    typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize 
    545545    typeset comp i     
    546546    typeset ExeNameIn ExeNameOut  
     
    550550    #==================================# 
    551551 
    552     if [ ${DRYRUN} -le 1 ] ; then 
    553         (( i=0 )) 
    554         if ( ${FirstInitialize} ) ; then 
    555             run_Log_LastExeSize="" 
    556             for comp in ${config_ListOfComponents[*]} ; do 
    557                 run_Log_LastExeSize[$i]=0 
    558                 (( i=i+1 )) 
    559             done 
    560         else 
    561             IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
    562         fi 
     552    (( i=0 )) 
     553    if ( ${FirstInitialize} ) ; then 
     554        run_Log_LastExeSize="" 
     555        for comp in ${config_ListOfComponents[*]} ; do 
     556            run_Log_LastExeSize[$i]=0 
     557            (( i=i+1 )) 
     558        done 
     559    else 
     560        IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
    563561    fi 
    564562    #==================================# 
     
    575573    for comp in ${config_ListOfComponents[*]} ; do 
    576574 
    577         IGCM_debug_Print 1 ${comp} 
     575        IGCM_debug_Print 3 ${comp} 
    578576 
    579577        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     
    606604        (( i=i+1 )) 
    607605 
    608         if [ ${DRYRUN} -le 1 ] ; then 
    609             if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
    610                 if ( ${FirstInitialize} ) ; then 
    611                     IGCM_debug_Print 1 "Put first ${ExeNameIn} in ${R_OUT_EXE} !" 
    612                 else 
    613                     IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
    614                     eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
    615                 fi 
    616                 eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
     606        if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
     607            if ( ${FirstInitialize} ) ; then 
     608                IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !" 
     609            else 
     610                IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
     611                IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !" 
     612                eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
    617613            fi 
     614            eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
    618615        fi 
    619616    done 
     617 
     618    NextExeSize=${NextExeSize}" )" 
     619    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" 
    620620 
    621621    if [ ${DRYRUN} -le 1 ] ; then 
     
    632632    fi 
    633633 
    634     NextExeSize=${NextExeSize}" )" 
    635     IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" 
    636  
    637634    # All was right ? no ? then we stop. 
    638635    IGCM_debug_Verif_Exit 
    639636 
    640637    # If all was OK, we can delete all files not necessary for next Job 
     638    echo 
    641639    IGCM_debug_Print 1 "Files that will be deleted before next period-run : " 
    642640 
     
    652650 
    653651    # To use this function, one must copy libIGCM.card from ${libIGCM} directory 
    654     # and put it in ${SUBMIT_DIR} directory. Ater modifications of ${SUBMIT_DIR}/libIGCM.card, 
     652    # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card, 
    655653    # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop.  
    656654    if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then 
     
    676674            case ${option} in 
    677675                config_UserChoices_DateEnd) 
    678                     IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd 
     676                    IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd 
    679677                    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 
    680678 
     
    688686                    ;; 
    689687                config_UserChoices_PeriodLength) 
     688                    IGCM_debug_Print 1  "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}" 
    690689                    ;; 
    691690                PeriodNb) 
    692                     IGCM_debug_Print 3  "Loop in main Job with ${PeriodNb} period(s)" 
     691                    IGCM_debug_Print 1  "Loop in main Job with ${PeriodNb} period(s)" 
    693692                    ;; 
    694693                config_Post_RebuildFrequency) 
    695                     IGCM_debug_Print 3  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" 
     694                    IGCM_debug_Print 1  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" 
    696695                    IGCM_post_Configure 
    697696                    ;; 
    698697                config_Post_TimeSeriesFrequency) 
    699                     IGCM_debug_Print 3  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize" 
     698                    IGCM_debug_Print 1  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize" 
    700699                    IGCM_post_Configure 
    701700                    ;; 
    702701                config_Post_SeasonalFrequency) 
    703                     IGCM_debug_Print 3  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize" 
     702                    IGCM_debug_Print 1  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize" 
    704703                    IGCM_post_Configure 
    705704                    ;; 
     
    726725    echo 
    727726    IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution" 
    728     IGCM_debug_Print 3 "PeriodDateBegin       : ${PeriodDateBegin}" 
    729     IGCM_debug_Print 3 "PeriodDateEnd         : ${PeriodDateEnd}" 
    730     IGCM_debug_Print 3 "PeriodLengthInDays    : ${PeriodLengthInDays}" 
     727    IGCM_debug_Print 1 "PeriodDateBegin       : ${PeriodDateBegin}" 
     728    IGCM_debug_Print 1 "PeriodDateEnd         : ${PeriodDateEnd}" 
     729    IGCM_debug_Print 1 "PeriodLengthInDays    : ${PeriodLengthInDays}" 
    731730 
    732731    PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} ) 
     
    764763 
    765764    echo 
    766     IGCM_debug_Print 1 "IGCM_config_Finalize :" 
     765    IGCM_debug_Print 1 "IGCM_config_Finalize" 
    767766    echo 
    768767 
Note: See TracChangeset for help on using the changeset viewer.