Ignore:
Timestamp:
03/30/12 16:27:29 (12 years ago)
Author:
sdipsl
Message:
  • Hopefully end of the merge story
File:
1 edited

Legend:

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

    r619 r622  
    810810  IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card rw 
    811811 
    812   IGCM_debug_Print 1 "Check components binary : size and creation date" 
    813  
    814   typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize 
    815   typeset comp i 
    816   typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax 
    817  
    818       #==================================# 
    819       #        Get last Exe Size         # 
    820       #==================================# 
    821  
    822   (( i=0 )) 
    823   if ( ${FirstInitialize} ) ; then 
    824     run_Log_LastExeSize="" 
     812  if [ ${DRYRUN} -le 1 ] ; then 
     813 
     814    IGCM_debug_Print 1 "Check components binary : size and creation date" 
     815 
     816    typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize 
     817    typeset comp i 
     818    typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax 
     819 
     820    #==================================# 
     821    #        Get last Exe Size         # 
     822    #==================================# 
     823 
     824    (( i=0 )) 
     825    if ( ${FirstInitialize} ) ; then 
     826      run_Log_LastExeSize="" 
     827      for comp in ${config_ListOfComponents[*]} ; do 
     828        run_Log_LastExeSize[$i]=0 
     829        (( i=i+1 )) 
     830      done 
     831    else 
     832      IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
     833    fi 
     834    #==================================# 
     835    #         And Build ExeDate        # 
     836    #==================================# 
     837 
     838    # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33 
     839    # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M") 
     840    # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34 
     841    ExeDate="" 
     842    NextExeSize="( " 
     843    (( i=0 )) 
     844    UpdateExe=false 
     845    (( ExeSecDateMax = 0 )) 
    825846    for comp in ${config_ListOfComponents[*]} ; do 
    826       run_Log_LastExeSize[$i]=0 
     847 
     848      IGCM_debug_Print 3 ${comp} 
     849 
     850      eval ExeNameIn=\${config_Executable_${comp}[0]} 
     851      eval ExeNameOut=\${config_Executable_${comp}[1]} 
     852      # Only if we really have an executable for the component : 
     853      if [ X${ExeNameIn} = X\"\" ] ; then 
     854        # If there is no exe file for this component 
     855        (( ExeSize=0 )) 
     856      else 
     857        eval LS_bin=${R_EXE}/${ExeNameIn} 
     858        IGCM_sys_FileSize ${LS_bin} ExeSize 
     859 
     860        set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} ) 
     861        if [ X${ExeDate} = X ] ; then 
     862          # First component exe date 
     863          ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]} 
     864        else 
     865          ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]} 
     866        fi 
     867        ExeDate=${ExeDate}_${LS_comp[7]} 
     868      fi 
     869 
     870      if [ ${i} -eq 0 ] ; then 
     871        # First component 
     872        NextExeSize="( "${ExeSize} 
     873      else 
     874        NextExeSize=${NextExeSize}", "${ExeSize} 
     875      fi 
     876      eval LastCompExeSize=${run_Log_LastExeSize[$i]} 
    827877      (( i=i+1 )) 
     878 
     879      if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
     880        if ( ${FirstInitialize} ) ; then 
     881          IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !" 
     882        else 
     883          IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
     884          IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !" 
     885          eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
     886        fi 
     887        eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
     888        UpdateExe=true 
     889 
     890        IGCM_sys_GetDate_FichWork ${LS_bin} ExeSecDate 
     891        if [ $ExeSecDateMax -lt $ExeSecDate ] ; then 
     892          ExeSecDateMax=$ExeSecDate 
     893        fi 
     894      fi 
    828895    done 
    829   else 
    830     IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
    831   fi 
    832       #==================================# 
    833       #         And Build ExeDate        # 
    834       #==================================# 
    835  
    836       # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33 
    837       # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M") 
    838       # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34 
    839   ExeDate="" 
    840   NextExeSize="( " 
    841   (( i=0 )) 
    842   UpdateExe=false 
    843   (( ExeSecDateMax = 0 )) 
    844   for comp in ${config_ListOfComponents[*]} ; do 
    845  
    846     IGCM_debug_Print 3 ${comp} 
    847  
    848     eval ExeNameIn=\${config_Executable_${comp}[0]} 
    849     eval ExeNameOut=\${config_Executable_${comp}[1]} 
    850         # Only if we really have an executable for the component : 
    851     if [ X${ExeNameIn} = X\"\" ] ; then 
    852           # If there is no exe file for this component 
    853       (( ExeSize=0 )) 
    854     else 
    855       eval LS_bin=${R_EXE}/${ExeNameIn} 
    856       IGCM_sys_FileSize ${LS_bin} ExeSize 
    857  
    858       set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} ) 
    859       if [ X${ExeDate} = X ] ; then 
    860             # First component exe date 
    861         ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]} 
    862       else 
    863         ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]} 
     896 
     897    # SD : switch off for now 
     898    #if ( ${UpdateExe} ) ; then 
     899    #  echo "Launch SaveSourceModifications." 
     900    #  IGCM_config_SaveSourceModifications ${ExeSecDateMax} 
     901    #fi 
     902 
     903    NextExeSize=${NextExeSize}" )" 
     904    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" 
     905 
     906    if [ ${DRYRUN} -le 1 ] ; then 
     907      tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt 
     908      ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) 
     909      RET=$? 
     910      if [ $RET -eq 0 ] ; then 
     911        # ExeCpuLog variable contents 5 fields 
     912        echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" |   \ 
     913          gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \ 
     914            $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card 
    864915      fi 
    865       ExeDate=${ExeDate}_${LS_comp[7]} 
    866     fi 
    867  
    868     if [ ${i} -eq 0 ] ; then 
    869           # First component 
    870       NextExeSize="( "${ExeSize} 
    871     else 
    872       NextExeSize=${NextExeSize}", "${ExeSize} 
    873     fi 
    874     eval LastCompExeSize=${run_Log_LastExeSize[$i]} 
    875     (( i=i+1 )) 
    876  
    877     if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
    878       if ( ${FirstInitialize} ) ; then 
    879         IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !" 
    880       else 
    881         IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" 
    882         IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !" 
    883         eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} 
    884       fi 
    885       eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw 
    886       UpdateExe=true 
    887  
    888       IGCM_sys_GetDate_FichWork ${LS_bin} ExeSecDate 
    889       if [ $ExeSecDateMax -lt $ExeSecDate ] ; then 
    890         ExeSecDateMax=$ExeSecDate 
    891       fi 
    892     fi 
    893   done 
    894  
    895 # SD : switch off for now 
    896 #      if ( ${UpdateExe} ) ; then 
    897 #       echo "Launch SaveSourceModifications." 
    898 #       IGCM_config_SaveSourceModifications ${ExeSecDateMax} 
    899 #      fi 
    900  
    901   NextExeSize=${NextExeSize}" )" 
    902   IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" 
    903  
    904   if [ ${DRYRUN} -le 1 ] ; then 
    905     tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt 
    906     ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) 
    907     RET=$? 
    908     if [ $RET -eq 0 ] ; then 
    909           # ExeCpuLog variable contents 5 fields 
    910       echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" |   \ 
    911         gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \ 
    912             $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card 
    913     fi 
    914     eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt" 
    915   fi 
    916  
    917       # All was right ? no ? then we stop. 
     916      eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt" 
     917    fi 
     918 
     919  fi 
     920 
     921  # All was right ? no ? then we stop. 
    918922  IGCM_debug_Verif_Exit 
    919923 
    920       # If all was OK, we can delete all files not necessary for next Job 
     924  # If all was OK, we can delete all files not necessary for next Job 
    921925  echo 
    922926  IGCM_debug_Print 1 "Files that will be deleted before next period-run : " 
     
    928932  fi 
    929933 
    930       #=================================================# 
    931       #         Modification of libIGCM behaviour       # 
    932       #=================================================# 
    933  
    934       # To use this function, one must copy libIGCM.card from ${libIGCM} directory 
    935       # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card, 
    936       # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. 
     934  #=================================================# 
     935  #         Modification of libIGCM behaviour       # 
     936  #=================================================# 
     937 
     938  # To use this function, one must copy libIGCM.card from ${libIGCM} directory 
     939  # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card, 
     940  # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. 
    937941  if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then 
    938942    echo 
     
    945949    IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]} 
    946950 
    947         # Special treatments for libIGCM internals 
     951    # Special treatments for libIGCM internals 
    948952    for option in ${libIGCM_UserChanges[*]} ; do 
    949953      IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option} 
     
    960964        DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 
    961965 
    962           # Period Length In Days between DateBegin and DateEnd 
     966        # Period Length In Days between DateBegin and DateEnd 
    963967        (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 )) 
    964968        if [ ${ExperienceLengthInDays} -lt 0 ] ; then 
Note: See TracChangeset for help on using the changeset viewer.