Ignore:
Timestamp:
03/30/12 15:11:37 (12 years ago)
Author:
sdipsl
Message:
  • I messed up the merge of vargas, ulam and AA_job
  • cosmectics
File:
1 edited

Legend:

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

    r616 r619  
    2121  IGCM_debug_Print 1 "IGCM_config_Initialize" 
    2222 
    23   if [ ! -r ${SUBMIT_DIR}/run.card ]; then  
     23  if [ ! -r ${SUBMIT_DIR}/run.card ]; then 
    2424    #================================================# 
    2525    #         The file run.card doesn't exist        # 
     
    5454  # Read libIGCM compatibility version in config.card 
    5555  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM 
    56   eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1         
     56  eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1 
    5757 
    5858  if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then 
     
    6161 
    6262  #================================== 
    63   # Read UserChoices section:  
     63  # Read UserChoices section: 
    6464  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices 
    6565 
     
    6969  echo 
    7070  IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices" 
    71   # Name Space of this experience  
     71  # Name Space of this experience 
    7272  if [ X${config_UserChoices_SpaceName} != X ] ; then 
    7373    IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName 
     
    8989 
    9090  #================================== 
    91   # Read Post section:  
     91  # Read Post section: 
    9292  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post 
    9393  echo 
     
    101101 
    102102  #================================== 
    103   # Define default value to keep compatibility with previous card: means before changes due to TGCC  
     103  # Define default value to keep compatibility with previous card: means before changes due to TGCC 
    104104  [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency} 
    105105 
    106106  #================================== 
    107   # Read ListOfComponents section:  
     107  # Read ListOfComponents section: 
    108108  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents 
    109109  for comp in ${config_ListOfComponents[*]} ; do 
     
    121121  IGCM_card_DefineArrayFromSection   ${SUBMIT_DIR}/config.card Executable 
    122122  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name 
    123    
     123 
    124124  #================================== 
    125125  # Define Outputs Name 
     
    137137  # Convert yyyy-mm-dd date to gregorian yyyymmdd 
    138138  DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) 
    139   DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 
     139  DateEnd=$(   IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd}  ) 
    140140 
    141141  # Period Length In Days between DateBegin and DateEnd 
     
    144144    IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that." 
    145145    IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates." 
    146     IGCM_debug_Verif_Exit  
     146    IGCM_debug_Verif_Exit 
    147147  fi 
    148148 
     
    205205  fi 
    206206 
    207   if ( ${FirstInitialize} ) ; then  
     207  if ( ${FirstInitialize} ) ; then 
    208208    IGCM_sys_MkdirArchive ${R_SAVE} 
    209209    IGCM_sys_Mkdir        ${R_BUFR} 
     
    217217    #Test state of run in run.card 
    218218    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 
    219      
     219 
    220220    if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 
    221       echo  
     221      echo 
    222222      IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 
    223223      IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 
     
    238238 
    239239  #==================================================== 
    240   # Experience type : DEB(ug), DEV(elopment), RUN  
     240  # Experience type : DEB(ug), DEV(elopment), RUN 
    241241  if [ X${JobType} != XRUN ] ; then 
    242242    echo 
     
    260260    if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then 
    261261      if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then 
    262         echo "------------" 
    263         echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency" 
    264         echo "          to PeriodLength : ${config_UserChoices_PeriodLength}" 
    265         echo "------------" 
    266         config_Post_RebuildFrequency=${config_UserChoices_PeriodLength} 
     262        echo "------------" 
     263        echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency" 
     264        echo "          to PeriodLength : ${config_UserChoices_PeriodLength}" 
     265        echo "------------" 
     266        config_Post_RebuildFrequency=${config_UserChoices_PeriodLength} 
    267267      fi 
    268268    fi 
     
    296296  case ${config_UserChoices_PeriodLength} in 
    297297  *Y|*y) 
    298     PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' )  
     298    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) 
    299299    IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}" 
    300300    PeriodLengthInDays=0 
    301301    i=0 
    302     until [ $i -ge $PeriodLengthInYears ] ; do  
    303       (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) ))  
    304       (( i=i+1 ))  
    305     done  
     302    until [ $i -ge $PeriodLengthInYears ] ; do 
     303      (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
     304      (( i=i+1 )) 
     305    done 
    306306    ;; 
    307307  *M|*m) 
    308     PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' )  
     308    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) 
    309309    IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 
    310310    PeriodLengthInDays=0 
    311311    i=0 
    312     until [ $i -ge $PeriodLengthInMonths ] ; do  
    313       if [ $(( month + i )) -lt 13 ] ; then  
    314         (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))   
    315       else  
    316         (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))   
    317       fi  
    318       (( i=i+1 ))  
    319     done  
     312    until [ $i -ge $PeriodLengthInMonths ] ; do 
     313      if [ $(( month + i )) -lt 13 ] ; then 
     314        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 
     315      else 
     316        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 
     317      fi 
     318      (( i=i+1 )) 
     319    done 
    320320    ;; 
    321   *D|*d)   
     321  *D|*d) 
    322322    PeriodLengthInMonths=0 
    323323    PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' );; 
    324   *)  
     324  *) 
    325325    IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." 
    326326    IGCM_debug_Verif_Exit ;; 
     
    371371  fi 
    372372 
    373   # Check PackFrequency against other key frequencies  
     373  # Check PackFrequency against other key frequencies 
    374374  # Modulo (PackFrequency and TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero 
    375375  if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then 
     
    393393    IGCM_debug_Print 1 "Check coherence between All Chunck2D frequency and TimeSeriesFrequency" 
    394394    IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 
    395     case ${value} in   
    396     *Y|*y) ;;  
    397     *)  IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" 
     395    case ${value} in 
     396    *Y|*y) ;; 
     397    *)  IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" 
    398398      IGCM_debug_Exit "This will stop the job" ;; 
    399399    esac 
     
    408408    IGCM_debug_Print 1 "Check coherence between All Chunck3D frequency and TimeSeriesFrequency" 
    409409    IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency 
    410     case ${value} in   
    411     *Y|*y) ;;  
    412     *)  IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" 
     410    case ${value} in 
     411    *Y|*y) ;; 
     412    *)  IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" 
    413413      IGCM_debug_Exit "This will stop the job" ;; 
    414414    esac 
     
    453453 
    454454    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" 
    455      
     455 
    456456  else 
    457457    #================================================# 
     
    462462    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState 
    463463    if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then 
    464       echo  
     464      echo 
    465465      IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" 
    466466      IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" 
     
    471471 
    472472    #===================================# 
    473     #        Read updated run.card      # 
     473    #        Read updated run.card      # 
    474474    #===================================# 
    475475 
     
    517517    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" 
    518518 
    519   fi     
     519  fi 
    520520  OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd} 
    521521 
     
    523523  # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y) 
    524524  year_m1=$(( year - 1 )) 
    525   year_p1=$(( year + 1 ))        
     525  year_p1=$(( year + 1 )) 
    526526  # Compute month_m1 (month minus 1M) 
    527527  # Compute yyyymm_m1 (yyyymm minus 1M) 
     
    556556  #===================================================================# 
    557557  # Prepare variables available for ${COMP}.card and ${COMP}.driver   # 
    558   #             But available to any son functions                    # 
     558  #             But available to any son functions                    # 
    559559  #===================================================================# 
    560560 
     
    589589    if [ ${DRYRUN} -le 0 ] ; then 
    590590      if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then 
    591         IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." 
    592         IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" 
    593         IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " 
    594         IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." 
    595         IGCM_debug_Print 1 " This exit has been initiated because at least ${R_BUF_KSH}/${PREFIX}_${Exe_Output} exists." 
    596         IGCM_debug_Verif_Exit 
     591        IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." 
     592        IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" 
     593        IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " 
     594        IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." 
     595        IGCM_debug_Print 1 " This exit has been initiated because at least ${R_BUF_KSH}/${PREFIX}_${Exe_Output} exists." 
     596        IGCM_debug_Verif_Exit 
    597597      fi 
    598598    fi 
     
    622622    eval ExeNameIn=\${config_Executable_${comp}[0]} 
    623623 
    624     # NO order in config.card for parallelized values !  
     624    # NO order in config.card for parallelized values ! 
    625625    # just use suffix : MPI , OMP and NOD (for number of NODes.) 
    626626 
     
    633633    # OMP is the number of OpenMP threads per MPI processus 
    634634    eval ${comp}_PROC_OMP=0 
    635          
     635 
    636636    # Only if we really have an executable for the component : 
    637637    if [ X${ExeNameIn} != X\"\" ] ; then 
     
    654654        (( j = 2 )) 
    655655 
    656         while [ $j -lt ${NbElts} ] ; do  
     656        while [ $j -lt ${NbElts} ] ; do 
    657657          eval tempvar=\${config_Executable_${comp}[${j}]} 
    658658 
    659659          if [ X${tempvar} = X ] ; then 
    660             echo "Error reading MPI/OMP parameters !!!"  
    661             echo "Check your config.card."  
     660            echo "Error reading MPI/OMP parameters !!!" 
     661            echo "Check your config.card." 
    662662            exit 1 
    663663          fi 
     
    666666 
    667667          case ${tempvar} in 
    668             *[mM][pP][iI]*) 
     668          *[mM][pP][iI]*) 
    669669               # Read MPI parameter for composante 
    670                eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" ) 
    671                OK_PARA_MPI=true;; 
    672             *[oO][mM][pP]*) 
     670            eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" ) 
     671            OK_PARA_MPI=true;; 
     672          *[oO][mM][pP]*) 
    673673               # Read OMP parameter for composante 
    674                eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" ) 
    675                OK_PARA_OMP=true;; 
    676             *[nN][oO][dD]*) 
     674            eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" ) 
     675            OK_PARA_OMP=true;; 
     676          *[nN][oO][dD]*) 
    677677               # Read NOD (NumBer of Nodes) parameter for composante 
    678                eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" ) 
    679                OK_PARA_NOD=true 
    680                OK_PARA_MPI=true;; 
     678            eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" ) 
     679            OK_PARA_NOD=true 
     680            OK_PARA_MPI=true;; 
    681681          esac 
    682682 
     
    731731          PROCESSUS_NUMBER=${BATCH_NUM_PROC_TOT} 
    732732        fi 
    733       else  
     733      else 
    734734        PROCESSUS_NUMBER=1 
    735735      fi 
     
    807807  eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}" 
    808808 
    809       IGCM_card_CheckConflict run.card 
    810       IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card rw 
    811  
    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 
     809  IGCM_card_CheckConflict run.card 
     810  IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card rw 
     811 
     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 
    817817 
    818818      #==================================# 
     
    820820      #==================================# 
    821821 
    822       (( i=0 )) 
    823       if ( ${FirstInitialize} ) ; then 
    824         run_Log_LastExeSize="" 
    825         for comp in ${config_ListOfComponents[*]} ; do 
    826           run_Log_LastExeSize[$i]=0 
    827           (( i=i+1 )) 
    828         done 
    829       else 
    830         IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
    831       fi 
     822  (( i=0 )) 
     823  if ( ${FirstInitialize} ) ; then 
     824    run_Log_LastExeSize="" 
     825    for comp in ${config_ListOfComponents[*]} ; do 
     826      run_Log_LastExeSize[$i]=0 
     827      (( i=i+1 )) 
     828    done 
     829  else 
     830    IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize 
     831  fi 
    832832      #==================================# 
    833       #         And Build ExeDate        # 
     833      #         And Build ExeDate        # 
    834834      #==================================# 
    835835 
     
    837837      # 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") 
    838838      # 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]} 
    864           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 
     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]} 
     864      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 
    894894 
    895895# SD : switch off for now 
     
    899899#      fi 
    900900 
    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", \ 
     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", \ 
    912912            $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 
     913    fi 
     914    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt" 
     915  fi 
    916916 
    917917      # All was right ? no ? then we stop. 
    918       IGCM_debug_Verif_Exit 
     918  IGCM_debug_Verif_Exit 
    919919 
    920920      # If all was OK, we can delete all files not necessary for next Job 
    921       echo 
    922       IGCM_debug_Print 1 "Files that will be deleted before next period-run : " 
    923  
    924       if [ ${DRYRUN} -le 2 ] ; then 
    925         for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done 
    926       else 
    927         echo ${FileToBeDeleted[@]} 
    928       fi 
     921  echo 
     922  IGCM_debug_Print 1 "Files that will be deleted before next period-run : " 
     923 
     924  if [ ${DRYRUN} -le 2 ] ; then 
     925    for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done 
     926  else 
     927    echo ${FileToBeDeleted[@]} 
     928  fi 
    929929 
    930930      #=================================================# 
    931       #         Modification of libIGCM behaviour       # 
     931      #         Modification of libIGCM behaviour       # 
    932932      #=================================================# 
    933933 
    934934      # To use this function, one must copy libIGCM.card from ${libIGCM} directory 
    935935      # 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.  
    937       if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then 
    938         echo 
    939         echo "########################################################################" 
    940         echo "!!!                 Modification of libIGCM behaviour                !!!" 
    941         echo 
    942  
    943         IGCM_debug_Print 1 "DefineArrayFromOption  : libIGCM_UserChanges in libIGCM.card" 
    944         IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges 
    945         IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]} 
    946  
    947         # Special treatments for libIGCM internals 
    948         for option in ${libIGCM_UserChanges[*]} ; do 
    949           IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option} 
    950  
    951           echo "We will change : ${option}." 
    952           eval echo "Previous value : " \${${option}} 
    953           eval echo "Change to : " \${libIGCM_UserChanges_${option}} 
    954            
    955           eval ${option}=\${libIGCM_UserChanges_${option}} 
    956  
    957           case ${option} in 
    958           config_UserChoices_DateEnd) 
    959           IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd 
    960           DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 
     936      # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. 
     937  if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then 
     938    echo 
     939    echo "########################################################################" 
     940    echo "!!!                 Modification of libIGCM behaviour                !!!" 
     941    echo 
     942 
     943    IGCM_debug_Print 1 "DefineArrayFromOption  : libIGCM_UserChanges in libIGCM.card" 
     944    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges 
     945    IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]} 
     946 
     947        # Special treatments for libIGCM internals 
     948    for option in ${libIGCM_UserChanges[*]} ; do 
     949      IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option} 
     950 
     951      echo "We will change : ${option}." 
     952      eval echo "Previous value : " \${${option}} 
     953      eval echo "Change to : " \${libIGCM_UserChanges_${option}} 
     954 
     955      eval ${option}=\${libIGCM_UserChanges_${option}} 
     956 
     957      case ${option} in 
     958      config_UserChoices_DateEnd) 
     959        IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd 
     960        DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) 
    961961 
    962962          # Period Length In Days between DateBegin and DateEnd 
    963           (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 )) 
    964           if [ ${ExperienceLengthInDays} -lt 0 ] ; then 
    965             IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that." 
    966             IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates." 
    967             IGCM_debug_Verif_Exit  
    968           fi 
    969           ;; 
    970           config_UserChoices_PeriodLength) 
    971         IGCM_debug_Print 1  "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}" 
    972         ;; 
    973         PeriodNb) 
    974               IGCM_debug_Print 1  "Loop in main Job with ${PeriodNb} period(s)" 
    975               ;; 
    976               config_Post_RebuildFrequency) 
    977             IGCM_debug_Print 1  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" 
    978             IGCM_post_Configure 
    979             ;; 
    980             config_Post_TimeSeriesFrequency) 
    981     IGCM_debug_Print 1  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize" 
    982     IGCM_post_Configure 
    983     ;; 
    984     config_Post_SeasonalFrequency) 
    985   IGCM_debug_Print 1  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize" 
    986   IGCM_post_Configure 
    987   ;; 
    988   esac 
    989   done 
    990  
    991   echo 
    992   echo "########################################################################" 
    993   echo 
     963        (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 )) 
     964        if [ ${ExperienceLengthInDays} -lt 0 ] ; then 
     965          IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that." 
     966          IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates." 
     967          IGCM_debug_Verif_Exit 
     968        fi 
     969        ;; 
     970      config_UserChoices_PeriodLength) 
     971        IGCM_debug_Print 1  "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}" 
     972        ;; 
     973      PeriodNb) 
     974        IGCM_debug_Print 1  "Loop in main Job with ${PeriodNb} period(s)" 
     975        ;; 
     976      config_Post_RebuildFrequency) 
     977        IGCM_debug_Print 1  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" 
     978        IGCM_post_Configure 
     979        ;; 
     980      config_Post_TimeSeriesFrequency) 
     981        IGCM_debug_Print 1  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize" 
     982        IGCM_post_Configure 
     983        ;; 
     984      config_Post_SeasonalFrequency) 
     985        IGCM_debug_Print 1  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize" 
     986        IGCM_post_Configure 
     987        ;; 
     988      esac 
     989    done 
     990 
     991    echo 
     992    echo "########################################################################" 
     993    echo 
    994994  fi 
    995995 
     
    10241024 
    10251025  #=================================================# 
    1026   #             Write updated run.card              # 
     1026  #             Write updated run.card              # 
    10271027  #=================================================# 
    10281028 
     
    10941094    ls -la 
    10951095  fi 
    1096    
     1096 
    10971097  # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 
    10981098  # Only for production run (No clean up in DEV or DEB mode) 
Note: See TracChangeset for help on using the changeset viewer.