[2] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sebastien Denvil, Martial Mancip |
---|
[373] | 5 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr Martial.Mancip__at__ipsl.jussieu.fr |
---|
| 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
[2] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | #=================================== |
---|
| 15 | function IGCM_config_Initialize |
---|
| 16 | { |
---|
[571] | 17 | IGCM_debug_PushStack "IGCM_config_Initialize" |
---|
[2] | 18 | |
---|
[571] | 19 | # Debug Print : |
---|
| 20 | echo |
---|
| 21 | IGCM_debug_Print 1 "IGCM_config_Initialize" |
---|
[2] | 22 | |
---|
[571] | 23 | if [ ! -r ${SUBMIT_DIR}/run.card ]; then |
---|
| 24 | #================================================# |
---|
| 25 | # The file run.card doesn't exist # |
---|
| 26 | #================================================# |
---|
| 27 | FirstInitialize=true |
---|
| 28 | #copy initial run.card |
---|
| 29 | IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card |
---|
| 30 | IGCM_debug_Print 2 "run.card copied from run.card.init" |
---|
| 31 | else |
---|
| 32 | FirstInitialize=false |
---|
| 33 | IGCM_debug_Print 2 "run.card exists" |
---|
| 34 | fi |
---|
[443] | 35 | |
---|
[571] | 36 | # Test modipsl tree existence. |
---|
| 37 | IGCM_sys_TestDir ${MODIPSL} |
---|
| 38 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
| 39 | IGCM_sys_TestDir ${libIGCM} |
---|
| 40 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
| 41 | IGCM_sys_TestDir ${R_EXE} |
---|
| 42 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
| 43 | IGCM_sys_TestDir ${SUBMIT_DIR} |
---|
| 44 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir" |
---|
[2] | 45 | |
---|
[571] | 46 | if ( $DEBUG_debug ) ; then |
---|
| 47 | echo "Keep trace of inital SUBMIT_DIR : " |
---|
| 48 | ls -lta ${SUBMIT_DIR} |
---|
| 49 | fi |
---|
[144] | 50 | |
---|
[571] | 51 | #================================== |
---|
[2] | 52 | |
---|
[571] | 53 | typeset option auxprint CompatibilityTag |
---|
| 54 | # Read libIGCM compatibility version in config.card |
---|
| 55 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM |
---|
| 56 | eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1 |
---|
[2] | 57 | |
---|
[571] | 58 | if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then |
---|
| 59 | IGCM_debug_Exit "config.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ." |
---|
| 60 | fi |
---|
[2] | 61 | |
---|
[571] | 62 | #================================== |
---|
[592] | 63 | # Read UserChoices section: |
---|
[571] | 64 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices |
---|
[2] | 65 | |
---|
[571] | 66 | for option in ${config_UserChoices[*]} ; do |
---|
| 67 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option} |
---|
| 68 | done |
---|
| 69 | echo |
---|
| 70 | IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" |
---|
| 71 | # Name Space of this experience |
---|
| 72 | if [ X${config_UserChoices_SpaceName} != X ] ; then |
---|
| 73 | IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName |
---|
| 74 | fi |
---|
| 75 | # Expericence class of the run |
---|
| 76 | if [ X${config_UserChoices_ExperimentName} != X ] ; then |
---|
| 77 | IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName |
---|
| 78 | fi |
---|
| 79 | IGCM_debug_PrintVariables 3 config_UserChoices_JobName |
---|
| 80 | if [ 3 -le ${Verbosity} ] ; then |
---|
| 81 | echo "--------------Debug3-->" "config_UserChoices_LongName=" |
---|
| 82 | echo "--------------Debug3-->" \"${config_UserChoices_LongName}\" |
---|
| 83 | fi |
---|
| 84 | IGCM_debug_PrintVariables 3 config_UserChoices_TagName |
---|
| 85 | IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType |
---|
| 86 | IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin |
---|
| 87 | IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd |
---|
| 88 | IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength |
---|
[2] | 89 | |
---|
[571] | 90 | #================================== |
---|
[592] | 91 | # Read Post section: |
---|
| 92 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post |
---|
| 93 | echo |
---|
| 94 | IGCM_debug_Print 1 "DefineArrayFromOption : config_Post" |
---|
[2] | 95 | |
---|
[592] | 96 | for option in ${config_Post[*]} ; do |
---|
| 97 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option} |
---|
| 98 | eval auxprint=\${config_Post_${option}} |
---|
| 99 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
| 100 | done |
---|
| 101 | |
---|
| 102 | #================================== |
---|
| 103 | # Define default value to keep compatibility with previous card: means before changes due to TGCC |
---|
| 104 | [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency} |
---|
| 105 | |
---|
| 106 | #================================== |
---|
| 107 | # Read ListOfComponents section: |
---|
[571] | 108 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents |
---|
| 109 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 110 | IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} |
---|
| 111 | done |
---|
[2] | 112 | |
---|
[571] | 113 | echo |
---|
| 114 | IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents" |
---|
| 115 | IGCM_debug_Print 3 ${config_ListOfComponents[*]} |
---|
[2] | 116 | |
---|
[571] | 117 | NbComponents=${#config_ListOfComponents[*]} |
---|
[2] | 118 | |
---|
[571] | 119 | #================================== |
---|
| 120 | # Define principal executable |
---|
| 121 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Executable |
---|
| 122 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name |
---|
| 123 | |
---|
| 124 | #================================== |
---|
| 125 | # Define Outputs Name |
---|
| 126 | IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output" |
---|
| 127 | eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} |
---|
| 128 | IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" |
---|
| 129 | eval Exe_Output=out_${config_Executable_Name} |
---|
| 130 | IGCM_debug_Print 3 "Exe_Output = ${Exe_Output}" |
---|
[2] | 131 | |
---|
[571] | 132 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Executable |
---|
| 133 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name |
---|
[2] | 134 | |
---|
[571] | 135 | #================================== |
---|
| 136 | # Define Outputs Name |
---|
| 137 | IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output" |
---|
| 138 | eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} |
---|
| 139 | IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" |
---|
| 140 | Exe_Output=out_execution |
---|
| 141 | #================================== |
---|
[2] | 142 | |
---|
[571] | 143 | #===================================================================# |
---|
| 144 | # Prepare variables available for ${COMP}.card and ${COMP}.driver # |
---|
| 145 | # But available to any son functions # |
---|
| 146 | #===================================================================# |
---|
[2] | 147 | |
---|
[571] | 148 | # Convert yyyy-mm-dd date to gregorian yyyymmdd |
---|
| 149 | DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} ) |
---|
| 150 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
[2] | 151 | |
---|
[571] | 152 | # Period Length In Days between DateBegin and DateEnd |
---|
| 153 | (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) |
---|
| 154 | if [ ${ExperienceLengthInDays} -lt 0 ] ; then |
---|
| 155 | IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that." |
---|
| 156 | IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates." |
---|
| 157 | IGCM_debug_Verif_Exit |
---|
| 158 | fi |
---|
[2] | 159 | |
---|
[571] | 160 | # Day and Year of Initial State (Given in julian format) |
---|
| 161 | InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 )) |
---|
| 162 | InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 )) |
---|
[2] | 163 | |
---|
[571] | 164 | #================================== |
---|
| 165 | # Restarts : Gerneral rule or local for each component ? |
---|
| 166 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts |
---|
[2] | 167 | |
---|
[571] | 168 | echo |
---|
| 169 | IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts" |
---|
[2] | 170 | |
---|
[571] | 171 | for option in ${config_Restarts[*]} ; do |
---|
| 172 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option} |
---|
| 173 | eval auxprint=\${config_Restarts_${option}} |
---|
| 174 | IGCM_debug_Print 3 "${option} : ${auxprint}" |
---|
| 175 | done |
---|
[2] | 176 | |
---|
[571] | 177 | #================================================================# |
---|
| 178 | # Test and Prepare directories # |
---|
| 179 | #================================================================# |
---|
[2] | 180 | |
---|
[571] | 181 | # ==> 4 kinds of input files : |
---|
| 182 | # 1) R_INIT : Initial State Files (Etat0, carteveg) |
---|
| 183 | # 2) R_BC : Boundary Conditions (Forcages, lai) |
---|
| 184 | # 3) Parameters files (allready define through ${SUBMIT_DIR}) |
---|
| 185 | # 4) Restarts files (allready define in IGCM_config_Initialize) |
---|
[2] | 186 | |
---|
[571] | 187 | # Here we offer the possibility to redefine R_INIT, R_BC |
---|
| 188 | # and PeriodNb through config.card |
---|
| 189 | R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT} |
---|
| 190 | IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb" |
---|
| 191 | IGCM_debug_Print 3 "R_INIT=${R_INIT}" |
---|
| 192 | R_BC=${config_UserChoices_R_BC:=${R_IN}/BC} |
---|
| 193 | IGCM_debug_Print 3 "R_BC=${R_BC}" |
---|
| 194 | PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}} |
---|
| 195 | IGCM_debug_Print 3 "Loop in main Job with ${PeriodNb} period(s)" |
---|
[2] | 196 | |
---|
[571] | 197 | # Test Archive input/output. |
---|
| 198 | IGCM_sys_TestDirArchive ${ARCHIVE} |
---|
| 199 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
| 200 | IGCM_sys_TestDirArchive ${R_IN} |
---|
| 201 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
[2] | 202 | |
---|
[571] | 203 | #==================================================== |
---|
| 204 | #R_SAVE : Job output directory |
---|
| 205 | if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then |
---|
| 206 | FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) |
---|
| 207 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
[592] | 208 | R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
[571] | 209 | R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
| 210 | R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} |
---|
| 211 | else |
---|
| 212 | R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
[592] | 213 | R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
[571] | 214 | R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
| 215 | R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
| 216 | fi |
---|
[2] | 217 | |
---|
[571] | 218 | if ( ${FirstInitialize} ) ; then |
---|
| 219 | IGCM_sys_MkdirArchive ${R_SAVE} |
---|
| 220 | IGCM_sys_Mkdir ${R_BUFR} |
---|
| 221 | else |
---|
| 222 | IGCM_sys_TestDirArchive ${R_SAVE} |
---|
| 223 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive ${R_SAVE}" |
---|
[2] | 224 | |
---|
[571] | 225 | IGCM_sys_TestDir ${R_BUFR} |
---|
| 226 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir ${R_BUFR}" |
---|
| 227 | |
---|
| 228 | #Test state of run in run.card |
---|
| 229 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState |
---|
| 230 | |
---|
| 231 | if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then |
---|
| 232 | echo |
---|
| 233 | IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" |
---|
| 234 | IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" |
---|
| 235 | IGCM_debug_Exit |
---|
| 236 | IGCM_debug_Verif_Exit |
---|
[2] | 237 | fi |
---|
[571] | 238 | fi |
---|
[2] | 239 | |
---|
[571] | 240 | #==================================================== |
---|
| 241 | # Define REBUILD_DIR : where we store files needing rebuild process |
---|
| 242 | if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then |
---|
| 243 | REBUILD_DIR=${R_SAVE}/TMP |
---|
| 244 | IGCM_sys_MkdirArchive ${REBUILD_DIR} |
---|
| 245 | else |
---|
| 246 | REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
| 247 | IGCM_sys_MkdirWork ${REBUILD_DIR} |
---|
| 248 | fi |
---|
[128] | 249 | |
---|
[571] | 250 | #==================================================== |
---|
| 251 | # Experience type : DEB(ug), DEV(elopment), RUN |
---|
| 252 | if [ X${JobType} != XRUN ] ; then |
---|
| 253 | echo |
---|
| 254 | echo "====================================================" |
---|
| 255 | echo "libIGCM JOB is NOT in RUN type mode." |
---|
| 256 | echo "!! OUTPUT files will NOT be PROTECTED !!" |
---|
| 257 | echo "Be carefull : you can ERASE the result of this job !" |
---|
[166] | 258 | |
---|
[571] | 259 | case ${JobType} in |
---|
| 260 | DEB) |
---|
| 261 | echo "DEBUG mode : activation of 'set -vx' mode." |
---|
| 262 | echo "DEBUG mode : no protection for output files." |
---|
| 263 | echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency." |
---|
| 264 | ;; |
---|
| 265 | DEV) |
---|
| 266 | echo "DEVelopment mode : no protection for output files." |
---|
| 267 | echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency." |
---|
| 268 | ;; |
---|
| 269 | esac |
---|
| 270 | |
---|
| 271 | if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then |
---|
| 272 | if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then |
---|
| 273 | echo "------------" |
---|
| 274 | echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency" |
---|
| 275 | echo " to PeriodLength : ${config_UserChoices_PeriodLength}" |
---|
| 276 | echo "------------" |
---|
| 277 | config_Post_RebuildFrequency=${config_UserChoices_PeriodLength} |
---|
| 278 | fi |
---|
[128] | 279 | fi |
---|
[571] | 280 | echo "====================================================" |
---|
| 281 | echo |
---|
| 282 | fi |
---|
[128] | 283 | |
---|
[571] | 284 | #==================================================== |
---|
| 285 | #R_OUT_KSH : Storage place for job output |
---|
| 286 | #R_OUT_EXE : Storage place for binary used during simulation |
---|
| 287 | R_OUT_KSH=${R_SAVE}/Out |
---|
| 288 | R_OUT_EXE=${R_SAVE}/Exe |
---|
[166] | 289 | |
---|
[571] | 290 | #==================================================== |
---|
| 291 | #R_BUF_KSH : Buffer place for job output |
---|
| 292 | #R_BUF_EXE : Buffer place for binary used during simulation |
---|
| 293 | R_BUF_KSH=${R_BUFR}/Out |
---|
| 294 | R_BUF_EXE=${R_BUFR}/Exe |
---|
| 295 | |
---|
| 296 | IGCM_debug_PopStack "IGCM_config_Initialize" |
---|
[2] | 297 | } |
---|
| 298 | |
---|
| 299 | #=================================== |
---|
[118] | 300 | function IGCM_config_Analyse_PeriodLength |
---|
| 301 | { |
---|
[571] | 302 | IGCM_debug_PushStack "IGCM_config_Analyse_PeriodLength" |
---|
[118] | 303 | |
---|
[571] | 304 | typeset i |
---|
[124] | 305 | |
---|
[571] | 306 | # Determine number of day(s) in PeriodLength : |
---|
| 307 | case ${config_UserChoices_PeriodLength} in |
---|
| 308 | *Y|*y) |
---|
| 309 | PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) |
---|
| 310 | IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}" |
---|
| 311 | PeriodLengthInDays=0 |
---|
| 312 | i=0 |
---|
| 313 | until [ $i -ge $PeriodLengthInYears ] ; do |
---|
| 314 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) |
---|
| 315 | (( i=i+1 )) |
---|
| 316 | done |
---|
| 317 | ;; |
---|
| 318 | *M|*m) |
---|
| 319 | PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) |
---|
| 320 | IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}" |
---|
| 321 | PeriodLengthInDays=0 |
---|
| 322 | i=0 |
---|
| 323 | until [ $i -ge $PeriodLengthInMonths ] ; do |
---|
| 324 | if [ $(( month + i )) -lt 13 ] ; then |
---|
| 325 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) |
---|
| 326 | else |
---|
| 327 | (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) |
---|
| 328 | fi |
---|
| 329 | (( i=i+1 )) |
---|
| 330 | done |
---|
| 331 | ;; |
---|
| 332 | *D|*d) |
---|
| 333 | PeriodLengthInMonths=0 |
---|
| 334 | PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' );; |
---|
| 335 | *) |
---|
| 336 | IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." |
---|
| 337 | IGCM_debug_Verif_Exit ;; |
---|
| 338 | esac |
---|
[118] | 339 | |
---|
[571] | 340 | IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength" |
---|
[380] | 341 | } |
---|
[118] | 342 | |
---|
[380] | 343 | #=================================== |
---|
| 344 | function IGCM_config_Check |
---|
| 345 | { |
---|
[571] | 346 | IGCM_debug_PushStack "IGCM_config_Check" |
---|
[380] | 347 | |
---|
[571] | 348 | # If one of the following modulo is not zero : |
---|
| 349 | # we will issue an error then explain and exit in |
---|
| 350 | # AA_job IGCM_debug_Verif_Exit call before binary submission |
---|
[380] | 351 | |
---|
[571] | 352 | echo |
---|
| 353 | IGCM_debug_Print 1 "IGCM_config_Check" |
---|
| 354 | echo |
---|
| 355 | |
---|
| 356 | typeset i |
---|
| 357 | |
---|
| 358 | # Check RebuildFrequency against key frequencies : PeriodLength ; PackFrequency ; TimeSeriesFrequency ; SeasonalFrequency |
---|
| 359 | if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then |
---|
| 360 | AsynchronousRebuild=true |
---|
| 361 | IGCM_debug_Print 1 "Asynchronous rebuild has been activated." |
---|
[380] | 362 | echo |
---|
[571] | 363 | # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero |
---|
| 364 | IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength" |
---|
| 365 | IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength |
---|
| 366 | IGCM_debug_Print 1 "Check coherence between PackFrequency and RebuildFrequency" |
---|
| 367 | IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_Post_RebuildFrequency |
---|
| 368 | IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency" |
---|
| 369 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency |
---|
| 370 | IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency" |
---|
| 371 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency |
---|
| 372 | else |
---|
| 373 | AsynchronousRebuild=false |
---|
| 374 | IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" |
---|
| 375 | IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" |
---|
[380] | 376 | echo |
---|
[571] | 377 | #modulo (PeriodLength and TimeSeriesFrequency/SeasonalFrequency) must be zero |
---|
| 378 | IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength" |
---|
| 379 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength |
---|
| 380 | IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength" |
---|
| 381 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength |
---|
| 382 | fi |
---|
[380] | 383 | |
---|
[571] | 384 | # Check PackFrequency against other key frequencies |
---|
| 385 | # Modulo (PackFrequency and TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero |
---|
| 386 | if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then |
---|
| 387 | Pack=true |
---|
| 388 | # |
---|
| 389 | IGCM_debug_Print 1 "Check coherence between PackFrequency and PeriodLength" |
---|
| 390 | IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_UserChoices_PeriodLength |
---|
| 391 | IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PackFrequency" |
---|
| 392 | IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_PackFrequency |
---|
| 393 | IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PackFrequency" |
---|
| 394 | IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_PackFrequency |
---|
| 395 | else |
---|
| 396 | Pack=false |
---|
| 397 | fi |
---|
[387] | 398 | |
---|
[571] | 399 | #modulo (TimeSeriesFrequency and all Chunck2D) must be zero |
---|
| 400 | NbJob=${#CHUNCK2D_SIZE[@]} |
---|
| 401 | i=0 |
---|
| 402 | until [ $i -ge $NbJob ]; do |
---|
| 403 | value=${CHUNCK2D_SIZE[${i}]} |
---|
| 404 | IGCM_debug_Print 1 "Check coherence between All Chunck2D frequency and TimeSeriesFrequency" |
---|
| 405 | IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency |
---|
| 406 | case ${value} in |
---|
| 407 | *Y|*y) ;; |
---|
| 408 | *) IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card" |
---|
| 409 | IGCM_debug_Exit "This will stop the job" ;; |
---|
| 410 | esac |
---|
| 411 | (( i=i+1 )) |
---|
| 412 | done |
---|
[380] | 413 | |
---|
[571] | 414 | #modulo (TimeSeriesFrequency and all Chunck3D) must be zero |
---|
| 415 | NbJob=${#CHUNCK3D_SIZE[@]} |
---|
| 416 | i=0 |
---|
| 417 | until [ $i -ge $NbJob ]; do |
---|
| 418 | value=${CHUNCK3D_SIZE[${i}]} |
---|
| 419 | IGCM_debug_Print 1 "Check coherence between All Chunck3D frequency and TimeSeriesFrequency" |
---|
| 420 | IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency |
---|
| 421 | case ${value} in |
---|
| 422 | *Y|*y) ;; |
---|
| 423 | *) IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card" |
---|
| 424 | IGCM_debug_Exit "This will stop the job" ;; |
---|
| 425 | esac |
---|
| 426 | (( i=i+1 )) |
---|
| 427 | done |
---|
[387] | 428 | |
---|
[571] | 429 | IGCM_debug_PopStack "IGCM_config_Check" |
---|
[118] | 430 | } |
---|
| 431 | |
---|
| 432 | #=================================== |
---|
[2] | 433 | function IGCM_config_PeriodStart |
---|
| 434 | { |
---|
[571] | 435 | IGCM_debug_PushStack "IGCM_config_PeriodStart" |
---|
[2] | 436 | |
---|
[571] | 437 | echo |
---|
| 438 | IGCM_debug_Print 1 "IGCM_config_PeriodStart" |
---|
| 439 | echo |
---|
[2] | 440 | |
---|
[571] | 441 | if ( ${FirstInitialize} ) ; then |
---|
| 442 | #================================================# |
---|
| 443 | # Initialize date/period information # |
---|
| 444 | #================================================# |
---|
[2] | 445 | |
---|
[571] | 446 | IGCM_date_GetYearMonthDay $DateBegin year month day |
---|
| 447 | IGCM_config_Analyse_PeriodLength |
---|
[2] | 448 | |
---|
[571] | 449 | eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1 |
---|
| 450 | PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) ) |
---|
| 451 | eval CumulPeriod=1 > /dev/null 2>&1 |
---|
[2] | 452 | |
---|
[571] | 453 | #=================================================# |
---|
| 454 | # Write updated run.card # |
---|
| 455 | #=================================================# |
---|
[2] | 456 | |
---|
[571] | 457 | #Correct run.card Configuration for this period |
---|
| 458 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} |
---|
| 459 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} |
---|
| 460 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} |
---|
| 461 | if [ X$( grep "SubmitPath" ${SUBMIT_DIR}/run.card ) != X ] ; then |
---|
| 462 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR} |
---|
| 463 | fi |
---|
[427] | 464 | |
---|
[571] | 465 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" |
---|
| 466 | |
---|
| 467 | else |
---|
| 468 | #================================================# |
---|
| 469 | # The file run.card allready exist # |
---|
| 470 | #================================================# |
---|
[2] | 471 | |
---|
[571] | 472 | #Test state of run in run.card |
---|
| 473 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState |
---|
| 474 | if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then |
---|
| 475 | echo |
---|
| 476 | IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!" |
---|
| 477 | IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this" |
---|
| 478 | echo |
---|
| 479 | IGCM_debug_Exit |
---|
| 480 | IGCM_debug_Verif_Exit |
---|
| 481 | fi |
---|
[2] | 482 | |
---|
[571] | 483 | #===================================# |
---|
| 484 | # Read updated run.card # |
---|
| 485 | #===================================# |
---|
[2] | 486 | |
---|
[571] | 487 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix |
---|
| 488 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin |
---|
| 489 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd |
---|
| 490 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod |
---|
[2] | 491 | |
---|
[571] | 492 | PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) |
---|
| 493 | PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} ) |
---|
| 494 | eval CumulPeriod="${run_Configuration_CumulPeriod}" > /dev/null 2>&1 |
---|
[2] | 495 | |
---|
[571] | 496 | LastPeriodDateEnd=$( echo ${run_Configuration_OldPrefix} | sed -e "s/${config_UserChoices_JobName}_//" ) |
---|
[471] | 497 | |
---|
[571] | 498 | typeset LastDate |
---|
| 499 | set +A LastDate -- $( echo ${LastPeriodDateEnd} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1 \2 \3/" ) |
---|
| 500 | LastYearDateEnd=${LastDate[0]} |
---|
| 501 | LastMonthDateEnd=${LastDate[1]} |
---|
| 502 | LastDayDateEnd=${LastDate[2]} |
---|
[471] | 503 | |
---|
[571] | 504 | if [ ${Period} = 1 ]; then |
---|
| 505 | # save last Job output |
---|
| 506 | typeset LastPeriod iLastPeriod Last_Script_Output_Name |
---|
| 507 | (( LastPeriod=CumulPeriod-PeriodNb )) |
---|
| 508 | iLastPeriod=$( printf "%06d" ${LastPeriod} ) |
---|
| 509 | Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${iLastPeriod}" |
---|
| 510 | Last_run_card="run.card.${iLastPeriod}" |
---|
| 511 | #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name} |
---|
| 512 | #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_BUF_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1 |
---|
| 513 | IGCM_debug_Print 2 "Try to save previous ksh job output" |
---|
| 514 | IGCM_sys_Cd ${SUBMIT_DIR}/ |
---|
| 515 | IGCM_sys_PutBuffer_Out ${Last_Script_Output_Name} ${R_BUF_KSH}/${Last_Script_Output_Name}.$$ rw |
---|
[471] | 516 | |
---|
[571] | 517 | IGCM_card_CheckConflict run.card |
---|
| 518 | IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/${Last_run_card}.$$ rw |
---|
[471] | 519 | |
---|
[571] | 520 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 521 | else |
---|
| 522 | unset FileToBeDeleted |
---|
| 523 | fi |
---|
[2] | 524 | |
---|
[571] | 525 | IGCM_date_GetYearMonthDay $PeriodDateBegin year month day |
---|
| 526 | IGCM_config_Analyse_PeriodLength |
---|
[2] | 527 | |
---|
[571] | 528 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running" |
---|
[2] | 529 | |
---|
[571] | 530 | fi |
---|
| 531 | OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd} |
---|
[2] | 532 | |
---|
[571] | 533 | # BEGIN: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh |
---|
| 534 | # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y) |
---|
| 535 | year_m1=$(( year - 1 )) |
---|
| 536 | year_p1=$(( year + 1 )) |
---|
| 537 | # Compute month_m1 (month minus 1M) |
---|
| 538 | # Compute yyyymm_m1 (yyyymm minus 1M) |
---|
| 539 | month_m1=$(( month - 1 )) |
---|
| 540 | if [ ${month_m1} = 0 ]; then |
---|
| 541 | month_m1=12 |
---|
| 542 | yyyymm_m1=${year_m1}12 |
---|
| 543 | elif [ ${month_m1} -le 9 ]; then |
---|
| 544 | month_m1=0${month_m1} |
---|
| 545 | yyyymm_m1=${year}${month_m1} |
---|
| 546 | else |
---|
| 547 | yyyymm_m1=${year}${month_m1} |
---|
| 548 | fi |
---|
| 549 | # Compute month_p1 (month plus 1M) |
---|
| 550 | # Compute yyyymm_p1 (yyyymm plus 1M) |
---|
| 551 | month_p1=$(( month + 1 )) |
---|
| 552 | if [ ${month_p1} = 13 ]; then |
---|
| 553 | month_p1=01 |
---|
| 554 | yyyymm_p1=${year_p1}01 |
---|
| 555 | elif [ ${month_p1} -le 9 ]; then |
---|
| 556 | month_p1=0${month_p1} |
---|
| 557 | yyyymm_p1=${year}${month_p1} |
---|
| 558 | else |
---|
| 559 | yyyymm_p1=${year}${month_p1} |
---|
| 560 | fi |
---|
| 561 | #IGCM_debug_Print 1 "jg 1 month_m1 = ${month_m1} month_p1 = ${month_p1} " |
---|
| 562 | #IGCM_debug_Print 1 "jg 1 calculate yyyymm_m1 = ${yyyymm_m1} " |
---|
| 563 | #IGCM_debug_Print 1 "jg 1 calculate yyyymm_p1 = ${yyyymm_p1} " |
---|
[2] | 564 | |
---|
[571] | 565 | # END: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh |
---|
[2] | 566 | |
---|
[571] | 567 | #===================================================================# |
---|
| 568 | # Prepare variables available for ${COMP}.card and ${COMP}.driver # |
---|
| 569 | # But available to any son functions # |
---|
| 570 | #===================================================================# |
---|
[2] | 571 | |
---|
[571] | 572 | # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !) |
---|
| 573 | (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 )) |
---|
[2] | 574 | |
---|
[571] | 575 | # Debug Print : |
---|
| 576 | IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution" |
---|
| 577 | IGCM_debug_Print 1 "Year of simulation : ${year}" |
---|
| 578 | IGCM_debug_Print 1 "Month of simulation : ${month}" |
---|
| 579 | IGCM_debug_Print 1 "PeriodLengthInDays : ${PeriodLengthInDays}" |
---|
| 580 | IGCM_debug_Print 1 "PeriodDateBegin : ${PeriodDateBegin}" |
---|
| 581 | IGCM_debug_Print 1 "PeriodDateEnd : ${PeriodDateEnd}" |
---|
| 582 | IGCM_debug_Print 1 "SimulationLengthInDays : ${SimulationLengthInDays}" |
---|
| 583 | IGCM_debug_Print 1 "ExperienceLengthInDays : ${ExperienceLengthInDays}" |
---|
[2] | 584 | |
---|
[571] | 585 | #================================================================# |
---|
| 586 | # Prepare variables available for comp_finalyze # |
---|
| 587 | #================================================================# |
---|
[2] | 588 | |
---|
[571] | 589 | # Period for save files |
---|
| 590 | eval DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} > /dev/null 2>&1 |
---|
| 591 | |
---|
| 592 | # Prefix for save files of this period |
---|
| 593 | eval PREFIX=${config_UserChoices_JobName}_${DatesPeriod} > /dev/null 2>&1 |
---|
| 594 | |
---|
| 595 | # List of files that will be deleted in RUN_DIR after run |
---|
| 596 | [ -f stack ] && FileToBeDeleted[0]="stack" |
---|
| 597 | |
---|
| 598 | # Test if the same run as already been saved : |
---|
| 599 | if [ X${JobType} = XRUN ] ; then |
---|
| 600 | if [ ${DRYRUN} -le 0 ] ; then |
---|
| 601 | if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then |
---|
| 602 | IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job." |
---|
| 603 | IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files" |
---|
| 604 | IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or " |
---|
| 605 | IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory." |
---|
| 606 | IGCM_debug_Print 1 " This exit has been initiated because at least ${R_BUF_KSH}/${PREFIX}_${Exe_Output} exists." |
---|
| 607 | IGCM_debug_Verif_Exit |
---|
| 608 | fi |
---|
[2] | 609 | fi |
---|
[571] | 610 | else |
---|
| 611 | if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then |
---|
| 612 | IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode." |
---|
| 613 | fi |
---|
| 614 | fi |
---|
[128] | 615 | |
---|
[571] | 616 | typeset ExeNameIn ExeNameFirst CompNameFirst |
---|
| 617 | typeset comp i |
---|
| 618 | typeset tempvar tempvarMPI tempvarNOD NbElts j NbExec |
---|
[490] | 619 | |
---|
[571] | 620 | (( PROCESSUS_NUMBER = 0 )) |
---|
| 621 | (( i=0 )) |
---|
| 622 | (( NbExec=0 )) |
---|
[490] | 623 | |
---|
[571] | 624 | OK_PARA_MPI=false |
---|
| 625 | OK_PARA_OMP=false |
---|
| 626 | OK_PARA_NOD=false |
---|
| 627 | OK_PARA_MPMD=false |
---|
[556] | 628 | |
---|
[571] | 629 | for comp in ${config_ListOfComponents[*]} ; do |
---|
[490] | 630 | |
---|
[571] | 631 | IGCM_debug_Print 1 ${comp} |
---|
[490] | 632 | |
---|
[571] | 633 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
[490] | 634 | |
---|
[571] | 635 | # NO order in config.card for parallelized values ! |
---|
| 636 | # just use suffix : MPI , OMP and NOD (for number of NODes.) |
---|
[490] | 637 | |
---|
[571] | 638 | # NOD is the number of NODes allocated |
---|
| 639 | eval ${comp}_PROC_NOD=0 |
---|
[490] | 640 | |
---|
[571] | 641 | # MPI is the number of MPI processus per nodes |
---|
| 642 | eval ${comp}_PROC_MPI=0 |
---|
[490] | 643 | |
---|
[571] | 644 | # OMP is the number of OpenMP threads per MPI processus |
---|
| 645 | eval ${comp}_PROC_OMP=0 |
---|
[490] | 646 | |
---|
[571] | 647 | # Only if we really have an executable for the component : |
---|
| 648 | if [ X${ExeNameIn} != X\"\" ] ; then |
---|
[556] | 649 | |
---|
[571] | 650 | # Keep the first executable found and the first CompName |
---|
| 651 | ExeNameFirst=${ExeNameIn} |
---|
| 652 | CompNameFirst=${comp} |
---|
[556] | 653 | |
---|
[571] | 654 | # Are we a second executable? |
---|
| 655 | (( NbExec = NbExec + 1 )) |
---|
[556] | 656 | |
---|
[571] | 657 | # set 1 MPI task, 1 OpenMP thread and 1 node as default |
---|
| 658 | eval ${comp}_PROC_MPI=1 |
---|
| 659 | eval ${comp}_PROC_OMP=1 |
---|
| 660 | eval ${comp}_PROC_NOD=1 |
---|
[556] | 661 | |
---|
[571] | 662 | eval NbElts=\${#config_Executable_${comp}[@]} |
---|
[556] | 663 | |
---|
[571] | 664 | if [ ${NbElts} -ge 2 ] ; then |
---|
| 665 | (( j = 2 )) |
---|
[490] | 666 | |
---|
[571] | 667 | while [ $j -lt ${NbElts} ] ; do |
---|
| 668 | eval tempvar=\${config_Executable_${comp}[${j}]} |
---|
[490] | 669 | |
---|
[593] | 670 | if [ X${tempvar} = X ] ; then |
---|
[571] | 671 | echo "Error reading MPI/OMP parameters !!!" |
---|
| 672 | echo "Check your config.card." |
---|
| 673 | exit 1 |
---|
| 674 | fi |
---|
[490] | 675 | |
---|
[571] | 676 | eval IGCM_debug_Print 2 ${tempvar} |
---|
[490] | 677 | |
---|
[571] | 678 | case ${tempvar} in |
---|
| 679 | *[mM][pP][iI]*) |
---|
| 680 | # Read MPI parameter for composante |
---|
| 681 | eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" ) |
---|
| 682 | OK_PARA_MPI=true;; |
---|
| 683 | *[oO][mM][pP]*) |
---|
| 684 | # Read OMP parameter for composante |
---|
| 685 | eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" ) |
---|
| 686 | OK_PARA_OMP=true;; |
---|
| 687 | *[nN][oO][dD]*) |
---|
| 688 | # Read NOD (NumBer of Nodes) parameter for composante |
---|
| 689 | eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" ) |
---|
| 690 | OK_PARA_NOD=true |
---|
| 691 | OK_PARA_MPI=true;; |
---|
| 692 | esac |
---|
[490] | 693 | |
---|
[571] | 694 | (( j = j + 1 )) |
---|
| 695 | done |
---|
[490] | 696 | |
---|
[571] | 697 | fi |
---|
[556] | 698 | |
---|
[571] | 699 | eval tempvarMPI=\${${comp}_PROC_MPI} |
---|
| 700 | eval tempvarNOD=\${${comp}_PROC_NOD} |
---|
| 701 | eval tempvarOMP=\${${comp}_PROC_OMP} |
---|
[556] | 702 | |
---|
[571] | 703 | (( PROCESSUS_NUMBER = PROCESSUS_NUMBER + tempvarMPI * tempvarNOD * tempvarOMP )) |
---|
[556] | 704 | |
---|
[571] | 705 | fi |
---|
[490] | 706 | |
---|
[571] | 707 | (( i=i+1 )) |
---|
| 708 | done |
---|
[490] | 709 | |
---|
[571] | 710 | # set MPMD mode if more than 2 executable names. |
---|
| 711 | [ ${NbExec} -ge 2 ] && OK_PARA_MPMD=true |
---|
[490] | 712 | |
---|
[571] | 713 | # Verification of BATCH_NUM_PROC_TOT total number of processors set in job header. |
---|
| 714 | if [ X${BATCH_NUM_PROC_TOT} != X ] ; then |
---|
| 715 | # BATCH_NUM_PROC_TOT is set |
---|
| 716 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 717 | IGCM_debug_Print 1 "MPI/OMP/NOD found into config.card and BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " |
---|
| 718 | else |
---|
| 719 | # with previous method. |
---|
| 720 | if [ ${BATCH_NUM_PROC_TOT} -gt 1 ] ; then |
---|
| 721 | # with more than 1 proc |
---|
| 722 | if ( ${OK_PARA_MPMD} ) ; then |
---|
| 723 | # with MPMD ie CPL/oasis method |
---|
| 724 | echo "We will use default number of MPI tasks for this machine : " |
---|
| 725 | echo "${DEFAULT_NUM_PROC_OCE} for OCE; " |
---|
| 726 | echo "${DEFAULT_NUM_PROC_CPL} for CPL; " |
---|
| 727 | echo "${DEFAULT_NUM_PROC_ATM} for ATM; " |
---|
| 728 | echo "${DEFAULT_NUM_PROC_TOTAL} for the total number of processors; " |
---|
| 729 | OK_PARA_MPI=true |
---|
| 730 | CPL_PROC_MPI=${DEFAULT_NUM_PROC_CPL} |
---|
| 731 | OCE_PROC_MPI=${DEFAULT_NUM_PROC_OCE} |
---|
| 732 | ATM_PROC_MPI=${DEFAULT_NUM_PROC_ATM} |
---|
| 733 | NUM_PROC_CPL=${DEFAULT_NUM_PROC_CPL} # for backward compatibility |
---|
| 734 | NUM_PROC_OCE=${DEFAULT_NUM_PROC_OCE} # for backward compatibility |
---|
| 735 | NUM_PROC_ATM=${DEFAULT_NUM_PROC_ATM} # for backward compatibility |
---|
| 736 | PROCESSUS_NUMBER=${DEFAULT_NUM_PROC_TOTAL} |
---|
| 737 | else |
---|
| 738 | # with have only one executable |
---|
| 739 | echo "We will use ${BATCH_NUM_PROC_TOT} MPI tasks for ${CompNameFirst} : ${config_Executable_Name} " |
---|
| 740 | OK_PARA_MPI=true |
---|
| 741 | eval ${CompNameFirst}_PROC_MPI=${BATCH_NUM_PROC_TOT} |
---|
| 742 | PROCESSUS_NUMBER=${BATCH_NUM_PROC_TOT} |
---|
[556] | 743 | fi |
---|
[571] | 744 | else |
---|
| 745 | PROCESSUS_NUMBER=1 |
---|
| 746 | fi |
---|
[490] | 747 | fi |
---|
[571] | 748 | # Verification with PBS parameter |
---|
| 749 | if [ ${BATCH_NUM_PROC_TOT} -ne ${PROCESSUS_NUMBER} ] ; then |
---|
| 750 | echo "Warning with parallelization parameters !" |
---|
| 751 | echo "Job header variable BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " |
---|
| 752 | echo "is the total number of _processors_ reserved." |
---|
| 753 | echo "It is not equal to the sum of _processus_ = ${PROCESSUS_NUMBER}." |
---|
| 754 | echo "We stop now." |
---|
| 755 | exit 1 |
---|
| 756 | fi |
---|
| 757 | else # BATCH_NUM_PROC_TOT="" |
---|
| 758 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 759 | echo "You have not given a value of ${BATCH_NUM_PROC_TOT} processors," |
---|
| 760 | echo "but you have filled the parallel parameter in config->Executable->list." |
---|
| 761 | echo "Please add BATCH_NUM_PROC_TOT variable in job header." |
---|
| 762 | echo "We stop now." |
---|
| 763 | exit 1 |
---|
| 764 | else |
---|
| 765 | # sequential case ! |
---|
| 766 | if [ ${PROCESSUS_NUMBER} -eq 0 ] ; then |
---|
| 767 | (( PROCESSUS_NUMBER = 1 )) |
---|
| 768 | echo "PROCESSUS_NUMBER is all 0 (sequential use of old definition in config->Executable->list)." |
---|
| 769 | echo "We set it to 1." |
---|
| 770 | fi |
---|
| 771 | fi |
---|
| 772 | fi |
---|
[490] | 773 | |
---|
[571] | 774 | IGCM_debug_Print 1 "MPI/OMP treatment PROCESSUS_NUMBER = ${PROCESSUS_NUMBER}" |
---|
[556] | 775 | |
---|
[571] | 776 | IGCM_sys_build_execution_scripts |
---|
[490] | 777 | |
---|
[571] | 778 | ExecutionFail=false |
---|
[473] | 779 | |
---|
[571] | 780 | IGCM_debug_PopStack "IGCM_config_PeriodStart" |
---|
[2] | 781 | } |
---|
| 782 | |
---|
| 783 | #=================================== |
---|
[571] | 784 | function IGCM_config_SaveSourceModifications |
---|
| 785 | { |
---|
| 786 | IGCM_debug_PushStack "IGCM_config_SaveSourceModifications" |
---|
| 787 | |
---|
| 788 | typeset ExeOutDateMax listVarEnv |
---|
| 789 | ExeOutDateMax=$1 |
---|
| 790 | |
---|
| 791 | listVarEnv="ExeOutDateMax,R_OUT_EXE,PREFIX,SUBMIT_DIR" |
---|
| 792 | IGCM_sys_RshMaster "\ |
---|
| 793 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh; \ |
---|
| 794 | export ExeOutDateMax=${ExeOutDateMax};\ |
---|
| 795 | export R_OUT_EXE=${R_OUT_EXE};\ |
---|
| 796 | export PREFIX=${PREFIX};\ |
---|
| 797 | export SUBMIT_DIR=${SUBMIT_DIR};\ |
---|
| 798 | export listVarEnv=${listVarEnv};\ |
---|
| 799 | Script_Output=out_SaveSourceModifications;\ |
---|
| 800 | IGCM_sys_Qsub ${libIGCM}/SaveSourceModifications.job ${ExeOutDateMax} ${R_OUT_EXE} ${PREFIX} ${SUBMIT_DIR}" |
---|
| 801 | |
---|
| 802 | IGCM_debug_PopStack "IGCM_config_SaveSourceModifications" |
---|
| 803 | } |
---|
| 804 | |
---|
| 805 | #=================================== |
---|
[2] | 806 | function IGCM_config_PeriodEnd |
---|
| 807 | { |
---|
[571] | 808 | IGCM_debug_PushStack "IGCM_config_PeriodEnd" |
---|
[2] | 809 | |
---|
[571] | 810 | echo |
---|
| 811 | IGCM_debug_Print 1 "IGCM_config_PeriodEnd" |
---|
| 812 | echo |
---|
[2] | 813 | |
---|
[571] | 814 | #==================================# |
---|
| 815 | # Save Job output # |
---|
| 816 | #==================================# |
---|
| 817 | IGCM_sys_PutBuffer_Out ${Exe_Output} ${R_BUF_KSH}/${PREFIX}_${Exe_Output} |
---|
| 818 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}" |
---|
[471] | 819 | |
---|
[571] | 820 | IGCM_card_CheckConflict run.card |
---|
| 821 | IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card rw |
---|
[2] | 822 | |
---|
[571] | 823 | |
---|
| 824 | if [ ${DRYRUN} -le 1 ] ; then |
---|
[457] | 825 | IGCM_debug_Print 1 "Check components binary : size and creation date" |
---|
| 826 | |
---|
| 827 | typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize |
---|
[2] | 828 | typeset comp i |
---|
[571] | 829 | typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax |
---|
[2] | 830 | |
---|
| 831 | #==================================# |
---|
| 832 | # Get last Exe Size # |
---|
| 833 | #==================================# |
---|
| 834 | |
---|
[457] | 835 | (( i=0 )) |
---|
| 836 | if ( ${FirstInitialize} ) ; then |
---|
[571] | 837 | run_Log_LastExeSize="" |
---|
| 838 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 839 | run_Log_LastExeSize[$i]=0 |
---|
| 840 | (( i=i+1 )) |
---|
| 841 | done |
---|
[457] | 842 | else |
---|
[571] | 843 | IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize |
---|
[2] | 844 | fi |
---|
| 845 | #==================================# |
---|
| 846 | # And Build ExeDate # |
---|
| 847 | #==================================# |
---|
| 848 | |
---|
| 849 | # 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 |
---|
[57] | 850 | # 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") |
---|
| 851 | # 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 |
---|
[2] | 852 | ExeDate="" |
---|
| 853 | NextExeSize="( " |
---|
| 854 | (( i=0 )) |
---|
[571] | 855 | UpdateExe=false |
---|
| 856 | (( ExeSecDateMax = 0 )) |
---|
[2] | 857 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 858 | |
---|
[571] | 859 | IGCM_debug_Print 3 ${comp} |
---|
[2] | 860 | |
---|
[571] | 861 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 862 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 863 | # Only if we really have an executable for the component : |
---|
| 864 | if [ X${ExeNameIn} = X\"\" ] ; then |
---|
| 865 | # If there is no exe file for this component |
---|
| 866 | (( ExeSize=0 )) |
---|
| 867 | else |
---|
| 868 | eval LS_bin=${R_EXE}/${ExeNameIn} |
---|
| 869 | IGCM_sys_FileSize ${LS_bin} ExeSize |
---|
[2] | 870 | |
---|
[571] | 871 | set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} ) |
---|
| 872 | if [ X${ExeDate} = X ] ; then |
---|
| 873 | # First component exe date |
---|
| 874 | ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]} |
---|
| 875 | else |
---|
| 876 | ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]} |
---|
| 877 | fi |
---|
| 878 | ExeDate=${ExeDate}_${LS_comp[7]} |
---|
| 879 | fi |
---|
[2] | 880 | |
---|
[571] | 881 | if [ ${i} -eq 0 ] ; then |
---|
| 882 | # First component |
---|
| 883 | NextExeSize="( "${ExeSize} |
---|
| 884 | else |
---|
| 885 | NextExeSize=${NextExeSize}", "${ExeSize} |
---|
| 886 | fi |
---|
| 887 | eval LastCompExeSize=${run_Log_LastExeSize[$i]} |
---|
| 888 | (( i=i+1 )) |
---|
[2] | 889 | |
---|
[571] | 890 | if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then |
---|
| 891 | if ( ${FirstInitialize} ) ; then |
---|
| 892 | IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !" |
---|
| 893 | else |
---|
| 894 | IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !" |
---|
| 895 | IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !" |
---|
| 896 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut} |
---|
| 897 | fi |
---|
| 898 | eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw |
---|
| 899 | UpdateExe=true |
---|
| 900 | |
---|
| 901 | IGCM_sys_GetDate_FichWork ${LS_bin} ExeSecDate |
---|
| 902 | if [ $ExeSecDateMax -lt $ExeSecDate ] ; then |
---|
| 903 | ExeSecDateMax=$ExeSecDate |
---|
| 904 | fi |
---|
| 905 | fi |
---|
[2] | 906 | done |
---|
| 907 | |
---|
[571] | 908 | # SD : switch off for now |
---|
| 909 | # if ( ${UpdateExe} ) ; then |
---|
| 910 | # echo "Launch SaveSourceModifications." |
---|
| 911 | # IGCM_config_SaveSourceModifications ${ExeSecDateMax} |
---|
| 912 | # fi |
---|
| 913 | |
---|
[457] | 914 | NextExeSize=${NextExeSize}" )" |
---|
| 915 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}" |
---|
| 916 | |
---|
[561] | 917 | tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt |
---|
| 918 | ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt ) |
---|
| 919 | RET=$? |
---|
| 920 | if [ $RET -eq 0 ] ; then |
---|
[571] | 921 | # ExeCpuLog variable contents 5 fields |
---|
| 922 | echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" | \ |
---|
| 923 | gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \ |
---|
| 924 | $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card |
---|
[2] | 925 | fi |
---|
[561] | 926 | eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt" |
---|
[571] | 927 | |
---|
| 928 | fi |
---|
[2] | 929 | |
---|
[571] | 930 | # All was right ? no ? then we stop. |
---|
| 931 | IGCM_debug_Verif_Exit |
---|
[2] | 932 | |
---|
[571] | 933 | # If all was OK, we can delete all files not necessary for next Job |
---|
| 934 | echo |
---|
| 935 | IGCM_debug_Print 1 "Files that will be deleted before next period-run : " |
---|
[2] | 936 | |
---|
[571] | 937 | if [ ${DRYRUN} -le 2 ] ; then |
---|
| 938 | for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done |
---|
| 939 | else |
---|
| 940 | echo ${FileToBeDeleted[@]} |
---|
| 941 | fi |
---|
[2] | 942 | |
---|
[571] | 943 | #=================================================# |
---|
| 944 | # Modification of libIGCM behaviour # |
---|
| 945 | #=================================================# |
---|
[119] | 946 | |
---|
[571] | 947 | # To use this function, one must copy libIGCM.card from ${libIGCM} directory |
---|
| 948 | # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card, |
---|
| 949 | # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. |
---|
| 950 | if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then |
---|
| 951 | echo |
---|
| 952 | echo "########################################################################" |
---|
| 953 | echo "!!! Modification of libIGCM behaviour !!!" |
---|
| 954 | echo |
---|
[119] | 955 | |
---|
[571] | 956 | IGCM_debug_Print 1 "DefineArrayFromOption : libIGCM_UserChanges in libIGCM.card" |
---|
| 957 | IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges |
---|
| 958 | IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]} |
---|
[119] | 959 | |
---|
[571] | 960 | # Special treatments for libIGCM internals |
---|
| 961 | for option in ${libIGCM_UserChanges[*]} ; do |
---|
| 962 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option} |
---|
[119] | 963 | |
---|
[571] | 964 | echo "We will change : ${option}." |
---|
| 965 | eval echo "Previous value : " \${${option}} |
---|
| 966 | eval echo "Change to : " \${libIGCM_UserChanges_${option}} |
---|
| 967 | |
---|
| 968 | eval ${option}=\${libIGCM_UserChanges_${option}} |
---|
[119] | 969 | |
---|
[571] | 970 | case ${option} in |
---|
| 971 | config_UserChoices_DateEnd) |
---|
| 972 | IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd |
---|
| 973 | DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} ) |
---|
[119] | 974 | |
---|
[571] | 975 | # Period Length In Days between DateBegin and DateEnd |
---|
| 976 | (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} ) + 1 )) |
---|
| 977 | if [ ${ExperienceLengthInDays} -lt 0 ] ; then |
---|
| 978 | IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that." |
---|
| 979 | IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates." |
---|
| 980 | IGCM_debug_Verif_Exit |
---|
| 981 | fi |
---|
| 982 | ;; |
---|
| 983 | config_UserChoices_PeriodLength) |
---|
| 984 | IGCM_debug_Print 1 "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}" |
---|
| 985 | ;; |
---|
| 986 | PeriodNb) |
---|
| 987 | IGCM_debug_Print 1 "Loop in main Job with ${PeriodNb} period(s)" |
---|
| 988 | ;; |
---|
| 989 | config_Post_RebuildFrequency) |
---|
| 990 | IGCM_debug_Print 1 "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure" |
---|
| 991 | IGCM_post_Configure |
---|
| 992 | ;; |
---|
| 993 | config_Post_TimeSeriesFrequency) |
---|
| 994 | IGCM_debug_Print 1 "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize" |
---|
| 995 | IGCM_post_Configure |
---|
| 996 | ;; |
---|
| 997 | config_Post_SeasonalFrequency) |
---|
| 998 | IGCM_debug_Print 1 "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize" |
---|
| 999 | IGCM_post_Configure |
---|
| 1000 | ;; |
---|
| 1001 | esac |
---|
| 1002 | done |
---|
[119] | 1003 | |
---|
[571] | 1004 | echo |
---|
| 1005 | echo "########################################################################" |
---|
| 1006 | echo |
---|
| 1007 | fi |
---|
[119] | 1008 | |
---|
[571] | 1009 | #=================================================# |
---|
| 1010 | # Determine next computed period # |
---|
| 1011 | #=================================================# |
---|
[2] | 1012 | |
---|
[571] | 1013 | PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 ) |
---|
| 1014 | IGCM_date_GetYearMonthDay $PeriodDateBegin year month day |
---|
| 1015 | year_m1=$(( year - 1 )) |
---|
| 1016 | year_p1=$(( year + 1 )) |
---|
| 1017 | IGCM_config_Analyse_PeriodLength |
---|
| 1018 | PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) ) |
---|
[2] | 1019 | |
---|
[571] | 1020 | # Debug Print : |
---|
| 1021 | echo |
---|
| 1022 | IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution" |
---|
| 1023 | IGCM_debug_Print 1 "PeriodDateBegin : ${PeriodDateBegin}" |
---|
| 1024 | IGCM_debug_Print 1 "PeriodDateEnd : ${PeriodDateEnd}" |
---|
| 1025 | IGCM_debug_Print 1 "PeriodLengthInDays : ${PeriodLengthInDays}" |
---|
[2] | 1026 | |
---|
[571] | 1027 | PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} ) |
---|
| 1028 | PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} ) |
---|
[2] | 1029 | |
---|
[571] | 1030 | (( CumulPeriod = CumulPeriod + 1 )) |
---|
[2] | 1031 | |
---|
[571] | 1032 | # Debug Print : |
---|
| 1033 | echo |
---|
| 1034 | IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}" |
---|
| 1035 | IGCM_debug_Print 3 "PeriodDateEnd Human : ${PeriodDateEnd}" |
---|
| 1036 | IGCM_debug_Print 3 "CumulPeriod : ${CumulPeriod}" |
---|
[2] | 1037 | |
---|
[571] | 1038 | #=================================================# |
---|
| 1039 | # Write updated run.card # |
---|
| 1040 | #=================================================# |
---|
[2] | 1041 | |
---|
[571] | 1042 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration OldPrefix ${OldPrefix} |
---|
| 1043 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin} |
---|
| 1044 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd} |
---|
| 1045 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod} |
---|
[2] | 1046 | |
---|
[571] | 1047 | if ( ${FirstInitialize} ) ; then |
---|
| 1048 | # It's no more the first time |
---|
| 1049 | FirstInitialize=false |
---|
| 1050 | fi |
---|
[446] | 1051 | |
---|
[571] | 1052 | IGCM_debug_PopStack "IGCM_config_PeriodEnd" |
---|
[2] | 1053 | } |
---|
| 1054 | |
---|
| 1055 | #=================================== |
---|
| 1056 | function IGCM_config_Finalize |
---|
| 1057 | { |
---|
[571] | 1058 | IGCM_debug_PushStack "IGCM_config_Finalize" |
---|
[2] | 1059 | |
---|
[571] | 1060 | echo |
---|
| 1061 | IGCM_debug_Print 1 "IGCM_config_Finalize" |
---|
| 1062 | echo |
---|
[2] | 1063 | |
---|
[571] | 1064 | if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then |
---|
| 1065 | #==========================# |
---|
| 1066 | # End of entire simulation # |
---|
| 1067 | #==========================# |
---|
[2] | 1068 | |
---|
[571] | 1069 | # Mail notification |
---|
| 1070 | IGCM_sys_SendMail |
---|
[2] | 1071 | |
---|
[571] | 1072 | # |
---|
| 1073 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed" |
---|
| 1074 | IGCM_debug_Print 1 "Normal End of computation." |
---|
| 1075 | if ( $DEBUG_debug ) ; then |
---|
| 1076 | echo |
---|
| 1077 | IGCM_debug_Print 1 "Your files on ${R_SAVE} :" |
---|
| 1078 | IGCM_sys_Tree ${R_SAVE} |
---|
[2] | 1079 | |
---|
[571] | 1080 | IGCM_debug_Print 1 "Your files on ${R_BUFR} :" |
---|
| 1081 | IGCM_sys_Tree ${R_BUFR} |
---|
| 1082 | fi |
---|
| 1083 | else |
---|
| 1084 | #=================# |
---|
| 1085 | # Submit next job # |
---|
| 1086 | #=================# |
---|
[2] | 1087 | |
---|
[571] | 1088 | IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue" |
---|
[2] | 1089 | |
---|
[571] | 1090 | # Name of next Ksh Script output : |
---|
| 1091 | eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )" |
---|
[2] | 1092 | |
---|
[571] | 1093 | IGCM_debug_Print 1 "Submit next job" |
---|
| 1094 | # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR |
---|
| 1095 | IGCM_sys_Cd ${SUBMIT_DIR} |
---|
| 1096 | # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName} |
---|
| 1097 | ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l ) |
---|
| 1098 | [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) ) |
---|
| 1099 | # Submit next job and come back |
---|
| 1100 | IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} |
---|
| 1101 | IGCM_sys_Cd - |
---|
| 1102 | fi |
---|
[154] | 1103 | |
---|
[571] | 1104 | # Supress Non Deleted Boundary files |
---|
| 1105 | if [ ${DRYRUN} -le 2 ] ; then |
---|
| 1106 | IGCM_comp_DelFixeBoundaryFiles |
---|
| 1107 | ls -la |
---|
| 1108 | fi |
---|
| 1109 | |
---|
| 1110 | # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName} |
---|
| 1111 | # Only for production run (No clean up in DEV or DEB mode) |
---|
| 1112 | # and command sent from .. directory. |
---|
| 1113 | IGCM_sys_Cd .. |
---|
| 1114 | [ X${JobType} = XRUN ] && IGCM_sys_Rm -rf ${RUN_DIR} |
---|
| 1115 | |
---|
| 1116 | IGCM_debug_PopStack "IGCM_config_Finalize" |
---|
[2] | 1117 | } |
---|
| 1118 | |
---|
| 1119 | #=================================== |
---|