[657] | 1 | #!/bin/ksh |
---|
[16] | 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sebastien Denvil, Martial Mancip, Christian Laguerre |
---|
[373] | 5 | # Contact: Martial.Mancip__at__ipsl.jussieu.fr |
---|
| 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
[16] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
[657] | 11 | # |
---|
[16] | 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | #========================================================= |
---|
| 15 | # The documentation of this file can be automatically generated |
---|
[657] | 16 | # if you use the prefix #D- for comments to be extracted. |
---|
[16] | 17 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
| 18 | #========================================================= |
---|
| 19 | |
---|
| 20 | #D-#================================================== |
---|
| 21 | #D-LibIGCM_sys for obelix |
---|
| 22 | #D-#================================================== |
---|
| 23 | #D- |
---|
[657] | 24 | #D- This ksh library if a layer under some usefull |
---|
[16] | 25 | #D-environment variables and shell commands. |
---|
| 26 | #D-All those definitions depend on host particularities. |
---|
| 27 | #D-It manages a stack mechanism and test validity of operations. |
---|
| 28 | #D-All function described bellow must be prefixed by IGCM_sys. |
---|
| 29 | |
---|
| 30 | #==================================================== |
---|
| 31 | # libIGCM_sys PARAMETERS |
---|
| 32 | #==================================================== |
---|
| 33 | |
---|
[343] | 34 | #==================================================== |
---|
[16] | 35 | # set DEBUG_sys to true to output calls of function |
---|
| 36 | typeset -r DEBUG_sys=${DEBUG_sys:=true} |
---|
| 37 | |
---|
[343] | 38 | #==================================================== |
---|
[16] | 39 | # Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get) |
---|
| 40 | typeset -r DRYRUN=${DRYRUN:=0} |
---|
| 41 | |
---|
| 42 | # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! |
---|
| 43 | # ------------------------------------------------------------------------------------- |
---|
| 44 | # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | |
---|
[809] | 45 | # | | Cp/Exe/param/files | | | | |
---|
| 46 | # | | Chmod Qsub | | | | |
---|
[16] | 47 | # ------------------------------------------------------------------------------------- |
---|
| 48 | # | 0 | yes | yes | yes | yes | |
---|
| 49 | # ------------------------------------------------------------------------------------- |
---|
| 50 | # | 1 | yes | yes | yes | no | |
---|
| 51 | # ------------------------------------------------------------------------------------- |
---|
| 52 | # | 2 | yes | yes | no | no | |
---|
| 53 | # ------------------------------------------------------------------------------------- |
---|
| 54 | # | 3 | yes | no | no | no | |
---|
| 55 | # ------------------------------------------------------------------------------------- |
---|
| 56 | |
---|
| 57 | #===================================================== |
---|
| 58 | # Global Variables : |
---|
| 59 | #===================================================== |
---|
| 60 | # Language : "fr" or "en" |
---|
| 61 | typeset -r MYLANG="fr" |
---|
| 62 | |
---|
| 63 | #===================================================== |
---|
[1300] | 64 | # Host user names project maxCpuTime |
---|
[217] | 65 | # $hostname ou hostname |
---|
[1180] | 66 | typeset HOST=${HOST:=$( hostname )} |
---|
[16] | 67 | # $username ou whoami |
---|
[1180] | 68 | typeset LOGIN=${LOGIN:=$( whoami )} |
---|
[657] | 69 | # $hostname of the MASTER job |
---|
[742] | 70 | typeset MASTER=${MASTER:=$( hostname )} |
---|
[1201] | 71 | # project name |
---|
| 72 | typeset PROJECT=NONE |
---|
| 73 | # jobWarningDelay in seconds |
---|
| 74 | typeset jobWarningDelay=${PBS_WALLTIME} |
---|
[16] | 75 | |
---|
| 76 | #D- |
---|
| 77 | #D-#================================================== |
---|
| 78 | #D-Program used in libIGCM |
---|
| 79 | #D-#================================================== |
---|
| 80 | |
---|
[742] | 81 | # Submit command |
---|
| 82 | typeset SUBMIT=${SUBMIT:=qsub} |
---|
[16] | 83 | # rsync with path |
---|
| 84 | typeset -r RSYNC=/usr/bin/rsync |
---|
| 85 | # RSYNC_opt args to rsync |
---|
[282] | 86 | typeset -r RSYNC_opt="-va" |
---|
[657] | 87 | # ie storage filesystem |
---|
| 88 | typeset -r STOREHOST=${MASTER} |
---|
[16] | 89 | |
---|
| 90 | #==================================================== |
---|
[1180] | 91 | # Set environment tools (ferret, nco, cdo, rebuild, ...) |
---|
[305] | 92 | #==================================================== |
---|
[1360] | 93 | . /usr/share/Modules/init/ksh |
---|
[1358] | 94 | module load python/2.7.5 |
---|
[1097] | 95 | . /home/users/igcmg/.atlas_env_asterix_ksh |
---|
[1406] | 96 | #export PATH=${PATH}:/home/users/igcmg/rebuild/bin/ |
---|
| 97 | export PATH=${PATH}:/home/users/jghattas/IOIPSL_PLUS/modipsl/bin/ |
---|
[16] | 98 | |
---|
[343] | 99 | #==================================================== |
---|
[16] | 100 | # Host specific DIRECTORIES |
---|
| 101 | #==================================================== |
---|
| 102 | |
---|
| 103 | #==================================================== |
---|
[657] | 104 | #- MirrorlibIGCM for frontend |
---|
| 105 | typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} |
---|
| 106 | |
---|
| 107 | #==================================================== |
---|
| 108 | #- libIGCM_POST for frontend |
---|
| 109 | typeset -r libIGCM_POST=${libIGCM} |
---|
| 110 | |
---|
| 111 | #==================================================== |
---|
[16] | 112 | #- R_EXE (==> BIN_DIR = ${MODIPSL}/bin ) |
---|
| 113 | typeset -r R_EXE="${MODIPSL}/bin" |
---|
| 114 | |
---|
| 115 | #==================================================== |
---|
| 116 | #- SUBMIT_DIR : submission dir |
---|
[256] | 117 | if [ X${PBS_O_WORKDIR} != X ] ; then |
---|
[1124] | 118 | typeset -x SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}} |
---|
[256] | 119 | else |
---|
[1124] | 120 | typeset -x SUBMIT_DIR=${SUBMIT_DIR:=${PWD}} |
---|
[256] | 121 | fi |
---|
[657] | 122 | |
---|
[16] | 123 | #==================================================== |
---|
[725] | 124 | #- IN |
---|
[978] | 125 | typeset -r R_IN=${R_IN:=/home/orchideeshare/igcmg/IGCM} |
---|
[1180] | 126 | typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/home/orchideeshare/igcmg/IGCM} |
---|
[725] | 127 | |
---|
| 128 | #==================================================== |
---|
[16] | 129 | #- RUN_DIR_PATH : Temporary working directory (=> TMP) |
---|
[838] | 130 | if [ X${PBS_JOBID} != X ] ; then |
---|
| 131 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/scratch/$PBS_O_LOGNAME.$PBS_JOBID} |
---|
| 132 | else |
---|
[839] | 133 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/tmp/tmp$$} |
---|
[838] | 134 | fi |
---|
[16] | 135 | |
---|
| 136 | #==================================================== |
---|
[1179] | 137 | #- OUTCOMMAND_PATH : tmp place to store command lines standard error and outputs |
---|
[1186] | 138 | typeset -r OUTCOMMAND_PATH=/tmp |
---|
[1179] | 139 | |
---|
| 140 | #==================================================== |
---|
[16] | 141 | #- HOST_MPIRUN_COMMAND |
---|
| 142 | typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"} |
---|
| 143 | |
---|
[61] | 144 | #==================================================== |
---|
| 145 | #- Max number of arguments passed to nco operator or demigration command |
---|
| 146 | UNIX_MAX_LIMIT=360 |
---|
| 147 | |
---|
[657] | 148 | #==================================================== |
---|
[1180] | 149 | #- set PackDefault to false on obelix |
---|
| 150 | PackDefault=false |
---|
| 151 | |
---|
| 152 | #==================================================== |
---|
[657] | 153 | #- Default number of MPI task for IPSL coupled model |
---|
| 154 | #- required for backward compatibility |
---|
| 155 | #- |
---|
[1300] | 156 | DEFAULT_NUM_PROC_OCE=5 |
---|
[657] | 157 | DEFAULT_NUM_PROC_CPL=1 |
---|
| 158 | (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) |
---|
| 159 | |
---|
[16] | 160 | #D-#================================================== |
---|
[1057] | 161 | #D-function IGCM_sys_defineArchives |
---|
| 162 | #D-* Purpose: |
---|
| 163 | #D-* Define ARCHIVE : Dedicated to large files |
---|
| 164 | #D-* Define STORAGE : Dedicated to small/medium files |
---|
| 165 | #D-* Define R_OUT : Output tree located on ARCHIVE |
---|
| 166 | #D-* Define R_FIG : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files) |
---|
| 167 | #D-* Define R_BUF : Output tree located on STORAGE hosting files waiting for rebuild or pack processes |
---|
| 168 | #D-* if SpaceName=TEST nothing special will hapen |
---|
[725] | 169 | #D-* Examples: |
---|
| 170 | #D- |
---|
[1057] | 171 | function IGCM_sys_defineArchives { |
---|
| 172 | IGCM_debug_PushStack "IGCM_sys_defineArchives" |
---|
| 173 | |
---|
[1060] | 174 | if [ ! X${config_UserChoices_ARCHIVE} = X ]; then |
---|
[1057] | 175 | #==================================================== |
---|
| 176 | #- ARCHIVE (dedicated to large files) |
---|
[1063] | 177 | ARCHIVE=${config_UserChoices_ARCHIVE} |
---|
[1057] | 178 | else |
---|
| 179 | #==================================================== |
---|
| 180 | #- ARCHIVE (dedicated to large files) |
---|
[1063] | 181 | ARCHIVE=${ARCHIVE:=/home/scratch01/${LOGIN}} |
---|
[1057] | 182 | fi |
---|
| 183 | |
---|
[1060] | 184 | if [ ! X${config_UserChoices_STORAGE} = X ]; then |
---|
[1057] | 185 | #==================================================== |
---|
| 186 | #- STORAGE (dedicated to small/medium files) |
---|
[1063] | 187 | STORAGE=${config_UserChoices_STORAGE} |
---|
[1057] | 188 | else |
---|
| 189 | #==================================================== |
---|
| 190 | #- STORAGE (dedicated to small/medium files) |
---|
[1063] | 191 | STORAGE=${ARCHIVE} |
---|
[1057] | 192 | fi |
---|
| 193 | |
---|
| 194 | # ON OBELIX NO SPECIAL CASE WHEN X${config_UserChoices_SpaceName} = XTEST |
---|
| 195 | |
---|
| 196 | #==================================================== |
---|
| 197 | #- R_OUT |
---|
[1063] | 198 | R_OUT=${ARCHIVE}/IGCM_OUT |
---|
[1057] | 199 | |
---|
| 200 | #==================================================== |
---|
| 201 | #- R_FIG (hosting figures : monitoring and atlas, and/or small files) |
---|
[1063] | 202 | R_FIG=${STORAGE}/IGCM_OUT |
---|
[1057] | 203 | |
---|
| 204 | #==================================================== |
---|
[1431] | 205 | #- CMIP6 (hosting CMIP6 files produced by XIOS2 and configured by dr2xml) |
---|
| 206 | CMIP6_BUF=${STORAGE}/IGCM_OUT |
---|
| 207 | |
---|
| 208 | #==================================================== |
---|
[1057] | 209 | #- R_BUF (ONLY FOR double copy an scratch) |
---|
[1063] | 210 | R_BUF=${STORAGE}/IGCM_OUT |
---|
[1057] | 211 | |
---|
| 212 | IGCM_debug_Print 1 "R_OUT has been defined = ${R_OUT}" |
---|
| 213 | IGCM_debug_Print 1 "R_BUF has been defined = ${R_BUF}" |
---|
| 214 | IGCM_debug_Print 1 "R_FIG has been defined = ${R_FIG}" |
---|
| 215 | |
---|
| 216 | IGCM_debug_PopStack "IGCM_sys_defineArchives" |
---|
[725] | 217 | } |
---|
| 218 | |
---|
| 219 | #D-#================================================== |
---|
[37] | 220 | #D-function IGCM_sys_RshArchive |
---|
| 221 | #D-* Purpose: Archive rsh command |
---|
| 222 | #D-* Examples: |
---|
| 223 | #D- |
---|
| 224 | function IGCM_sys_RshArchive { |
---|
[657] | 225 | IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ |
---|
| 226 | /bin/ksh <<-EOF |
---|
[40] | 227 | ${@} |
---|
| 228 | EOF |
---|
[811] | 229 | status=$? |
---|
| 230 | if [ ${status} -gt 0 ] ; then |
---|
| 231 | IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" |
---|
[657] | 232 | IGCM_debug_Exit "IGCM_sys_RshArchive" |
---|
| 233 | fi |
---|
| 234 | IGCM_debug_PopStack "IGCM_sys_RshArchive" |
---|
[37] | 235 | } |
---|
| 236 | |
---|
| 237 | #D-#================================================== |
---|
[1178] | 238 | #D-function IGCM_sys_RshArchive_NoError |
---|
| 239 | #D-* Purpose: Archive rsh command, without error |
---|
| 240 | #D-* used only in monitoring.job |
---|
| 241 | #D-* Examples: |
---|
| 242 | #D- |
---|
| 243 | function IGCM_sys_RshArchive_NoError { |
---|
| 244 | IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@ |
---|
| 245 | /bin/ksh <<-EOF |
---|
[1181] | 246 | ${@} 2> /dev/null |
---|
[1178] | 247 | EOF |
---|
| 248 | IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError" |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | #D-#================================================== |
---|
[16] | 252 | #D-function IGCM_sys_MkdirArchive |
---|
| 253 | #D-* Purpose: Mkdir on Archive |
---|
| 254 | #D-* Examples: |
---|
| 255 | #D- |
---|
| 256 | function IGCM_sys_MkdirArchive { |
---|
[657] | 257 | IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ |
---|
| 258 | if ( $DEBUG_sys ) ; then |
---|
| 259 | echo "IGCM_sys_MkdirArchive :" $@ |
---|
| 260 | fi |
---|
[717] | 261 | #- creation de repertoire sur le serveur fichier |
---|
[657] | 262 | if [ ! -d ${1} ]; then |
---|
[1178] | 263 | \mkdir -p $1 |
---|
[811] | 264 | status=$? |
---|
| 265 | |
---|
| 266 | if [ ${status} -gt 0 ] ; then |
---|
| 267 | IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" |
---|
[657] | 268 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
[16] | 269 | fi |
---|
[657] | 270 | fi |
---|
| 271 | IGCM_debug_PopStack "IGCM_sys_MkdirArchive" |
---|
[16] | 272 | } |
---|
| 273 | |
---|
| 274 | #D-#================================================== |
---|
| 275 | #D-function IGCM_sys_TestDirArchive |
---|
| 276 | #D-* Purpose: Test Directory that must exists on Archive |
---|
| 277 | #D-* Examples: |
---|
| 278 | #D- |
---|
| 279 | function IGCM_sys_TestDirArchive { |
---|
[657] | 280 | IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ |
---|
| 281 | if ( $DEBUG_sys ) ; then |
---|
| 282 | echo "IGCM_sys_TestDirArchive :" $@ |
---|
| 283 | fi |
---|
| 284 | typeset ExistFlag |
---|
| 285 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
| 286 | IGCM_debug_PopStack "IGCM_sys_TestDirArchive" |
---|
| 287 | return ${ExistFlag} |
---|
[16] | 288 | } |
---|
| 289 | |
---|
| 290 | #D-#================================================== |
---|
[800] | 291 | #D-function IGCM_sys_IsFileArchived |
---|
[1180] | 292 | #D-* Purpose: Test file that must NOT EXISTS on Archive based on filename only |
---|
[800] | 293 | #D-* Examples: |
---|
| 294 | #D- |
---|
| 295 | function IGCM_sys_IsFileArchived { |
---|
| 296 | IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ |
---|
| 297 | if ( $DEBUG_sys ) ; then |
---|
| 298 | echo "IGCM_sys_IsFileArchived :" $@ |
---|
| 299 | fi |
---|
| 300 | typeset IsArchivedFlag |
---|
| 301 | # Never archived for this system |
---|
| 302 | IsArchivedFlag=1 |
---|
| 303 | IGCM_debug_PopStack "IGCM_sys_IsFileArchived" |
---|
| 304 | |
---|
| 305 | return ${IsArchivedFlag} |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | #D-#================================================== |
---|
[16] | 309 | #D-function IGCM_sys_TestFileArchive |
---|
| 310 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
| 311 | #D-* Examples: |
---|
| 312 | #D- |
---|
| 313 | function IGCM_sys_TestFileArchive { |
---|
[657] | 314 | IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ |
---|
| 315 | typeset ExistFlag |
---|
| 316 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
| 317 | IGCM_debug_PopStack "IGCM_sys_TestFileArchive" |
---|
[67] | 318 | |
---|
[657] | 319 | return ${ExistFlag} |
---|
[67] | 320 | } |
---|
| 321 | |
---|
| 322 | #D-#================================================== |
---|
| 323 | #D-function IGCM_sys_CountFileArchive |
---|
| 324 | #D-* Purpose: Count files on Archive filesystem |
---|
| 325 | #D-* Examples: |
---|
| 326 | #D- |
---|
| 327 | function IGCM_sys_CountFileArchive { |
---|
[657] | 328 | IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ |
---|
| 329 | ls ${@} 2>/dev/null | wc -l |
---|
| 330 | if [ $? -gt 0 ] ; then |
---|
| 331 | echo "IGCM_sys_CountFileArchive : erreur." |
---|
| 332 | fi |
---|
| 333 | IGCM_debug_PopStack "IGCM_sys_CountFileArchive" |
---|
[16] | 334 | } |
---|
| 335 | |
---|
| 336 | #D-#================================================== |
---|
| 337 | #D-function IGCM_sys_Tree |
---|
| 338 | #D-* Purpose: Tree directories with files on ${ARCHIVE} |
---|
| 339 | #D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT} |
---|
| 340 | #D- |
---|
| 341 | function IGCM_sys_Tree { |
---|
[657] | 342 | IGCM_debug_PushStack "IGCM_sys_Tree" $@ |
---|
| 343 | if ( $DEBUG_sys ) ; then |
---|
| 344 | echo "IGCM_sys_Tree :" $@ |
---|
| 345 | fi |
---|
[16] | 346 | |
---|
[1300] | 347 | \ls -lR ${@} |
---|
[16] | 348 | |
---|
[657] | 349 | IGCM_debug_PopStack "IGCM_sys_Tree" |
---|
[16] | 350 | } |
---|
| 351 | |
---|
| 352 | #D-#================================================== |
---|
| 353 | #D-function IGCM_sys_Qsub |
---|
| 354 | #D-* Purpose: Qsub new job |
---|
| 355 | #D-* Examples: |
---|
| 356 | #D- |
---|
| 357 | function IGCM_sys_Qsub { |
---|
[657] | 358 | IGCM_debug_PushStack "IGCM_sys_Qsub" $@ |
---|
| 359 | if ( $DEBUG_sys ) ; then |
---|
| 360 | echo "IGCM_sys_Qsub :" $@ |
---|
| 361 | fi |
---|
[923] | 362 | typeset options status |
---|
| 363 | options="-o ${SUBMIT_DIR}/${Script_Output}" |
---|
[1179] | 364 | /usr/local/bin/qsub ${options} $1 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[811] | 365 | status=$? |
---|
[949] | 366 | |
---|
[1179] | 367 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[811] | 368 | if [ ${status} -gt 0 ] ; then |
---|
[1180] | 369 | IGCM_debug_Print 2 "IGCM_sys_Qsub ${options} $1 : error code ${status}" |
---|
[657] | 370 | IGCM_debug_Exit "IGCM_sys_Qsub" |
---|
[949] | 371 | else |
---|
[1179] | 372 | JobID=$( gawk {'print $1'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ ) |
---|
[657] | 373 | fi |
---|
| 374 | IGCM_debug_PopStack "IGCM_sys_Qsub" |
---|
[16] | 375 | } |
---|
| 376 | |
---|
| 377 | #D-#================================================== |
---|
| 378 | #D-function IGCM_sys_QsubPost |
---|
| 379 | #D-* Purpose: Qsub new job on scalaire |
---|
| 380 | #D-* Examples: |
---|
| 381 | #D- |
---|
| 382 | function IGCM_sys_QsubPost { |
---|
[657] | 383 | IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ |
---|
| 384 | if ( $DEBUG_sys ) ; then |
---|
| 385 | echo "IGCM_sys_QsubPost :" $@ |
---|
| 386 | fi |
---|
[923] | 387 | typeset options status |
---|
| 388 | options="-o ${POST_DIR}/${Script_Post_Output}.out -v ${listVarEnv}" |
---|
[1179] | 389 | /usr/local/bin/qsub ${options} ${libIGCM_POST}/$1.job > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[811] | 390 | status=$? |
---|
[949] | 391 | |
---|
[1179] | 392 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[811] | 393 | if [ ${status} -gt 0 ] ; then |
---|
[923] | 394 | IGCM_debug_Print 2 "IGCM_sys_QsubPost ${options} ${libIGCM_POST}/$1.job : error code ${status}" |
---|
[657] | 395 | IGCM_debug_Exit "IGCM_sys_QsubPost" |
---|
[949] | 396 | else |
---|
[1179] | 397 | JobID=$( gawk {'print $1'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ ) |
---|
[657] | 398 | fi |
---|
| 399 | IGCM_debug_PopStack "IGCM_sys_QsubPost" |
---|
[16] | 400 | } |
---|
| 401 | |
---|
| 402 | #D-************************* |
---|
[657] | 403 | #D- File transfer functions |
---|
[16] | 404 | #D-************************* |
---|
| 405 | #D- |
---|
| 406 | |
---|
| 407 | #D-#================================================== |
---|
[203] | 408 | #D-function IGCM_sys_RmRunDir |
---|
| 409 | #D-* Purpose: rm tmpdir (dummy function most of the time batch |
---|
| 410 | #D- scheduler will do the job) |
---|
| 411 | #D-* Examples: |
---|
| 412 | #D- |
---|
| 413 | function IGCM_sys_RmRunDir { |
---|
[1057] | 414 | IGCM_debug_PushStack "IGCM_sys_RmRunDir" $@ |
---|
[657] | 415 | if ( $DEBUG_sys ) ; then |
---|
| 416 | echo "IGCM_sys_RmRunDir :" $@ |
---|
[964] | 417 | echo "Dummy call, let the scheduler do that." |
---|
[657] | 418 | fi |
---|
| 419 | IGCM_debug_PopStack "IGCM_sys_RmRunDir" |
---|
[203] | 420 | } |
---|
| 421 | |
---|
| 422 | #D-#================================================== |
---|
[16] | 423 | #D-function IGCM_sys_Put_Dir |
---|
| 424 | #D-* Purpose: Copy a complete directory on $(ARCHIVE) |
---|
| 425 | #D-* Examples: |
---|
| 426 | #D- |
---|
| 427 | function IGCM_sys_Put_Dir { |
---|
[657] | 428 | IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ |
---|
| 429 | if ( $DEBUG_sys ) ; then |
---|
| 430 | echo "IGCM_sys_Put_Dir :" $@ |
---|
| 431 | fi |
---|
| 432 | if [ $DRYRUN = 0 ]; then |
---|
| 433 | if [ ! -d ${1} ] ; then |
---|
| 434 | echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." |
---|
| 435 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
| 436 | return |
---|
[16] | 437 | fi |
---|
| 438 | |
---|
[717] | 439 | typeset status |
---|
[16] | 440 | |
---|
[717] | 441 | # Only if we use rsync |
---|
| 442 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
| 443 | # |
---|
| 444 | #USUAL WAY |
---|
[1179] | 445 | \cp -r $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[717] | 446 | status=$? |
---|
[16] | 447 | |
---|
[717] | 448 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 449 | IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" |
---|
[1179] | 450 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[657] | 451 | IGCM_debug_Exit "IGCM_sys_Put_Dir" |
---|
[16] | 452 | else |
---|
[1179] | 453 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[16] | 454 | fi |
---|
[657] | 455 | fi |
---|
| 456 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
[16] | 457 | } |
---|
| 458 | |
---|
| 459 | #D-#================================================== |
---|
| 460 | #D-function IGCM_sys_Get_Dir |
---|
[717] | 461 | #D-* Purpose: Copy a complete directory from ${ARCHIVE} |
---|
[16] | 462 | #D-* Examples: |
---|
| 463 | #D- |
---|
| 464 | function IGCM_sys_Get_Dir { |
---|
[657] | 465 | IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ |
---|
| 466 | if ( $DEBUG_sys ) ; then |
---|
| 467 | echo "IGCM_sys_Get_Dir :" $@ |
---|
| 468 | fi |
---|
| 469 | if [ $DRYRUN = 0 ]; then |
---|
[1180] | 470 | typeset NB_ESSAI DELAI status i |
---|
| 471 | # number of tentative |
---|
| 472 | NB_ESSAI=3 |
---|
| 473 | # time delay between tentative |
---|
| 474 | DELAI=2 |
---|
[16] | 475 | |
---|
[1180] | 476 | # |
---|
| 477 | # USUAL WAY |
---|
| 478 | i=0 |
---|
| 479 | while [ $i -lt $NB_ESSAI ] ; do |
---|
| 480 | \cp -ur $1 $2 >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 481 | status=$? |
---|
| 482 | if [ ${status} -gt 0 ] ; then |
---|
| 483 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 484 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." |
---|
| 485 | sleep $DELAI |
---|
| 486 | else |
---|
| 487 | break |
---|
| 488 | fi |
---|
| 489 | (( i = i + 1 )) |
---|
| 490 | done |
---|
[16] | 491 | |
---|
[717] | 492 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 493 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" |
---|
[1179] | 494 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[657] | 495 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
[16] | 496 | else |
---|
[1179] | 497 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[16] | 498 | fi |
---|
[657] | 499 | fi |
---|
| 500 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
[16] | 501 | } |
---|
| 502 | |
---|
| 503 | #D-#================================================== |
---|
| 504 | #D-function IGCM_sys_Put_Rest |
---|
[717] | 505 | #D-* Purpose: Put computied restarts on ${ARCHIVE}. |
---|
[282] | 506 | #D- File and target directory must exist. |
---|
[16] | 507 | #D-* Examples: |
---|
| 508 | #D- |
---|
| 509 | function IGCM_sys_Put_Rest { |
---|
[657] | 510 | IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ |
---|
| 511 | if ( $DEBUG_sys ) ; then |
---|
| 512 | echo "IGCM_sys_Put_Rest :" $@ |
---|
| 513 | fi |
---|
| 514 | if [ $DRYRUN = 0 ]; then |
---|
| 515 | if [ ! -f ${1} ] ; then |
---|
| 516 | echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." |
---|
| 517 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
[16] | 518 | fi |
---|
[717] | 519 | |
---|
| 520 | typeset status |
---|
| 521 | # |
---|
[1178] | 522 | # USUAL WAY |
---|
[1179] | 523 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[717] | 524 | status=$? |
---|
[16] | 525 | |
---|
[717] | 526 | # #RSYNC WITH NETWORK SSH CALL |
---|
[1179] | 527 | # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 528 | # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[16] | 529 | |
---|
[717] | 530 | # #RSYNC WITH NFS USE |
---|
[1179] | 531 | # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 532 | # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[16] | 533 | |
---|
[717] | 534 | # status=$? |
---|
| 535 | # IGCM_sys_Rsync_out $status |
---|
| 536 | |
---|
[1179] | 537 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[717] | 538 | # (( status=status+$? )) |
---|
| 539 | |
---|
| 540 | if [ ${status} -gt 0 ] ; then |
---|
[1180] | 541 | IGCM_debug_Print 2 "IGCM_sys_Put_Rest : cp failed error code ${status}" |
---|
[1178] | 542 | [ -f ${1} ] && ls -l ${1} |
---|
| 543 | [ -f ${2} ] && ls -l ${2} |
---|
| 544 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
[1179] | 545 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[657] | 546 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
| 547 | else |
---|
[1178] | 548 | |
---|
| 549 | if [ X${JobType} = XRUN ] ; then |
---|
| 550 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
| 551 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
| 552 | fi |
---|
| 553 | |
---|
[1179] | 554 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[657] | 555 | fi |
---|
| 556 | fi |
---|
| 557 | IGCM_debug_PopStack "IGCM_sys_Put_Rest" |
---|
| 558 | } |
---|
[16] | 559 | |
---|
[657] | 560 | #D-#================================================== |
---|
[16] | 561 | #D-function IGCM_sys_Put_Out |
---|
[717] | 562 | #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly |
---|
[16] | 563 | #D-* Examples: |
---|
| 564 | #D- |
---|
| 565 | function IGCM_sys_Put_Out { |
---|
[657] | 566 | IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ |
---|
| 567 | if ( $DEBUG_sys ) ; then |
---|
| 568 | echo "IGCM_sys_Put_Out :" $@ |
---|
| 569 | fi |
---|
[811] | 570 | |
---|
| 571 | typeset status |
---|
| 572 | |
---|
[657] | 573 | if [ $DRYRUN = 0 ]; then |
---|
[811] | 574 | if [ ! -f ${1} ] ; then |
---|
[657] | 575 | echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." |
---|
| 576 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 577 | return 1 |
---|
[16] | 578 | fi |
---|
[719] | 579 | # |
---|
[811] | 580 | IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
| 581 | # |
---|
[657] | 582 | if [ X${JobType} = XRUN ] ; then |
---|
| 583 | if [ X${3} = X ] ; then |
---|
| 584 | IGCM_sys_Chmod 444 ${1} |
---|
| 585 | fi |
---|
| 586 | fi |
---|
[717] | 587 | # |
---|
[16] | 588 | |
---|
[1179] | 589 | echo ${RSYNC} ${RSYNC_opt} $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 590 | ${RSYNC} ${RSYNC_opt} $1 $2 >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[717] | 591 | status=$? |
---|
| 592 | IGCM_sys_Rsync_out $status |
---|
[16] | 593 | |
---|
[1179] | 594 | ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[717] | 595 | (( status=status+$? )) |
---|
[16] | 596 | |
---|
[717] | 597 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 598 | IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}" |
---|
[1179] | 599 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[657] | 600 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
[16] | 601 | else |
---|
[1179] | 602 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[16] | 603 | fi |
---|
[657] | 604 | fi |
---|
| 605 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 606 | return 0 |
---|
[16] | 607 | } |
---|
| 608 | |
---|
| 609 | #D-#================================================== |
---|
| 610 | #D-function IGCM_sys_Get |
---|
| 611 | #D-* Purpose: Get a file from ${ARCHIVE} |
---|
| 612 | #D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX |
---|
| 613 | #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ |
---|
| 614 | function IGCM_sys_Get { |
---|
[657] | 615 | IGCM_debug_PushStack "IGCM_sys_Get" $@ |
---|
[16] | 616 | |
---|
[811] | 617 | typeset DEST status dm_liste |
---|
[16] | 618 | |
---|
[657] | 619 | if ( $DEBUG_sys ) ; then |
---|
| 620 | echo "IGCM_sys_Get :" $@ |
---|
| 621 | fi |
---|
| 622 | if [ $DRYRUN -le 2 ]; then |
---|
| 623 | if [ X${1} = X'/l' ] ; then |
---|
| 624 | eval set +A dm_liste \${${2}} |
---|
| 625 | else |
---|
| 626 | dm_liste=${1} |
---|
[16] | 627 | fi |
---|
[657] | 628 | eval DEST=\${${#}} |
---|
[16] | 629 | |
---|
[717] | 630 | # test if the (first) file is present in the old computation : |
---|
[657] | 631 | IGCM_sys_TestFileArchive ${dm_liste[0]} |
---|
[717] | 632 | status=$? |
---|
| 633 | if [ ${status} -gt 0 ] ; then |
---|
[657] | 634 | echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." |
---|
| 635 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
[811] | 636 | return |
---|
[657] | 637 | fi |
---|
[16] | 638 | |
---|
[811] | 639 | #USUAL WAY |
---|
[1179] | 640 | \cp ${dm_liste[*]} ${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[811] | 641 | status=$? |
---|
[16] | 642 | |
---|
[811] | 643 | if [ ${status} -gt 0 ] ; then |
---|
| 644 | IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}" |
---|
[1179] | 645 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[657] | 646 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
[16] | 647 | else |
---|
[1179] | 648 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[16] | 649 | fi |
---|
[657] | 650 | fi |
---|
| 651 | IGCM_debug_PopStack "IGCM_sys_Get" |
---|
[16] | 652 | } |
---|
| 653 | |
---|
| 654 | #D-#================================================== |
---|
[1131] | 655 | #D-function IGCM_sys_GetDate_Monitoring |
---|
| 656 | #D-* Purpose: get the last year for which the monitoring has been computed |
---|
| 657 | #D-* Examples: |
---|
| 658 | #D- |
---|
| 659 | function IGCM_sys_GetDate_Monitoring { |
---|
| 660 | IGCM_debug_PushStack "IGCM_sys_GetDate_Monitoring" $@ |
---|
| 661 | if ( $DEBUG_sys ) ; then |
---|
| 662 | echo "IGCM_sys_GetDate_Monitoring :" $@ |
---|
| 663 | fi |
---|
| 664 | |
---|
| 665 | eval ${2}=$( cdo showyear ${1} 2> /dev/null | gawk '{ print $NF }' ) |
---|
| 666 | |
---|
| 667 | IGCM_debug_PopStack "IGCM_sys_GetDate_Monitoring" |
---|
| 668 | } |
---|
| 669 | |
---|
| 670 | #D-#================================================== |
---|
[343] | 671 | #D-function IGCM_sys_Dods_Rm |
---|
[717] | 672 | #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. |
---|
[343] | 673 | #D-* Examples: |
---|
| 674 | #D- |
---|
| 675 | function IGCM_sys_Dods_Rm { |
---|
[657] | 676 | if ( $DEBUG_sys ) ; then |
---|
| 677 | echo "IGCM_sys_Dods_Rm :" $@ |
---|
| 678 | fi |
---|
| 679 | return 0 |
---|
[343] | 680 | } |
---|
| 681 | |
---|
| 682 | #D-#================================================== |
---|
| 683 | #D-function IGCM_sys_Dods_Cp |
---|
[717] | 684 | #D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. |
---|
[343] | 685 | #D-* Examples: |
---|
| 686 | #D- |
---|
| 687 | function IGCM_sys_Dods_Cp { |
---|
[657] | 688 | if ( $DEBUG_sys ) ; then |
---|
| 689 | echo "IGCM_sys_Dods_Cp :" $@ |
---|
| 690 | fi |
---|
| 691 | return 0 |
---|
[343] | 692 | } |
---|
| 693 | |
---|
| 694 | #D-#================================================== |
---|
[16] | 695 | #D-function IGCM_sys_Put_Dods |
---|
[811] | 696 | #D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here |
---|
[16] | 697 | #D-* Examples: |
---|
| 698 | #D- |
---|
| 699 | function IGCM_sys_Put_Dods { |
---|
[657] | 700 | IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ |
---|
| 701 | if ( $DEBUG_sys ) ; then |
---|
| 702 | echo "IGCM_sys_Put_Dods :" $@ |
---|
| 703 | fi |
---|
| 704 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
[16] | 705 | } |
---|
| 706 | |
---|
[657] | 707 | ############################################################## |
---|
| 708 | # REBUILD OPERATOR |
---|
[536] | 709 | |
---|
[811] | 710 | #D-#================================================== |
---|
[1163] | 711 | #D-function IGCM_sys_sync |
---|
[1300] | 712 | #D-* Purpose: flush buffer on disk (dummy function on Obelix) |
---|
[1163] | 713 | #D-* Examples: |
---|
| 714 | #D- |
---|
| 715 | function IGCM_sys_sync { |
---|
| 716 | IGCM_debug_PushStack "IGCM_sys_sync" $@ |
---|
| 717 | if ( $DEBUG_sys ) ; then |
---|
| 718 | echo "IGCM_sys_sync :" $@ |
---|
| 719 | echo "Dummy call, let the system do that." |
---|
| 720 | fi |
---|
| 721 | IGCM_debug_PopStack "IGCM_sys_sync" |
---|
| 722 | } |
---|
| 723 | |
---|
[657] | 724 | ############################################################ |
---|
| 725 | # Activate Running Environnment Variables |
---|
[536] | 726 | |
---|
[811] | 727 | #D-#================================================== |
---|
[1239] | 728 | #D-function IGCM_sys_activ_variables |
---|
[811] | 729 | #D-* Purpose: set environement variables prior to execution |
---|
| 730 | #D-* Examples: |
---|
| 731 | #D- |
---|
[657] | 732 | function IGCM_sys_activ_variables { |
---|
| 733 | IGCM_debug_PushStack "IGCM_sys_activ_variables" |
---|
| 734 | if ( $DEBUG_sys ) ; then |
---|
| 735 | echo "IGCM_sys_activ_variables" |
---|
| 736 | fi |
---|
[811] | 737 | |
---|
| 738 | # -------------------------------------------------------------------- |
---|
| 739 | #D- MPI specifications |
---|
| 740 | # -------------------------------------------------------------------- |
---|
| 741 | |
---|
| 742 | # -------------------------------------------------------------------- |
---|
| 743 | #D- Other specifications |
---|
| 744 | # -------------------------------------------------------------------- |
---|
| 745 | |
---|
[1300] | 746 | ulimit -s unlimited |
---|
| 747 | |
---|
[657] | 748 | IGCM_debug_PopStack "IGCM_sys_activ_variables" |
---|
[16] | 749 | } |
---|
| 750 | |
---|
[657] | 751 | ############################################################ |
---|
| 752 | # Desactivate Running Environnment Variables |
---|
[16] | 753 | |
---|
[811] | 754 | #D-#================================================== |
---|
| 755 | #D-function IGCM_sys_desactiv_variables |
---|
| 756 | #D-* Purpose: unset environement variables after execution |
---|
| 757 | #D-* Examples: |
---|
| 758 | #D- |
---|
[657] | 759 | function IGCM_sys_desactiv_variables { |
---|
| 760 | IGCM_debug_PushStack "IGCM_sys_desactiv_variables" |
---|
| 761 | if ( $DEBUG_sys ) ; then |
---|
| 762 | echo "IGCM_sys_desactiv_variables" |
---|
| 763 | fi |
---|
[811] | 764 | # -------------------------------------------------------------------- |
---|
| 765 | #D- MPI specifications |
---|
| 766 | # -------------------------------------------------------------------- |
---|
| 767 | |
---|
| 768 | # -------------------------------------------------------------------- |
---|
| 769 | #D- Other specifications |
---|
| 770 | # -------------------------------------------------------------------- |
---|
| 771 | |
---|
[657] | 772 | IGCM_debug_PopStack "IGCM_sys_desactiv_variables" |
---|
| 773 | } |
---|
| 774 | |
---|
| 775 | ############################################################ |
---|
[1239] | 776 | # Update job headers to be used by the scheduler |
---|
| 777 | |
---|
| 778 | #D-#================================================== |
---|
| 779 | #D-function IGCM_sys_updateHeaders |
---|
| 780 | #D-* Purpose: Update job headers to be used by the scheduler |
---|
| 781 | #D-* Examples: IGCM_sys_updateHeaders /path/to/Job_MYEXP |
---|
| 782 | #D- |
---|
| 783 | function IGCM_sys_updateHeaders { |
---|
| 784 | IGCM_debug_PushStack "IGCM_sys_updateHeaders" |
---|
| 785 | if ( $DEBUG_sys ) ; then |
---|
| 786 | echo "IGCM_sys_updateHeaders" |
---|
| 787 | fi |
---|
| 788 | typeset file |
---|
| 789 | file=$1 |
---|
| 790 | |
---|
| 791 | if [ ${executionType} -eq 1 ] ; then |
---|
| 792 | # MPMD + MPI |
---|
| 793 | sed -e "/::openMPthreads::/d" \ |
---|
| 794 | -e "s/::JobNumProcTot::/${coreNumber}/" \ |
---|
| 795 | ${file} > ${file}.tmp |
---|
| 796 | |
---|
| 797 | elif [ ${executionType} -eq 2 ] ; then |
---|
| 798 | # MPMD + MPI + OMP |
---|
| 799 | sed -e "s/::openMPthreads::/${openMPthreads}/" \ |
---|
| 800 | -e "s/::JobNumProcTot::/${coreNumber}/" \ |
---|
| 801 | ${file} > ${file}.tmp |
---|
| 802 | |
---|
| 803 | elif [ ${executionType} -eq 3 ] ; then |
---|
| 804 | # SPMD + MPI/OMP |
---|
| 805 | sed -e "s/::openMPthreads::/${openMPthreads}/" \ |
---|
| 806 | -e "s/::JobNumProcTot::/${mpiTasks}/" \ |
---|
| 807 | ${file} > ${file}.tmp |
---|
| 808 | |
---|
| 809 | elif [ ${executionType} -eq 4 ] ; then |
---|
| 810 | # SPMD + MPI only |
---|
| 811 | sed -e "s/::JobNumProcTot::/${mpiTasks}/" \ |
---|
| 812 | -e "/::openMPthreads::/d" \ |
---|
| 813 | ${file} > ${file}.tmp |
---|
| 814 | |
---|
| 815 | elif [ ${executionType} -eq 5 ] ; then |
---|
| 816 | # SPMD + OMP only |
---|
| 817 | sed -e "s/::openMPthreads::/${openMPthreads}/" \ |
---|
| 818 | -e "/::JobNumProcTot::/d" \ |
---|
| 819 | ${file} > ${file}.tmp |
---|
| 820 | |
---|
| 821 | elif [ ${executionType} -eq 6 ] ; then |
---|
| 822 | # SEQUENTIAL THEN |
---|
| 823 | sed -e "s/::JobNumProcTot::/1/" \ |
---|
| 824 | -e "/::openMPthreads::/d" \ |
---|
| 825 | ${file} > ${file}.tmp |
---|
| 826 | |
---|
| 827 | fi |
---|
| 828 | |
---|
| 829 | IGCM_sys_Mv ${file}.tmp ${file} |
---|
| 830 | |
---|
| 831 | IGCM_debug_PopStack "IGCM_sys_updateHeaders" |
---|
| 832 | } |
---|
| 833 | |
---|
| 834 | ############################################################ |
---|
[800] | 835 | # Build MPI/OMP scripts run file (dummy function) |
---|
[657] | 836 | |
---|
[811] | 837 | #D-#================================================== |
---|
| 838 | #D-function IGCM_sys_build_run_file |
---|
| 839 | #D-* Purpose: build run file (deprecated) |
---|
| 840 | #D-* Examples: |
---|
| 841 | #D- |
---|
[657] | 842 | function IGCM_sys_build_run_file { |
---|
[664] | 843 | IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " |
---|
[657] | 844 | } |
---|
| 845 | |
---|
| 846 | ############################################################ |
---|
| 847 | # Build MPI/OMP scripts |
---|
[811] | 848 | |
---|
| 849 | #D-#================================================== |
---|
| 850 | #D-function IGCM_sys_build_execution_scripts |
---|
| 851 | #D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} |
---|
| 852 | #D-* Examples: |
---|
| 853 | #D- |
---|
[657] | 854 | function IGCM_sys_build_execution_scripts |
---|
| 855 | { |
---|
| 856 | IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ |
---|
| 857 | if ( $DEBUG_sys ) ; then |
---|
| 858 | echo "IGCM_sys_build_execution_scripts " $@ |
---|
| 859 | fi |
---|
[1180] | 860 | |
---|
[1300] | 861 | EXECUTION=${HOST_MPIRUN_COMMAND} |
---|
[657] | 862 | |
---|
[1300] | 863 | # MPMD mode |
---|
[657] | 864 | if ( ${OK_PARA_MPMD} ) ; then |
---|
| 865 | |
---|
[1300] | 866 | # Only MPI (MPMD) |
---|
| 867 | if ( ! ${OK_PARA_OMP} ) ; then |
---|
[657] | 868 | |
---|
[1300] | 869 | if [ -f run_file ] ; then |
---|
| 870 | IGCM_sys_Rm -f run_file |
---|
| 871 | fi |
---|
| 872 | touch run_file |
---|
[657] | 873 | |
---|
[1300] | 874 | # Build run_file |
---|
| 875 | |
---|
| 876 | # First loop on the components for the coupler ie oasis (only if oasis3) |
---|
| 877 | # the coupler ie oasis3 must be the first one |
---|
| 878 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 879 | |
---|
| 880 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 881 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 882 | |
---|
| 883 | # for CPL component only |
---|
| 884 | if [ "X${comp}" = "XCPL" ] && [ "X${ExeNameOut}" != X\"\" ] ; then |
---|
| 885 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 886 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
| 887 | echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file |
---|
| 888 | fi |
---|
| 889 | done |
---|
| 890 | |
---|
| 891 | # Then second loop on the components |
---|
| 892 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 893 | |
---|
| 894 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 895 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 896 | |
---|
| 897 | # Only if we really have an executable for the component and not the coupler ie oasis: |
---|
| 898 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then |
---|
| 899 | |
---|
| 900 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 901 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
| 902 | echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file |
---|
| 903 | fi |
---|
| 904 | done |
---|
| 905 | |
---|
| 906 | EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file" |
---|
| 907 | |
---|
| 908 | IGCM_sys_Chmod u+x run_file |
---|
| 909 | if ( $DEBUG_sys ) ; then |
---|
| 910 | echo "run_file contains : " |
---|
| 911 | cat run_file |
---|
| 912 | fi |
---|
| 913 | |
---|
| 914 | # MPI-OpenMP (MPMD) |
---|
| 915 | else |
---|
| 916 | |
---|
[657] | 917 | # Hosts treatment |
---|
| 918 | ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp |
---|
| 919 | |
---|
| 920 | i=0 |
---|
| 921 | rm -f hosts |
---|
[1300] | 922 | IGCM_debug_Print 1 "sys Obelix, Hosts available :" |
---|
[657] | 923 | for nodes in `cat hosts.tmp` ; do |
---|
| 924 | host[$i]=$nodes |
---|
| 925 | echo "${host[$i]} slots=1 max_slots=1" >> hosts |
---|
| 926 | IGCM_debug_Print 1 ${host[$i]} |
---|
| 927 | i=$((i+1)) |
---|
| 928 | done |
---|
| 929 | rm -f hosts.tmp |
---|
| 930 | |
---|
| 931 | listnodes=${host[*]} |
---|
| 932 | |
---|
| 933 | EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" |
---|
| 934 | |
---|
| 935 | # Initialisation |
---|
[1300] | 936 | rank=0 |
---|
| 937 | current_core=0 |
---|
| 938 | core_per_node=6 |
---|
[657] | 939 | init_exec=n |
---|
| 940 | |
---|
[1300] | 941 | # Loop on the components |
---|
[657] | 942 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 943 | |
---|
[1300] | 944 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 945 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
[657] | 946 | |
---|
[1300] | 947 | # Not possible if oasis has an executable (i.e old version of oasis3) |
---|
| 948 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" = "XCPL" ] ) ; then |
---|
| 949 | IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version" |
---|
| 950 | IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler" |
---|
| 951 | IGCM_debug_Verif_Exit |
---|
[657] | 952 | fi |
---|
| 953 | |
---|
| 954 | # Only if we really have an executable for the component : |
---|
[1300] | 955 | if [ "X${ExeNameOut}" != X\"\" ] ; then |
---|
[657] | 956 | |
---|
| 957 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 958 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
| 959 | |
---|
| 960 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
| 961 | echo "" >> script_${ExeNameOut}.ksh |
---|
[1300] | 962 | if [ ${comp_proc_omp_loc} -gt 1 ] ; then |
---|
| 963 | |
---|
| 964 | # Check if the number of threads is correct |
---|
| 965 | case ${comp_proc_omp_loc} in |
---|
| 966 | 2|4|6) |
---|
| 967 | IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" |
---|
| 968 | ;; |
---|
| 969 | *) |
---|
| 970 | IGCM_debug_Exit "ERROR with OMP parameters !" |
---|
| 971 | IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" |
---|
| 972 | IGCM_debug_Print 2 "Only 2,4,6 as number of OMP threads are possible " |
---|
| 973 | IGCM_debug_Verif_Exit |
---|
| 974 | ;; |
---|
| 975 | esac |
---|
| 976 | #echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh |
---|
| 977 | #echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh |
---|
| 978 | #echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh |
---|
| 979 | echo "export OMP_STACKSIZE=200M" >> script_${ExeNameOut}.ksh |
---|
| 980 | echo "export OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh |
---|
| 981 | fi |
---|
[1318] | 982 | |
---|
[1317] | 983 | #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
[1318] | 984 | echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK )) " >> script_${ExeNameOut}.ksh |
---|
| 985 | echo "MYMPIRANK=\$(printf '%3.3d\n' \${MYMPIRANK})" >> script_${ExeNameOut}.ksh |
---|
| 986 | echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh |
---|
[657] | 987 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
| 988 | |
---|
[1300] | 989 | if [ ${init_exec} = y ] ; then |
---|
| 990 | EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" |
---|
| 991 | else |
---|
| 992 | EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" |
---|
| 993 | init_exec=y |
---|
| 994 | fi |
---|
[657] | 995 | |
---|
[1300] | 996 | # Build rankfile : method used to assign cores and nodes for the MPI process |
---|
| 997 | # Ex : |
---|
| 998 | #rank 0=curie5296 slot=0,1,2,3 |
---|
| 999 | #rank 1=curie5296 slot=4,5,6,7 |
---|
| 1000 | # Example of final command : |
---|
| 1001 | # mpirun -hostfile hosts -rankfile rankfile -np 27 ./script_lmdz.x.ksh : -np 5 ./script_opa.xx.ksh |
---|
| 1002 | # with script_lmdz.x.ksh : |
---|
| 1003 | # #!/bin/ksh |
---|
| 1004 | #export OMP_STACKSIZE=200M |
---|
| 1005 | #export OMP_NUM_THREADS=4 |
---|
| 1006 | #./lmdz.x |
---|
[657] | 1007 | |
---|
[1300] | 1008 | for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do |
---|
| 1009 | (( index_host = current_core / core_per_node )) |
---|
| 1010 | host_value=${host[${index_host}]} |
---|
| 1011 | (( slot = current_core % core_per_node )) |
---|
| 1012 | virg="," |
---|
| 1013 | string_final="" |
---|
| 1014 | for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do |
---|
| 1015 | string=$index$virg |
---|
| 1016 | string_final=$string_final$string |
---|
| 1017 | done |
---|
| 1018 | string_final=$( echo $string_final | sed "s/.$//" ) |
---|
| 1019 | echo "rank $rank=$host_value slot=$string_final" >> rankfile |
---|
| 1020 | (( rank = rank + 1 )) |
---|
| 1021 | (( current_core = current_core + comp_proc_omp_loc )) |
---|
[657] | 1022 | done |
---|
| 1023 | fi |
---|
| 1024 | done |
---|
[16] | 1025 | fi |
---|
| 1026 | |
---|
[1300] | 1027 | # Only one executable (SPMD mode). |
---|
| 1028 | else |
---|
[657] | 1029 | |
---|
[664] | 1030 | for comp in ${config_ListOfComponents[*]} ; do |
---|
[657] | 1031 | |
---|
[664] | 1032 | # Only if we really have an executable for the component : |
---|
| 1033 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1034 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then |
---|
[657] | 1035 | |
---|
[664] | 1036 | echo "#!/bin/ksh" > script_${ExeNameOut}.ksh |
---|
| 1037 | echo "" >> script_${ExeNameOut}.ksh |
---|
| 1038 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1039 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
[1300] | 1040 | echo "export OMP_STACKSIZE=200M" >> script_${ExeNameOut}.ksh |
---|
| 1041 | echo "export OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh |
---|
[664] | 1042 | fi |
---|
| 1043 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 1044 | # Default : mpirun used if nb_proc gt 1 |
---|
| 1045 | # pour sortie out/err par process |
---|
[1317] | 1046 | echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}" >> script_${ExeNameOut}.ksh |
---|
| 1047 | #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
[664] | 1048 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
| 1049 | EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh" |
---|
| 1050 | else |
---|
| 1051 | # Default : mpirun is NOT used if nb_proc eq 1 |
---|
| 1052 | # pour sortie out/err par process |
---|
[1317] | 1053 | echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh |
---|
| 1054 | #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh |
---|
[664] | 1055 | IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh |
---|
| 1056 | EXECUTION="time ./script_${ExeNameOut}.ksh" |
---|
| 1057 | fi |
---|
[1002] | 1058 | |
---|
| 1059 | IGCM_debug_Print 1 "sys Obelix : script_${ExeNameOut}.ksh contains" |
---|
| 1060 | cat script_${ExeNameOut}.ksh |
---|
| 1061 | |
---|
[664] | 1062 | fi |
---|
[1180] | 1063 | |
---|
[664] | 1064 | done |
---|
[657] | 1065 | |
---|
| 1066 | fi |
---|
| 1067 | |
---|
[811] | 1068 | IGCM_debug_Print 1 "sys Obelix : execution command is" |
---|
| 1069 | IGCM_debug_Print 1 "$EXECUTION" |
---|
[657] | 1070 | |
---|
| 1071 | IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" |
---|
[16] | 1072 | } |
---|
| 1073 | |
---|
[933] | 1074 | #D-#================================================== |
---|
| 1075 | #D-function IGCM_sys_check_path |
---|
| 1076 | #D-* Purpose: check that RUN_DIR_PATH that will be removed on some machine |
---|
| 1077 | #D-* do not point to an important use directory. Stop immediately in that case. |
---|
| 1078 | #D-* Examples: |
---|
| 1079 | #D- |
---|
| 1080 | function IGCM_sys_check_path { |
---|
| 1081 | IGCM_debug_PushStack "IGCM_sys_check_path" |
---|
| 1082 | if ( $DEBUG_sys ) ; then |
---|
| 1083 | echo "IGCM_sys_check_path" |
---|
| 1084 | fi |
---|
[811] | 1085 | |
---|
[933] | 1086 | if ( [ X${RUN_DIR_PATH} = X${HOME} ] || [ X${RUN_DIR_PATH} = X${ARCHIVE} ] ) ; then |
---|
| 1087 | IGCM_debug_Print 1 "Variable RUN_DIR_PATH is pointing to an important directory : ${RUN_DIR_PATH}" |
---|
| 1088 | IGCM_debug_Print 1 "Please check the RUN_DIR_PATH definition in your Job : Job_${config_UserChoices_JobName}" |
---|
[936] | 1089 | IGCM_debug_Exit "This will stop the job" |
---|
[933] | 1090 | fi |
---|
| 1091 | IGCM_debug_PopStack "IGCM_sys_check_path" |
---|
| 1092 | } |
---|
| 1093 | |
---|
[811] | 1094 | #D-#================================================== |
---|
| 1095 | #D-function IGCM_sys_check_quota. Dummy call here |
---|
| 1096 | #D-* Purpose: check user quota. Stop the simulation if quota above 90% |
---|
| 1097 | #D-* Examples: |
---|
| 1098 | #D- |
---|
[657] | 1099 | function IGCM_sys_check_quota { |
---|
| 1100 | IGCM_debug_PushStack "IGCM_sys_check_quota" |
---|
| 1101 | if ( $DEBUG_sys ) ; then |
---|
| 1102 | echo "IGCM_sys_check_quota" |
---|
| 1103 | fi |
---|
[1300] | 1104 | |
---|
| 1105 | # TO BE IMPLEMENTED |
---|
| 1106 | |
---|
[657] | 1107 | IGCM_debug_PopStack "IGCM_sys_check_quota" |
---|
| 1108 | } |
---|
| 1109 | |
---|
[811] | 1110 | #D-#================================================== |
---|
[1286] | 1111 | #D-function IGCM_sys_projectAccounting |
---|
| 1112 | #D-* Purpose: store project accounting information in a file |
---|
| 1113 | #D-* Examples: |
---|
| 1114 | #D- |
---|
| 1115 | function IGCM_sys_projectAccounting { |
---|
| 1116 | IGCM_debug_PushStack "IGCM_sys_projectAccounting" |
---|
| 1117 | if ( $DEBUG_sys ) ; then |
---|
| 1118 | echo "IGCM_sys_check_quota" |
---|
| 1119 | fi |
---|
| 1120 | |
---|
| 1121 | touch $1 |
---|
| 1122 | |
---|
| 1123 | IGCM_debug_PopStack "IGCM_sys_projectAccounting" |
---|
| 1124 | } |
---|
| 1125 | |
---|
| 1126 | #D-#================================================== |
---|
[1244] | 1127 | #D-function IGCM_sys_getJobSchedulerID |
---|
| 1128 | #D-* Purpose: Get the job ID during execution |
---|
| 1129 | #D-* Examples: IGCM_sys_getJobSchedulerID jobSchedulerID |
---|
| 1130 | #D- |
---|
| 1131 | function IGCM_sys_getJobSchedulerID { |
---|
| 1132 | IGCM_debug_PushStack "IGCM_sys_getJobSchedulerID" |
---|
| 1133 | if ( $DEBUG_sys ) ; then |
---|
| 1134 | echo "IGCM_sys_getJobSchedulerID" |
---|
| 1135 | fi |
---|
| 1136 | |
---|
| 1137 | eval ${1}=$( echo ${PBS_JOBID} | awk -F. '{print $1}' ) |
---|
| 1138 | |
---|
| 1139 | IGCM_debug_PopStack "IGCM_sys_getJobSchedulerID" |
---|
| 1140 | } |
---|
| 1141 | |
---|
| 1142 | #D-#================================================== |
---|
[1124] | 1143 | #D-function IGCM_sys_GetJobID |
---|
[1244] | 1144 | #D-* Purpose: Get the job ID from the JobName |
---|
[1124] | 1145 | #D-* Examples: IGCM_sys_GetJobID ${JobName} ${TargetUsr} JobID |
---|
| 1146 | #D- |
---|
| 1147 | function IGCM_sys_GetJobID { |
---|
| 1148 | IGCM_debug_PushStack "IGCM_sys_GetJobID" |
---|
| 1149 | if ( $DEBUG_sys ) ; then |
---|
| 1150 | echo "IGCM_sys_GetJobID" |
---|
| 1151 | fi |
---|
| 1152 | |
---|
| 1153 | # With -f option, the full job name is given in the last column |
---|
[1300] | 1154 | ID="$( qstat -u $2 | grep -w $1 | gawk '-F ' '{print $10}' )" |
---|
[1124] | 1155 | |
---|
| 1156 | eval ${3}=${ID} |
---|
| 1157 | IGCM_debug_PopStack "IGCM_sys_GetJobID" |
---|
| 1158 | } |
---|
| 1159 | |
---|
| 1160 | #D-#================================================== |
---|
[811] | 1161 | #D-function IGCM_sys_CountJobInQueue |
---|
[1244] | 1162 | #D-* Purpose: Count number of users job |
---|
[811] | 1163 | #D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun |
---|
| 1164 | #D- |
---|
| 1165 | function IGCM_sys_CountJobInQueue { |
---|
| 1166 | IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" |
---|
| 1167 | if ( $DEBUG_sys ) ; then |
---|
| 1168 | echo "IGCM_sys_CountJobInQueue" |
---|
| 1169 | fi |
---|
| 1170 | IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" |
---|
| 1171 | } |
---|
[1272] | 1172 | |
---|
| 1173 | #D-#================================================== |
---|
| 1174 | #D-function IGCM_sys_atlas |
---|
| 1175 | #D-* Purpose: encapsulate atlas call so as to manage error code and curie specificity |
---|
| 1176 | #D-* Examples: |
---|
| 1177 | #D- |
---|
| 1178 | function IGCM_sys_atlas { |
---|
| 1179 | IGCM_debug_PushStack "IGCM_sys_atlas" $@ |
---|
| 1180 | if ( $DEBUG_sys ) ; then |
---|
| 1181 | echo "IGCM_sys_atlas :" $@ |
---|
| 1182 | fi |
---|
| 1183 | |
---|
| 1184 | typeset status |
---|
| 1185 | |
---|
| 1186 | \atlas $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 1187 | status=$? |
---|
| 1188 | if [ ${status} -gt 0 ] ; then |
---|
| 1189 | echo "IGCM_sys_atlas : error code ${status}" |
---|
| 1190 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 1191 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 1192 | IGCM_debug_PopStack "IGCM_sys_atlas" |
---|
| 1193 | return 1 |
---|
| 1194 | else |
---|
| 1195 | IGCM_debug_PopStack "IGCM_sys_atlas" |
---|
| 1196 | return 0 |
---|
| 1197 | fi |
---|
| 1198 | |
---|
| 1199 | IGCM_debug_PopStack "IGCM_sys_atlas" |
---|
| 1200 | } |
---|
| 1201 | |
---|
[1380] | 1202 | |
---|
| 1203 | #D-#================================================== |
---|
| 1204 | #D-function IGCM_sys_rebuild_nemo |
---|
| 1205 | #D-* Purpose: rebuild nemo parallel files with general rebuild |
---|
| 1206 | #D-* Examples: |
---|
| 1207 | #D- |
---|
| 1208 | |
---|
| 1209 | function IGCM_sys_rebuild_nemo { |
---|
| 1210 | IGCM_debug_PushStack "IGCM_sys_rebuild_nemo" $@ |
---|
| 1211 | if ( $DEBUG_sys ) ; then |
---|
| 1212 | echo "IGCM_sys_rebuild_nemo :" $@ |
---|
| 1213 | fi |
---|
| 1214 | |
---|
| 1215 | nemo_generic_restart_file_name_out=${1} |
---|
| 1216 | nemo_extension_out=${3} |
---|
| 1217 | shift ; shift ; shift |
---|
| 1218 | |
---|
| 1219 | IGCM_sys_rebuild -o ${nemo_generic_restart_file_name_out}.${nemo_extension_out} $@ |
---|
| 1220 | |
---|
| 1221 | IGCM_debug_PopStack "IGCM_sys_rebuild_nemo" |
---|
| 1222 | } |
---|
| 1223 | |
---|