[71] | 1 | #!/bin/ksh |
---|
[503] | 2 | # mrun - script for running PALM jobs |
---|
[169] | 3 | # $Id: mrun 970 2012-08-06 14:13:29Z maronga $ |
---|
[1] | 4 | |
---|
[503] | 5 | # Procedure for interactive/batch PALM runs (initial runs and automatic |
---|
| 6 | # restart runs) |
---|
[1] | 7 | |
---|
[503] | 8 | # Last changes: |
---|
[1] | 9 | # 03/03/94 - Siggi - Entwicklungsbeginn |
---|
| 10 | # 21/03/94 - Siggi - Entwicklungsabschluss (Version 1.0) |
---|
| 11 | # 09/12/94 - Siggi - allexport unterbunden; statt dessen werden jetzt ein- |
---|
| 12 | # zelne Variable exportiert. Dies ist noetig, weil an- |
---|
| 13 | # sonsten irgendein Speicher ueberlaeuft und von mrun |
---|
| 14 | # aufgerufene Programme (z.B. stageout) mit Fehlern |
---|
| 15 | # abbrechen (too many arguments) |
---|
| 16 | # 20/06/95 - Siggi - noclobber muss explizit abgeschaltet, da jetzt |
---|
| 17 | # defaultmaessig im RRZN-Profile eingeschaltet |
---|
| 18 | # 10/06/97 - Siggi - Zusaetzliche Option -C bei cpp, damit // nicht |
---|
| 19 | # wegfallen |
---|
| 20 | # 25/04/00 - Siggi - Version 1.5 |
---|
| 21 | # remote_addres und remote_user in return_addres bzw. |
---|
| 22 | # return_username umbenannt, return_username wird dem |
---|
| 23 | # mrun-Aufruf im Job ueber Option -U mitgegeben. |
---|
| 24 | # Neue Variable remote_username, die beim interaktiven |
---|
| 25 | # mrun-Aufruf zwingend ueber die neue Option -u oder |
---|
| 26 | # in der Konfigurationsdatei angegeben werden muss. |
---|
| 27 | # 08/02/01 - Siggi - Alle mrun-Meldungen ins englische uebersetzt, |
---|
| 28 | # Version 1.7 |
---|
| 29 | # 05/05/02 - Siggi - Uebersetzungen mittels make-Mechanismus moeglich |
---|
| 30 | # 21/11/02 - Siggi - ENV-Variable XLFRTEOPTS wird vor Ausfuehrung auf |
---|
| 31 | # IBM gesetzt, um Record-Laenge der NAMELIST-Dateien, |
---|
| 32 | # zu bestimmen; Praeprozessoroptionen haben nun alle |
---|
| 33 | # die Form -Dtext=text, weil auf IBM sonst text durch |
---|
| 34 | # die leere Zeichenkette ersetzt wird |
---|
| 35 | # 01/08/03 - Siggi - Test of implementing dvrp+1PE on ibm |
---|
| 36 | # 07/01/04 - Siggi - additional preprocessor directive for ibm included |
---|
| 37 | # (-D$OMP=OMP) in order to avoid problems with |
---|
| 38 | # OMP_NUM_THREADS |
---|
| 39 | # 04/01/05 - Siggi - archiving on hanni and berni is done in separate |
---|
| 40 | # tar files, one for each node used |
---|
| 41 | # 07/01/04 - Siggi - old code for t3e, vpp and hpcs eliminated |
---|
| 42 | # 09/01/05 - Siggi - workaround for getting the IP address on gfdl3 |
---|
| 43 | # 17/01/05 - Siggi - job for data transfer to local machine now within |
---|
| 44 | # job class c1 (HLRN) |
---|
| 45 | # 27/01/05 - Siggi - IP address workaround for gfdl3 removed |
---|
| 46 | # 28/01/05 - Siggi - tar-filenames on $PERM (HLRN) now include the |
---|
| 47 | # base filename and cycle number |
---|
| 48 | # 16/02/05 - Gerald - hababai validated |
---|
| 49 | # 14/03/05 - Siggi - abort on NEC after first runtime error (F_ERRCNT) |
---|
| 50 | # 29/03/05 - Marcus - berni*-en0 validated |
---|
| 51 | # 21/04/05 - Siggi - transfer-job-protocol for avs-data is no more stored |
---|
| 52 | # 24/04/05 - Siggi - netcdf support on lcmuk |
---|
| 53 | # 25/04/05 - Siggi - netcdf support on gfld3 (decalpha) |
---|
| 54 | # 11/05/05 - Siggi - files with non-numeric extensions (.xxx after cycle |
---|
| 55 | # number) can now be used within interactive runs |
---|
| 56 | # 12/05/05 - Siggi - netcdf support on ibm |
---|
| 57 | # 13/05/05 - Siggi - error in tar-filenames on $PERM (HLRN) removed |
---|
| 58 | # 18/05/05 - Siggi - netcdf support on nec |
---|
| 59 | # 24/05/05 - Siggi - netcdf support on ibms |
---|
| 60 | # 14/06/05 - Siggi - sleep interval after submit of restart job increased |
---|
| 61 | # to 30 seconds |
---|
| 62 | # 28/06/05 - Siggi - bora adjusted to new intel compiler (LD_LIBRARY_ |
---|
| 63 | # PATH is temporarily set) |
---|
| 64 | # 07/09/05 - Siggi - setting of MP_EAGER_LIMIT switched off because it |
---|
| 65 | # caused warnings in the job protocol |
---|
| 66 | # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3) |
---|
| 67 | # 25/10/05 - Siggi - error in listing files for getting the cycle number |
---|
| 68 | # removed |
---|
| 69 | # 26/10/05 - Siggi - new paths for dvrp-library, transfer of catalogs |
---|
| 70 | # realized by file attribute trpe |
---|
| 71 | # 28/10/05 - Siggi - if existing, the file extension is output in case |
---|
| 72 | # of missing input file - no job abort in case of |
---|
| 73 | # missing input files with file extensions |
---|
| 74 | # (preliminary solution) |
---|
| 75 | # 31/10/05 - Siggi - data transfer from nech now within seperate job |
---|
| 76 | # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb |
---|
| 77 | # 07/12/05 - Siggi - gallego and elephanta admitted |
---|
| 78 | # 30/12/05 - Siggi - gfdl5 (ibmy) admitted |
---|
| 79 | # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support |
---|
| 80 | # 20/01/06 - Siggi - cpp directive for ibmy |
---|
| 81 | # 09/02/06 - Siggi - ibmy admitted for batch mode |
---|
| 82 | # 13/04/06 - Siggi - ostria admitted |
---|
| 83 | # 18/04/06 - Siggi - usage of OpenMP implemented (additional option -O) |
---|
| 84 | # 10/05/06 - Siggi - environment variable XLSMPOPTS set on IBM for |
---|
| 85 | # optimization of OpenMP runs (option stacksize is |
---|
| 86 | # necessary for large gridpoint numbers because |
---|
| 87 | # otherwise a segmentation fault occurs) |
---|
| 88 | # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted |
---|
| 89 | # 21/08/06 - Siggi - standard mrun path on scirocco is as on bora |
---|
| 90 | # 23/08/06 - Siggi - netcdf support for scirocco (notebook) |
---|
| 91 | # 20/09/06 - Marcus - add DVRP library on nech |
---|
| 92 | # 24/10/06 - Siggi - Environment variables for PALM steering are written |
---|
| 93 | # on local NAMELIST file ENVPAR |
---|
| 94 | # 24/11/06 - Siggi - levanto admitted, maestro switched to ifc 9.1 |
---|
| 95 | # 28/11/06 - Siggi - call to interpret_config.x_levanto because of SuSe 10 |
---|
| 96 | # 06/02/07 - Siggi - add DVRP library on lcmuk |
---|
| 97 | # 07/02/07 - Siggi - revision of source code handling, source code is |
---|
| 98 | # now expected in directory given by source_path and |
---|
| 99 | # not in the current working directory, source code |
---|
| 100 | # files provided in add_source_path are allways |
---|
| 101 | # compiled, source code to be compiled is allways |
---|
| 102 | # sampled in SOURCES_FOR_RUN_$fname which is a |
---|
| 103 | # subdirectory of the current working directory, |
---|
[5] | 104 | # -s TEST changed to -s WRITE_PERMIT or -s WP, |
---|
[1] | 105 | # adapted for RIAM (neck) |
---|
[5] | 106 | # bugfix for cycle number of output file (extout) |
---|
| 107 | # all hpmuk-related code removed |
---|
[14] | 108 | # 14/02/07 - Siggi - dvrp support for neck added |
---|
[21] | 109 | # 28/02/07 - Siggi - empty lines in configuration file are accepted |
---|
[26] | 110 | # mrun_path replaced by PALM_BIN, |
---|
| 111 | # all machines are calling interpret_config.x |
---|
[66] | 112 | # 14/03/07 - Siggi - fimm admitted, revision number added to terminal |
---|
| 113 | # output |
---|
[69] | 114 | # 16/03/07 - Siggi - adjustments for lctit |
---|
[78] | 115 | # 29/03/07 - Siggi - global revision transfered to batch job by new |
---|
| 116 | # option -G |
---|
[82] | 117 | # 30/03/07 - Siggi - compilation "by hand" removed, cpp-directives/options |
---|
| 118 | # + netcdf/dvrp-options are read from configuration |
---|
| 119 | # file, host identifier (local_host) is read from |
---|
| 120 | # config file, code related to ftp filetransfer |
---|
| 121 | # removed (incl. option -f) |
---|
[97] | 122 | # 19/06/07 - Siggi - time limit for cdata jobs increased |
---|
[102] | 123 | # 25/07/07 - Siggi - two sets of executables can be started on lcmuk, |
---|
| 124 | # if new option -Y (coupling) is given, |
---|
| 125 | # output of executables to aout_output removed, |
---|
| 126 | # messages are immediately written to stdout instead |
---|
[108] | 127 | # 03/08/07 - Marcus - add XOPT="-X $numprocs" for lcfimm |
---|
| 128 | # 09/08/07 - Marcus - workaround on lcfimm to propagate environment |
---|
| 129 | # variables out to the nodes in coupled mode -disabled- |
---|
| 130 | # 13/08/07 - Marcus - start local restart jobs per ssh on lcfimm |
---|
[109] | 131 | # 28/08/07 - Marcus - completely remove workaround on lcfimm to propagate |
---|
| 132 | # environment variables out to the nodes in coupled mode |
---|
[118] | 133 | # 15/10/07 - Siggi - Preliminary adjustments for lctit, based on Jin's |
---|
| 134 | # suggestions |
---|
[122] | 135 | # 19/10/07 - Marcus - further adjustments for lctit: add new optional |
---|
| 136 | # argument -g group_number, admit all sla* node_usage |
---|
| 137 | # queues |
---|
[129] | 138 | # 30/10/07 - Marcus - further adjustments for queues on lctit |
---|
[149] | 139 | # 14/02/08 - Bjoern - link of restart files with long file name possible |
---|
| 140 | # 28/02/08 - Marcus - If environment variable link_local_output is set to |
---|
| 141 | # true, mrun tries "ln -f" on local output and resorts |
---|
| 142 | # to "cp" or "cp -r" on error |
---|
[164] | 143 | # 15/04/08 - Siggi - argument -c introduced to most of the subjob calls, |
---|
| 144 | # which allows the user to choose his own job catalog |
---|
| 145 | # by setting job_catalog in the configuration file |
---|
| 146 | # (default is ~/job_queue), |
---|
[172] | 147 | # workaround for mpiexec with -env option, |
---|
[164] | 148 | # adjustments for lcxt4 (Bergen Center for Computational |
---|
| 149 | # Science) |
---|
[183] | 150 | # 22/05/08 - Marcus - If environment variable link_local_input is set to |
---|
| 151 | # true, mrun tries "ln -f" on local input and resorts |
---|
| 152 | # to "cp" or "cp -r" on error |
---|
[180] | 153 | # 27/05/08 - Siggi - PATH is set to PALM_BIN everywhere (missing so far) |
---|
[179] | 154 | # 14/07/08 - Siggi - adjustments for lcsgih |
---|
[188] | 155 | # 08/08/08 - Marcus - typo removed in lcxt4 branch |
---|
[204] | 156 | # 17/09/08 - Siggi - restart mechanism adjusted for lcsgi |
---|
[210] | 157 | # 02/10/08 - BjornM - argument "-Y" modified, adjustments for coupled runs |
---|
| 158 | # 21/10/08 - Siggi - bugfix for the case that -K has more than one |
---|
| 159 | # argument |
---|
[211] | 160 | # 08/11/08 - Siggi - bugfix for depository path settings in configuration |
---|
| 161 | # file |
---|
| 162 | # 11/11/08 - Siggi - rules for using user code files changed: user |
---|
| 163 | # code splitted into one file per subroutine, |
---|
| 164 | # user can provide his/her own makefile, only |
---|
| 165 | # default source-code filenames are allowed |
---|
[215] | 166 | # 14/11/08 - Siggi - cond1 and cond2 are part of the depository name |
---|
[221] | 167 | # 08/01/09 - Siggi - mpi module on sgi machines to be used can be set |
---|
| 168 | # with environment variable mpilib |
---|
[223] | 169 | # 13/01/09 - Siggi - totalview on hice/bice can be used in debug mode |
---|
| 170 | # using environment variable totalview |
---|
[246] | 171 | # 25/02/09 - Siggi - cputime-option (-t) is allowed to be omitted for |
---|
| 172 | # interactive runs |
---|
[253] | 173 | # 05/03/09 - Siggi - adjustments for new NEC-SX9 at RIAM (necriam) |
---|
[260] | 174 | # 16/03/09 - Siggi - dvrp_lib, dvrp_inc replaced by dvr_lib, dvr_inc, |
---|
| 175 | # dvr streaming server is automatically started using |
---|
| 176 | # new variable dvr_server and a configuration file |
---|
| 177 | # .dvrserver.config, |
---|
[261] | 178 | # processing of dvr output files using new script |
---|
| 179 | # process_dvr_output implemented, in order to make |
---|
| 180 | # dvr application more user friendly |
---|
[265] | 181 | # 20/03/09 - Marcus - update of n1ge command for lctit |
---|
[291] | 182 | # 16/04/09 - Siggi - new option -y for precursor (uncoupled) ocean runs |
---|
| 183 | # to be followed by a coupled atmosphere-ocean run |
---|
[343] | 184 | # 21/04/09 - Siggi - adjustments for new IBM at DKRZ, which is now ibmh |
---|
| 185 | # 24/06/09 - BjornM - adjustments for coupled/precursor runs on ibmy |
---|
[352] | 186 | # 08/07/09 - Siggi - default value for email_notification is none, |
---|
| 187 | # option -e added to subjob |
---|
[359] | 188 | # 19/08/09 - Marcus - MPI debug option |
---|
[362] | 189 | # 21/08/09 - Marcus - totalview on hice/bice also available for mvapich2 |
---|
[367] | 190 | # 25/08/09 - BjornM - adpated for lck |
---|
[369] | 191 | # 26/08/09 - Siggi - additional environment variables for mpt on ice2 |
---|
[372] | 192 | # 26/08/09 - Marcus - adjustment for ice2 on lcsgib |
---|
[397] | 193 | # 29/09/09 - Siggi - default value for archiving is false, option "-A" |
---|
| 194 | # switches on archiving, archiving on SGI-ICE enabled |
---|
[416] | 195 | # 16/10/09 - Carolin- adjustments for archiving on SGI-ICE of binary files; |
---|
| 196 | # adjustment for special1q |
---|
| 197 | # 18/12/09 - Carolin- modification of archiving (permq) |
---|
[440] | 198 | # 01/02/10 - Siggi - adapted for lcxt5m and lckyoto (Fujitsu HX600) |
---|
[475] | 199 | # 03/02/10 - Siggi - make options (mopts) to be set by configuration file |
---|
| 200 | # implemented |
---|
[493] | 201 | # 08/02/10 - Siggi - loading of modules now controlled via configuration |
---|
| 202 | # file (modules) |
---|
[503] | 203 | # 02/03/10 - Siggi - for each block in the configuration file, separate |
---|
| 204 | # utility programs are used, combine_plot_fields is |
---|
| 205 | # directly called and must not be given by an output |
---|
| 206 | # command in the configuration file any more |
---|
[540] | 207 | # 15/06/10 - Rieke - ssh from compute nodes to login nodes on hosts |
---|
| 208 | # lcsgih/lcsgib is done using the names |
---|
| 209 | # hicegate0/bicegate0 instead of the IP addresses |
---|
[544] | 210 | # 17/08/10 - BjornM - adjustments for interactive runs on lcxt4 |
---|
[555] | 211 | # 07/09/10 - Siggi - bugfix for wrong netcdf/3.6.3 module on lcsgi |
---|
[622] | 212 | # 08/12/10 - Siggi - new handling of openmp/hybrid runs, option -O |
---|
| 213 | # has now argument threads_per_task |
---|
| 214 | # adjustments for Kyushu Univ. (lcrte, ibmku) |
---|
[635] | 215 | # 14/12/10 - Siggi - adjustments for new Tsubame system at Tokyo |
---|
| 216 | # institute of technology (lctit) |
---|
[759] | 217 | # 23/12/10 - Micha - different number of processors in ocean and |
---|
| 218 | # atmosphere is now allowed |
---|
[678] | 219 | # 02/02/10 - Siggi - further adjustments on Tsubame and concerning openMP |
---|
| 220 | # usage |
---|
[696] | 221 | # 09/03/10 - Siggi - adjustments for ibmkisti, mpt bugfix for netCDF4 |
---|
[693] | 222 | # usage, totalview usage extended |
---|
[721] | 223 | # 17/03/11 - Siggi - adjustments for openmp usage on ibmkisti |
---|
| 224 | # 03/04/11 - Micha - added lckordi |
---|
| 225 | # 06/04/11 - BjornM - bugfix for runs with mpt on lcsgi |
---|
[738] | 226 | # 17/08/11 - Siggi - extensions for impi library |
---|
[759] | 227 | # 18/08/11 - Siggi - bugfix for local append of output files with suffix |
---|
| 228 | # (.nc) |
---|
[746] | 229 | # 18/08/11 - Marcus - support for Linux OS with German locale |
---|
[759] | 230 | # - properly report hosts on general Linux clusters |
---|
[755] | 231 | # 29/08/11 - BjornW - adapted for lcflow (ForWind cluster in Oldenburg) |
---|
[759] | 232 | # 29/08/11 - Carolin- initiating restart-run: adjustment of the path at |
---|
| 233 | # IMUK |
---|
| 234 | # 15/09/11 - Siggi - new option -w tp set the maximum number of parallel |
---|
| 235 | # io streams, option -T is obligatory from now on |
---|
[807] | 236 | # 25/01/12 - BjornM - a namelist file check prior to the model run has |
---|
| 237 | # been implemented (check_namelist_files). |
---|
| 238 | # New option -z can be used to skip the check |
---|
[815] | 239 | # 03/02/12 - BjornM - namelist file check temporary disabled |
---|
| 240 | # until severel bugs are fixed |
---|
[818] | 241 | # 08/02/12 - BjornM - bugfixes: skipping namelist file check in case of |
---|
| 242 | # restart runs. check is now possible with topography |
---|
| 243 | # and the -v (silent) option is considered |
---|
[821] | 244 | # 14/02/12 - BjornM/- bugfix: removed slash in \$queue, changed default |
---|
| 245 | # Farah queue for lcsgi to testq, since bigq is not |
---|
| 246 | # available on ice1 |
---|
[823] | 247 | # 16/02/12 - BjornM - bugfix: replaced $localhost by $host in the ENVPAR |
---|
| 248 | # file, which is generated for the namelist file check |
---|
[824] | 249 | # 17/02/12 - Siggi - -z included in description of options (mrun ?) |
---|
[837] | 250 | # 22/02/12 - Siggi - -s info updated |
---|
[838] | 251 | # 22/02/12 - Siggi - case "-s WP" removed |
---|
[841] | 252 | # 28/02/12 - BjornM - further adjustments for namelist file check |
---|
[847] | 253 | # 09/03/12 - Siggi - -T option not obligatory for lcflow |
---|
[848] | 254 | # 12/03/12 - Siggi - tasks_per_node divisor check not for lcflow |
---|
[858] | 255 | # 21/03/12 - Matthias - default compiler on ibmh changed |
---|
[892] | 256 | # 02/05/12 - Bjoern - lcxt4 is now lcxe6, adjustments for lcxe6, |
---|
| 257 | # bugfixes for the parameter file check, initial |
---|
| 258 | # commands on ssh calls sourced out to .mrun.config |
---|
[920] | 259 | # 05/06/12 - Bjoern - bugfixes for the parameter file check on lcxe6. |
---|
| 260 | # combine_plot_fields can be switched off by the |
---|
| 261 | # new mrun option -Z |
---|
[931] | 262 | # 08/06/12 - Bjoern - max_pr_user enabled for the namelist file check, |
---|
| 263 | # sleep commands are now disabled in silent mode (-v) |
---|
[970] | 264 | # 06/08/12 - Bjoern - update: system update at imuk now requires (new) |
---|
| 265 | # initial shell commands on ssh calls (automatic |
---|
| 266 | # restart runs were not possible) |
---|
[1] | 267 | |
---|
| 268 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
| 269 | |
---|
| 270 | set +o allexport # SICHERHEITSHALBER UNTERBINDEN, DA SONST EVTL. STAGEOUT |
---|
| 271 | # NICHT LAUEFT (TOO MANY ARGUMENTS - PROBLEM) |
---|
| 272 | set +o noclobber # EXISTIERENDE DATEIEN DUERFEN UEBERSCHRIEBEN WERDEN |
---|
| 273 | |
---|
| 274 | AddFilenames="" |
---|
| 275 | additional_conditions="" |
---|
| 276 | add_source_path="" |
---|
| 277 | afname="" |
---|
| 278 | archive_save=true |
---|
| 279 | archive_system=none |
---|
[807] | 280 | check_namelist_files=true |
---|
[920] | 281 | combine_plot_fields=true |
---|
[1] | 282 | compiler_name="" |
---|
| 283 | cond1="" |
---|
| 284 | cond2="" |
---|
| 285 | config_file=.mrun.config |
---|
[206] | 286 | coupled_dist="" |
---|
| 287 | coupled_mode="mpi1" |
---|
[1] | 288 | cpp_opts="" |
---|
[82] | 289 | cpp_options="" |
---|
[1] | 290 | cpumax=0 |
---|
| 291 | cpurest=0 |
---|
| 292 | delete_temporary_catalog=true |
---|
| 293 | do_batch=false |
---|
| 294 | do_compile=true |
---|
| 295 | do_remote=false |
---|
| 296 | do_stagein=true |
---|
| 297 | do_stageout=true |
---|
| 298 | do_trace=false |
---|
[352] | 299 | email_notification="none" |
---|
[1] | 300 | exclude="" |
---|
| 301 | executable="" |
---|
| 302 | execution_error=false |
---|
[67] | 303 | fimm=false |
---|
[1] | 304 | fname=test |
---|
| 305 | fromhost="" |
---|
[78] | 306 | global_revision="" |
---|
[122] | 307 | group_number=none |
---|
[1] | 308 | host="" |
---|
| 309 | host_file="" |
---|
| 310 | hp="" |
---|
| 311 | ignore_archive_error=false |
---|
| 312 | input_list="" |
---|
| 313 | interpreted_config_file="" |
---|
[164] | 314 | job_catalog="~/job_queue" |
---|
[1] | 315 | job_on_file="" |
---|
| 316 | keep_data_from_previous_run=false |
---|
[183] | 317 | link_local_input=false |
---|
[149] | 318 | link_local_output=false |
---|
[1] | 319 | localhost_realname=$(hostname) |
---|
| 320 | local_compile=false |
---|
[260] | 321 | local_dvrserver_running=.FALSE. |
---|
[1] | 322 | locat=normal |
---|
| 323 | mainprog="" |
---|
| 324 | makefile="" |
---|
[759] | 325 | max_par_io_str="" |
---|
[1] | 326 | mc=$0 |
---|
| 327 | while [[ $(echo $mc | grep -c "/") != 0 ]] |
---|
| 328 | do |
---|
| 329 | mc=`echo $mc | cut -f2- -d"/"` |
---|
| 330 | done |
---|
[493] | 331 | module_calls="" |
---|
[1] | 332 | mrun_script_name=$mc |
---|
[82] | 333 | netcdf_inc="" |
---|
| 334 | netcdf_lib="" |
---|
[1] | 335 | netcdf_support=false |
---|
| 336 | node_usage=default |
---|
| 337 | numprocs="" |
---|
[206] | 338 | numprocs_atmos=0 |
---|
| 339 | numprocs_ocean=0 |
---|
[1] | 340 | OOPT="" |
---|
| 341 | openmp=false |
---|
| 342 | output_list="" |
---|
| 343 | package_list="" |
---|
| 344 | punkte="..........................................................." |
---|
| 345 | queue=none |
---|
| 346 | read_from_config="" |
---|
[5] | 347 | restart_run=false |
---|
[622] | 348 | if [[ `hostname` = rte10 ]] |
---|
[1] | 349 | then |
---|
[622] | 350 | return_addres=133.5.185.60 |
---|
[693] | 351 | echo "+++ WARNING: fixed return_addres = $return_addres is used !!!!!" |
---|
| 352 | elif [[ `hostname` = climate0 ]] |
---|
| 353 | then |
---|
| 354 | return_addres=165.132.26.68 |
---|
| 355 | echo "+++ WARNING: fixed return_addres = $return_addres is used !!!!!" |
---|
[622] | 356 | else |
---|
| 357 | return_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') |
---|
[1] | 358 | fi |
---|
| 359 | return_password="" |
---|
| 360 | return_username=$LOGNAME |
---|
| 361 | remotecall=false |
---|
| 362 | remote_username="" |
---|
[102] | 363 | run_coupled_model=false |
---|
[1] | 364 | run_mode="" |
---|
| 365 | scirocco=false |
---|
[397] | 366 | store_on_archive_system=false |
---|
[1] | 367 | striche=" ----------------------------------------------------------------------------" |
---|
| 368 | silent=false |
---|
| 369 | source_list="" |
---|
| 370 | source_path=SOURCE |
---|
| 371 | tasks_per_node="" |
---|
| 372 | threads_per_task=1 |
---|
| 373 | tmpcreate=false |
---|
| 374 | tmp_data_catalog="" |
---|
| 375 | transfer_problems=false |
---|
| 376 | usern=$LOGNAME |
---|
[377] | 377 | use_openmp=false |
---|
[1] | 378 | working_directory=`pwd` |
---|
| 379 | TOPT="" |
---|
| 380 | XOPT="" |
---|
| 381 | zeit=$( date | cut -c 12-19 ) |
---|
| 382 | |
---|
| 383 | typeset -i iec=0 iic=0 iin=0 ioc=0 iout=0 memory=0 stagein_anz=0 stageout_anz=0 |
---|
[206] | 384 | typeset -i cputime i ii iia iii iio icycle inode ival jobges jobsek maxcycle minuten nodes pes sekunden tp1 |
---|
[1] | 385 | |
---|
[66] | 386 | typeset -R30 calltime |
---|
[1] | 387 | typeset -L20 spalte1 |
---|
| 388 | typeset -L40 spalte2 |
---|
| 389 | typeset -L60 spalte3 |
---|
| 390 | typeset -L35 string1=`date` |
---|
| 391 | typeset -L12 string2=$usern |
---|
| 392 | typeset -L12 string3=$localhost_realname |
---|
| 393 | typeset -L12 string4 |
---|
| 394 | typeset -L12 string5 |
---|
[201] | 395 | typeset -L30 version="MRUN 2.0 Rev$Rev: 970 $" |
---|
[1] | 396 | |
---|
| 397 | |
---|
| 398 | |
---|
| 399 | # EINZELNE VARIABLE FUER HAUPTPROGRAMM EXPORTIEREN |
---|
| 400 | export cpurest fname host localhost return_addres return_username remotecall tasks_per_node |
---|
| 401 | |
---|
| 402 | # FOLGENDE VARIABLEN MUESSEN FUER DIE INTERPRETATION DER KONFIGURATIONSDATEI |
---|
| 403 | # EXPORTIERT WERDEN |
---|
| 404 | export afname config_file cpp_opts cpumax do_batch do_trace fname fromhost |
---|
[127] | 405 | export group_number input_list memory numprocs output_list queue run_mode |
---|
[1] | 406 | |
---|
| 407 | |
---|
| 408 | |
---|
| 409 | # FEHLERBEHANDLUNG |
---|
| 410 | # BEI EXIT: |
---|
[83] | 411 | trap 'rm -rf $working_directory/tmp_mrun |
---|
[69] | 412 | if [[ $locat != localhost ]] |
---|
[1] | 413 | then |
---|
[22] | 414 | # if [[ ! -f ${mrun_path}/statistik/mrun_statistik ]] |
---|
| 415 | # then |
---|
| 416 | # cat > ${mrun_path}/statistik/mrun_statistik << %STATEND% |
---|
| 417 | #MRUN-calls on $localhost |
---|
| 418 | # |
---|
| 419 | #date and time user localhost remotehost termination mrun-command |
---|
| 420 | #-------------------------------------------------------------------------------------------------------------------- |
---|
| 421 | #%STATEND% |
---|
| 422 | # chmod 666 ${mrun_path}/statistik/mrun_statistik |
---|
| 423 | # fi |
---|
| 424 | # |
---|
| 425 | # # EINTRAG IN DIE STATISTIK-DATEI |
---|
| 426 | # string4=$host |
---|
| 427 | # string5=$locat |
---|
| 428 | # if [[ "$job_on_file" = "" && $locat != control_c && $locat != user_abort ]] |
---|
| 429 | # then |
---|
| 430 | # if [[ $do_batch = true ]] |
---|
| 431 | # then |
---|
| 432 | # printf "$string1$string2$string3$string4$string5$mrun_com \n" >> ${mrun_path}/statistik/mrun_statistik |
---|
| 433 | # else |
---|
| 434 | # printf "$string1$string2$string3$string4$string5$mc \n" >> ${mrun_path}/statistik/mrun_statistik |
---|
| 435 | # fi |
---|
| 436 | # fi |
---|
[69] | 437 | echo " " > /dev/null |
---|
[1] | 438 | fi |
---|
| 439 | |
---|
| 440 | if [[ $locat != normal && $locat != control_c && $locat != local_compile ]] |
---|
| 441 | then |
---|
| 442 | |
---|
| 443 | # EVENTUELLE ERROR-KOMMANDOS ABARBEITEN |
---|
| 444 | (( i = 0 )) |
---|
| 445 | while (( i < iec )) |
---|
| 446 | do |
---|
| 447 | (( i = i + 1 )) |
---|
| 448 | printf "\n *** Execution of ERROR-command:\n" |
---|
| 449 | printf " >>> ${err_command[$i]}\n" |
---|
| 450 | eval ${err_command[$i]} |
---|
| 451 | done |
---|
| 452 | if [[ -n $interpreted_config_file ]] then |
---|
| 453 | rm -rf $interpreted_config_file |
---|
| 454 | fi |
---|
[71] | 455 | if [[ -n .mrun_environment ]] then |
---|
| 456 | rm -rf .mrun_environment |
---|
| 457 | fi |
---|
[1] | 458 | if [[ $tmpcreate = true ]] |
---|
| 459 | then |
---|
| 460 | printf "\n *** Contents of \"$TEMPDIR\":\n" |
---|
| 461 | ls -al; cd |
---|
| 462 | [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR |
---|
| 463 | fi |
---|
[260] | 464 | if [[ "$dvrserver_id" != "" ]] |
---|
| 465 | then |
---|
| 466 | echo "+++ killing dvrserver_id=$dvrserver_id" |
---|
| 467 | kill $dvrserver_id |
---|
| 468 | fi |
---|
[1] | 469 | if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] |
---|
| 470 | then |
---|
| 471 | rm -rf ~/job_queue/JOBINFO.$QSUB_REQID |
---|
| 472 | fi |
---|
| 473 | printf "\n\n+++ MRUN killed \n\n" |
---|
| 474 | elif [[ $locat != control_c ]] |
---|
| 475 | then |
---|
| 476 | printf "\n\n --> all actions finished\n\n" |
---|
| 477 | printf " Bye, bye $usern !!\n\n" |
---|
| 478 | fi' exit |
---|
| 479 | |
---|
| 480 | |
---|
| 481 | # BEI TERMINAL-BREAK: |
---|
[83] | 482 | trap 'rm -rf $working_directory/tmp_mrun |
---|
[807] | 483 | rm -rf $working_directory/tmp_check_namelist_files |
---|
[69] | 484 | [[ $tmpcreate = true ]] && (cd; rm -rf $TEMPDIR) |
---|
[1] | 485 | if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] |
---|
| 486 | then |
---|
| 487 | rm -rf ~/job_queue/JOBINFO.$QSUB_REQID |
---|
| 488 | fi |
---|
[260] | 489 | if [[ "$dvrserver_id" != "" ]] |
---|
| 490 | then |
---|
| 491 | echo "+++ killing dvrserver_id=$dvrserver_id" |
---|
| 492 | kill $dvrserver_id |
---|
| 493 | fi |
---|
[1] | 494 | printf "\n+++ MRUN killed by \"^C\" \n\n" |
---|
| 495 | locat=control_c |
---|
| 496 | exit |
---|
| 497 | ' 2 |
---|
| 498 | |
---|
| 499 | |
---|
[22] | 500 | # CHECK IF THE PATH FOR THE PALM BINARIES (SCRIPTS+UTILITY-PROGRAMS) HAS |
---|
| 501 | # BEEN SET |
---|
| 502 | if [[ "$PALM_BIN" = "" ]] |
---|
| 503 | then |
---|
| 504 | printf "\n +++ environment variable PALM_BIN has not been set" |
---|
| 505 | printf "\n please set it to the directory where the PALM scripts are located" |
---|
| 506 | locat=palm_bin; exit |
---|
| 507 | fi |
---|
[180] | 508 | export PATH=$PALM_BIN:$PATH |
---|
[22] | 509 | |
---|
| 510 | |
---|
[1] | 511 | |
---|
| 512 | # SHELLSCRIPT-OPTIONEN EINLESEN UND KOMMANDO NEU ZUSAMMENSETZEN, FALLS ES |
---|
| 513 | # FUER FOLGEJOBS BENOETIGT WIRD |
---|
[920] | 514 | while getopts :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vw:xX:yY:zZ option |
---|
[1] | 515 | do |
---|
| 516 | case $option in |
---|
| 517 | (a) afname=$OPTARG;; |
---|
[397] | 518 | (A) store_on_archive_system=true; mc="$mc -A";; |
---|
[1] | 519 | (b) do_batch=true; mc="$mc -b";; |
---|
| 520 | (B) delete_temporary_catalog=false; mc="$mc -B";; |
---|
| 521 | (c) config_file=$OPTARG; mc="$mc -c$OPTARG";; |
---|
[5] | 522 | (C) restart_run=true; mc="$mc -C";; |
---|
[1] | 523 | (d) fname=$OPTARG; mc="$mc -d$OPTARG";; |
---|
[210] | 524 | (D) cpp_opts="$cpp_opts $OPTARG"; mc="$mc -D'$OPTARG'";; |
---|
[79] | 525 | (F) job_on_file="-D"; mc="$mc -F";; |
---|
[122] | 526 | (g) group_number=$OPTARG; mc="$mc -g$OPTARG";; |
---|
[78] | 527 | (G) global_revision=$OPTARG; mc="$mc -G'$OPTARG'";; |
---|
[1] | 528 | (h) host=$OPTARG; mc="$mc -h$OPTARG";; |
---|
| 529 | (H) fromhost=$OPTARG; mc="$mc -H$OPTARG";; |
---|
| 530 | (i) input_list=$OPTARG; mc="$mc -i'$OPTARG'";; |
---|
| 531 | (I) ignore_archive_error=true; mc="$mc -I";; |
---|
| 532 | (k) keep_data_from_previous_run=true; mc="$mc -k";; |
---|
[210] | 533 | (K) additional_conditions="$OPTARG"; mc="$mc -K'$OPTARG'";; |
---|
[1] | 534 | (m) memory=$OPTARG; mc="$mc -m$OPTARG";; |
---|
| 535 | (M) makefile=$OPTARG; mc="$mc -M$OPTARG";; |
---|
| 536 | (n) node_usage=$OPTARG; mc="$mc -n$OPTARG";; |
---|
| 537 | (o) output_list=$OPTARG; mc="$mc -o'$OPTARG'";; |
---|
[622] | 538 | (O) use_openmp=true; threads_per_task=$OPTARG; mc="$mc -O$OPTARG";; |
---|
[1] | 539 | (p) package_list=$OPTARG; mc="$mc -p'$OPTARG'";; |
---|
| 540 | (P) return_password=$OPTARG; mc="$mc -P$OPTARG";; |
---|
| 541 | (q) queue=$OPTARG; mc="$mc -q$OPTARG";; |
---|
| 542 | (r) run_mode=$OPTARG; mc="$mc -r'$OPTARG'";; |
---|
| 543 | (R) remotecall=true;return_addres=$OPTARG; mc="$mc -R$OPTARG";; |
---|
| 544 | (s) source_list=$OPTARG; mc="$mc -s'$OPTARG'";; |
---|
| 545 | (S) read_from_config=false; mc="$mc -S";; |
---|
| 546 | (t) cpumax=$OPTARG; mc="$mc -t$OPTARG";; |
---|
[759] | 547 | (T) mrun_tasks_per_node=$OPTARG; mc="$mc -T$OPTARG";; |
---|
[1] | 548 | (u) remote_username=$OPTARG; mc="$mc -u$OPTARG";; |
---|
| 549 | (U) return_username=$OPTARG; mc="$mc -U$OPTARG";; |
---|
| 550 | (v) silent=true; mc="$mc -v";; |
---|
[759] | 551 | (w) max_par_io_str=$OPTARG; mc="$mc -w$OPTARG";; |
---|
[1] | 552 | (x) do_trace=true;set -x; mc="$mc -x";; |
---|
| 553 | (X) numprocs=$OPTARG; mc="$mc -X$OPTARG";; |
---|
[291] | 554 | (y) ocean_file_appendix=true; mc="$mc -y";; |
---|
[206] | 555 | (Y) run_coupled_model=true; coupled_dist=$OPTARG; mc="$mc -Y'$OPTARG'";; |
---|
[807] | 556 | (z) check_namelist_files=false; mc="$mc -z";; |
---|
[920] | 557 | (Z) combine_plot_fields=false; mc="$mc -Z";; |
---|
[1] | 558 | (\?) printf "\n +++ unknown option $OPTARG \n" |
---|
| 559 | printf "\n --> type \"$0 ?\" for available options \n" |
---|
| 560 | locat=parameter;exit;; |
---|
| 561 | esac |
---|
| 562 | done |
---|
| 563 | |
---|
| 564 | |
---|
| 565 | # EVTL. POSITIONSPARAMETER EINLESEN |
---|
| 566 | # ZUR ZEIT GIBT ES NUR DEN PARAMETER ? (=KURZINFO) |
---|
| 567 | shift OPTIND-1 |
---|
| 568 | |
---|
| 569 | |
---|
| 570 | # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN |
---|
| 571 | if [[ "$1" = "?" ]] |
---|
| 572 | then |
---|
| 573 | (printf "\n *** mrun can be called as follows:\n" |
---|
[920] | 574 | printf "\n $mrun_script_name -b -c.. -d.. -D.. -f.. -F -h.. -i.. -I -K.. -m.. -o.. -p.. -r.. -R -s.. -t.. -T.. -v -x -X.. -y -Y.. -z -Z <modus> \n" |
---|
[1] | 575 | printf "\n Description of available options:\n" |
---|
| 576 | printf "\n Option Description Default-Value" |
---|
| 577 | printf "\n -a base name of input files equiv. -d" |
---|
[400] | 578 | printf "\n -A archiving when using file-attribute fl" |
---|
[1] | 579 | printf "\n -b batch-job on local machine ---" |
---|
| 580 | printf "\n -B do not delete temporary directory at end ---" |
---|
| 581 | printf "\n -c configuration file .mrun.config" |
---|
| 582 | printf "\n -d base name of files attached to program test" |
---|
| 583 | printf "\n -D preprocessor(cpp)-directives \"\" " |
---|
| 584 | printf "\n -F create remote job file only ---" |
---|
| 585 | printf "\n -h execution host $localhost_realname" |
---|
| 586 | printf "\n -i INPUT control list \"\" " |
---|
| 587 | printf "\n -I archiving errors of previous batch-jobs" |
---|
| 588 | printf "\n will be ignored" |
---|
| 589 | printf "\n -k keep data from previous run" |
---|
| 590 | printf "\n -K additional conditions for controling" |
---|
| 591 | printf "\n usage of conditional code and" |
---|
| 592 | printf "\n env-variables in configuration file \"\" " |
---|
| 593 | printf "\n -m memory demand in MB (batch-jobs) 0 MB" |
---|
| 594 | printf "\n -M Makefile name Makefile" |
---|
| 595 | printf "\n -n node usage (shared/not_shared) depending on -h" |
---|
| 596 | printf "\n -o OUTPUT control list \"\" " |
---|
| 597 | printf "\n -O use OpenMP ---" |
---|
| 598 | printf "\n -p software package list \"\" " |
---|
| 599 | printf "\n -q queue \"$queue\" " |
---|
| 600 | printf "\n -r run control list (combines -i -o) \"\" " |
---|
| 601 | printf "\n -s filenames of routines to be compiled \"\" " |
---|
| 602 | printf "\n must end with .f, .f90, .F, or .c !" |
---|
| 603 | printf "\n use \"..\" for more than one file and wildcards" |
---|
[837] | 604 | printf "\n -s LM compiles all locally modified files" |
---|
[1] | 605 | printf "\n -S config file interpreted by shellscript ---" |
---|
| 606 | printf "\n -t allowed cpu-time in seconds (batch) 0" |
---|
| 607 | printf "\n -T tasks per node depending on -h" |
---|
| 608 | printf "\n -u username on remote machine \"\" " |
---|
| 609 | printf "\n -v no prompt for confirmation ---" |
---|
[759] | 610 | printf "\n -w maximum parallel io streams as given by -X" |
---|
[1] | 611 | printf "\n -x tracing of mrun for debug purposes ---" |
---|
| 612 | printf "\n -X # of processors (on parallel machines) 1" |
---|
[291] | 613 | printf "\n -y add appendix \"_O\" to all local output" |
---|
| 614 | printf "\n files (ocean precursor runs followed by" |
---|
| 615 | printf "\n coupled atmosphere-ocean runs) ---" |
---|
[206] | 616 | printf "\n -Y run coupled model, \"#1 #2\" with" |
---|
| 617 | printf "\n #1 atmosphere and #2 ocean processors \"#/2 #/2\" depending on -X" |
---|
[920] | 618 | printf "\n -z disable a priori parameter file check ---" |
---|
| 619 | printf "\n -Z skip combine_plot_fields at the end of " |
---|
| 620 | printf "\n the simulation ---" |
---|
[1] | 621 | printf "\n " |
---|
| 622 | printf "\n Possible values of positional parameter <modus>:" |
---|
| 623 | printf "\n \"?\" - this outline \n\n") | more |
---|
| 624 | exit |
---|
| 625 | elif [[ "$1" != "" ]] |
---|
| 626 | then |
---|
| 627 | printf "\n +++ positional parameter $1 unknown \n" |
---|
| 628 | locat=parameter; exit |
---|
| 629 | fi |
---|
| 630 | |
---|
| 631 | |
---|
| 632 | |
---|
| 633 | # KURZE STARTMELDUNG |
---|
| 634 | printf "\n*** $version " |
---|
| 635 | printf "\n will be executed. Please wait ..." |
---|
| 636 | |
---|
| 637 | |
---|
[82] | 638 | |
---|
| 639 | # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN |
---|
| 640 | if [[ ! -f $config_file ]] |
---|
| 641 | then |
---|
| 642 | printf "\n\n +++ configuration file: " |
---|
| 643 | printf "\n $config_file" |
---|
| 644 | printf "\n does not exist" |
---|
| 645 | locat=connect; exit |
---|
| 646 | fi |
---|
| 647 | |
---|
| 648 | |
---|
| 649 | # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN |
---|
| 650 | line="" |
---|
| 651 | grep "%host_identifier" $config_file > tmp_mrun |
---|
| 652 | while read line |
---|
| 653 | do |
---|
[206] | 654 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[82] | 655 | then |
---|
| 656 | HOSTNAME=`echo $line | cut -d" " -s -f2` |
---|
| 657 | host_identifier=`echo $line | cut -d" " -s -f3` |
---|
[83] | 658 | if [[ $localhost_realname = $HOSTNAME ]] |
---|
[82] | 659 | then |
---|
| 660 | localhost=$host_identifier |
---|
| 661 | break |
---|
| 662 | fi |
---|
| 663 | fi |
---|
| 664 | done < tmp_mrun |
---|
| 665 | |
---|
| 666 | if [[ "$localhost" = "" ]] |
---|
| 667 | then |
---|
| 668 | printf "\n\n +++ no host identifier found in configuration file \"$config_file\"" |
---|
| 669 | printf "\n for local host \"$localhost_realname\"." |
---|
| 670 | printf "\n Please add line" |
---|
| 671 | printf "\n \"\%host_identifier $localhost_realname <identifier>\"" |
---|
| 672 | printf "\n to the configuration file." |
---|
| 673 | locat=localhost; exit |
---|
| 674 | fi |
---|
| 675 | |
---|
| 676 | |
---|
| 677 | # HOSTSPEZIFISCHE VARIABLEN SETZEN |
---|
| 678 | case $localhost_realname in |
---|
[397] | 679 | (r1*|r2*|h01*|b01*) archive_system=tivoli;; |
---|
[82] | 680 | (cs*) archive_system=ut;; |
---|
| 681 | (fimm.bccs.uib.no) fimm=true;; |
---|
| 682 | (gate|n-sx) PATH=$PALM_BIN:$PATH:/usr/bin/nqsII;; |
---|
| 683 | (scirocco) scirocco=true;; |
---|
| 684 | esac |
---|
| 685 | |
---|
| 686 | |
---|
| 687 | |
---|
[1] | 688 | # BASISNAME DER INPUT-DATEIEN GLEICH ALLGEMEINEM BASISNAMEN SETZEN, |
---|
| 689 | # WENN NICHT VOM BENUTZER ANDERS BESTIMMT |
---|
| 690 | [[ "$afname" = "" ]] && afname=$fname |
---|
| 691 | |
---|
| 692 | |
---|
| 693 | # EVTL. RUN-MODUS DEN I/O-LISTEN HINZUFUEGEN |
---|
| 694 | if [[ "$run_mode" != "" ]] |
---|
| 695 | then |
---|
| 696 | input_list="$input_list $run_mode" |
---|
| 697 | output_list="$output_list $run_mode" |
---|
| 698 | fi |
---|
| 699 | |
---|
| 700 | |
---|
| 701 | # RECHNERNAMEN ABSPEICHERN, VON DEM AUS JOB GESTARTET WIRD, |
---|
| 702 | # ALLERDINGS NUR DANN, WENN NICHT PER OPTION -H BEREITS EIN WERT |
---|
| 703 | # ZUGEWIESEN WURDE (MRUN MACHT DIES IMMER, WENN ES SELBST BATCH-JOBS |
---|
| 704 | # STARTET) |
---|
| 705 | if [[ "$fromhost" = "" ]] |
---|
| 706 | then |
---|
| 707 | fromhost=$localhost |
---|
| 708 | fi |
---|
| 709 | |
---|
| 710 | |
---|
| 711 | # PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL |
---|
| 712 | # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. |
---|
| 713 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
| 714 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
| 715 | if [[ -n $host && "$host" != $localhost ]] |
---|
| 716 | then |
---|
| 717 | do_batch=true |
---|
| 718 | do_remote=true |
---|
| 719 | case $host in |
---|
[892] | 720 | (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|nech|necriam|lckyoto|lcsgib|lcsgih|unics|lcxe6|lcxt5m|lck|lckordi) true;; |
---|
[1] | 721 | (*) printf "\n" |
---|
[83] | 722 | printf "\n +++ sorry: execution of batch jobs on remote host \"$host\"" |
---|
| 723 | printf "\n is not available" |
---|
[1] | 724 | locat=nqs; (( iec = 0 )); exit;; |
---|
| 725 | esac |
---|
| 726 | else |
---|
| 727 | host=$localhost |
---|
| 728 | fi |
---|
| 729 | |
---|
| 730 | |
---|
| 731 | # ZUSATZBEDINGUNGEN (OPTION -K) AUSWERTEN |
---|
| 732 | if [[ -n $additional_conditions ]] |
---|
| 733 | then |
---|
[69] | 734 | # echo $additional_conditions | cut -d" " -f1-3 | read cond1 cond2 dummy |
---|
| 735 | cond1=`echo $additional_conditions | cut -d" " -f1` |
---|
| 736 | cond2=`echo $additional_conditions | cut -d" " -s -f2` |
---|
| 737 | dummy=`echo $additional_conditions | cut -d" " -s -f3` |
---|
[1] | 738 | if [[ -n $dummy ]] |
---|
| 739 | then |
---|
| 740 | printf "\n +++ more than 2 additional conditions given for Option \"-K\"" |
---|
| 741 | locat=options; exit |
---|
| 742 | fi |
---|
[503] | 743 | block=_$cond1 |
---|
| 744 | [[ -n $cond2 ]] && block=${block}_$cond2 |
---|
[1] | 745 | fi |
---|
| 746 | |
---|
| 747 | |
---|
[206] | 748 | # KOPPLUNGSEIGENSCHAFTEN (-Y) AUSWERTEN UND coupled_mode BESTIMMEN |
---|
| 749 | if [[ $run_coupled_model = true ]] |
---|
| 750 | then |
---|
| 751 | |
---|
| 752 | if [[ -n $coupled_dist ]] |
---|
| 753 | then |
---|
| 754 | |
---|
| 755 | numprocs_atmos=`echo $coupled_dist | cut -d" " -s -f1` |
---|
| 756 | numprocs_ocean=`echo $coupled_dist | cut -d" " -s -f2` |
---|
| 757 | |
---|
| 758 | if (( $numprocs_ocean + $numprocs_atmos != $numprocs )) |
---|
| 759 | then |
---|
| 760 | |
---|
| 761 | printf "\n +++ number of processors does not fit to specification by \"-Y\"." |
---|
| 762 | printf "\n PEs (total) : $numprocs" |
---|
| 763 | printf "\n PEs (atmosphere): $numprocs_atmos" |
---|
| 764 | printf "\n PEs (ocean) : $numprocs_ocean" |
---|
| 765 | locat=coupling; exit |
---|
| 766 | |
---|
| 767 | fi |
---|
| 768 | |
---|
| 769 | else |
---|
| 770 | |
---|
| 771 | (( numprocs_ocean = $numprocs / 2 )) |
---|
| 772 | (( numprocs_atmos = $numprocs / 2 )) |
---|
| 773 | |
---|
| 774 | fi |
---|
| 775 | coupled_dist=`echo "$numprocs_atmos $numprocs_ocean"` |
---|
| 776 | |
---|
| 777 | # GET coupled_mode FROM THE CONFIG FILE |
---|
| 778 | line="" |
---|
| 779 | grep "%cpp_options.*-D__mpi2.*$host" $config_file > tmp_mrun |
---|
| 780 | while read line |
---|
| 781 | do |
---|
| 782 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" && ( $(echo $line | cut -d" " -s -f4) = $cond1 || $(echo $line | cut -d" " -s -f4) = $cond2 ) ]] |
---|
| 783 | then |
---|
| 784 | coupled_mode="mpi2" |
---|
| 785 | fi |
---|
| 786 | done < tmp_mrun |
---|
| 787 | |
---|
| 788 | fi |
---|
| 789 | |
---|
| 790 | |
---|
[1] | 791 | # PRUEFEN, OB EVTL. BEI VORHERGEHENDEM LAUF (KETTENJOB) EINE |
---|
| 792 | # ARCHIVIERUNG FEHLGESCHLAGEN IST |
---|
| 793 | if [[ -f ~/job_queue/ARCHIVE_ERROR_$fname ]] |
---|
| 794 | then |
---|
| 795 | if [[ $ignore_archive_error = false ]] |
---|
| 796 | then |
---|
| 797 | printf "\n +++ data archiving of previous run failed" |
---|
| 798 | printf "\n see directory \~/job_queue on remote machine" |
---|
| 799 | locat=archive; exit |
---|
| 800 | else |
---|
| 801 | printf "\n +++ warning: data archiving in a previous run failed" |
---|
| 802 | printf "\n MRUN continues, trying to get backup copy" |
---|
| 803 | fi |
---|
| 804 | fi |
---|
| 805 | |
---|
| 806 | |
---|
| 807 | |
---|
| 808 | # LESEN UND INTERPRETIEREN DER KONFIGURATIONS-DATEI VOM SHELLSCRIPT AUS |
---|
| 809 | # VORUEBERGEHEND ZWINGEND AUF LINUX-RECHNERN |
---|
| 810 | if [[ "$read_from_config" = false ]] |
---|
| 811 | then |
---|
| 812 | |
---|
| 813 | [[ $silent = false ]] && printf "\n Reading the configuration file... " |
---|
| 814 | while read zeile |
---|
| 815 | do |
---|
| 816 | [[ $silent = false ]] && printf "." |
---|
| 817 | |
---|
| 818 | |
---|
| 819 | # ZUERST EVENTUELL VORKOMMENDE ENVIRONMENT-VARIABLEN DURCH IHRE WERTE |
---|
| 820 | # ERSETZEN |
---|
| 821 | eval zeile=\"$zeile\" |
---|
| 822 | |
---|
| 823 | |
---|
| 824 | # INTERPRETATION DER ZEILE |
---|
[21] | 825 | if [[ "$(echo $zeile)" = "" ]] |
---|
[1] | 826 | then |
---|
[21] | 827 | # LEERZEILE, KEINE AKTION |
---|
| 828 | continue |
---|
[1] | 829 | |
---|
[21] | 830 | elif [[ "$(echo $zeile | cut -c1)" = "#" ]] |
---|
| 831 | then |
---|
| 832 | |
---|
[1] | 833 | # ZEILE IST KOMMENTARZEILE |
---|
| 834 | true |
---|
| 835 | |
---|
| 836 | elif [[ "$(echo $zeile | cut -c1)" = "%" ]] |
---|
| 837 | then |
---|
| 838 | |
---|
| 839 | # ZEILE DEFINIERT ENVIRONMENT-VARIABLE |
---|
| 840 | zeile=$(echo $zeile | cut -c2-) |
---|
[69] | 841 | # echo $zeile | cut -d" " -f1-5 | read var value for_host for_cond1 for_cond2 |
---|
| 842 | var=`echo $zeile | cut -d" " -f1` |
---|
| 843 | value=`echo $zeile | cut -d" " -s -f2` |
---|
| 844 | for_host=`echo $zeile | cut -d" " -s -f3` |
---|
| 845 | for_cond1=`echo $zeile | cut -d" " -s -f4` |
---|
| 846 | for_cond2=`echo $zeile | cut -d" " -s -f5` |
---|
[1] | 847 | |
---|
| 848 | if [[ "$for_host" = "" || ( "$for_host" = $host && "$for_cond1" = "$cond1" && "$for_cond2" = "$cond2" ) || $(echo "$input_list$output_list"|grep -c "$for_host") != 0 ]] |
---|
| 849 | then |
---|
| 850 | |
---|
| 851 | # BEI COMPILER- CPP- ODER LINKEROPTIONEN EVTL ":" DURCH " " |
---|
| 852 | # ERSETZEN. "::" WIRD DURCH ":" ERSETZT. |
---|
| 853 | value=`echo $value | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 854 | |
---|
| 855 | |
---|
| 856 | # ENVIRONMENT-VARIABLE WIRD WERT AUS KONFIGURATIONSDATEI |
---|
| 857 | # ZUGEWIESEN, WENN SIE SELBST NOCH KEINEN WERT UEBER DIE |
---|
| 858 | # ENTSPRECHENDE SCRIPT-OPTION ERHALTEN HAT. SOLCHE |
---|
| 859 | # VARIABLEN HAETTEN DANN DEN WERT "" ODER IM INTEGER-FALL DEN |
---|
| 860 | # WERT 0. ALLGEMEINE REGEL ALSO: SCRIPT-OPTION GEHT UEBER |
---|
| 861 | # KONFIGURATIONSDATEI |
---|
| 862 | if [[ "$(eval echo \$$var)" = "" || "$(eval echo \$$var)" = "0" ]] |
---|
| 863 | then |
---|
| 864 | eval $var=\$value |
---|
| 865 | |
---|
| 866 | # EVTL. BILDSCHIRMAUSGABEN DER ENVIRONMENT-VARIABLEN |
---|
| 867 | if [[ $do_trace = true ]] |
---|
| 868 | then |
---|
| 869 | printf "\n*** ENVIRONMENT-VARIABLE $var = $value" |
---|
| 870 | fi |
---|
| 871 | fi |
---|
| 872 | |
---|
| 873 | # WENN ENVIRONMENT-VARIABLE HOST VEREINBART, DANN SOFORT AUSWERTEN |
---|
| 874 | # WERT VON do-remote WIRD BEI DATEIVERBINDUNGEN BENOETIGT |
---|
| 875 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
| 876 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
| 877 | if [[ $var = host ]] |
---|
| 878 | then |
---|
| 879 | if [[ -n $host && "$host" != $localhost ]] |
---|
| 880 | then |
---|
| 881 | do_batch=true |
---|
| 882 | do_remote=true |
---|
| 883 | case $host in |
---|
[892] | 884 | (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxe6|lcxt5m|lck|lckordi) true;; |
---|
[83] | 885 | (*) printf "\n +++ sorry: execution of batch jobs on remote host \"$host\"" |
---|
| 886 | printf "\n is not available" |
---|
[1] | 887 | locat=nqs; exit;; |
---|
| 888 | esac |
---|
| 889 | else |
---|
| 890 | host=$localhost |
---|
| 891 | fi |
---|
| 892 | fi |
---|
| 893 | |
---|
| 894 | # VOM BENUTZER DEFINIERTE ENVIRONMENT VARIABLEN MUESSEN PRINZIPIELL |
---|
| 895 | # EXPORTIERT WERDEN, DA SIE VIELLEICHT IN WEITER UNTEN AUFZURUFEN- |
---|
| 896 | # DEN PROGRAMMEN BENOETIGT WERDEN |
---|
| 897 | export $var |
---|
| 898 | fi |
---|
| 899 | |
---|
| 900 | |
---|
| 901 | |
---|
| 902 | |
---|
| 903 | elif [[ "$(echo $zeile | cut -c1-3)" = "EC:" ]] |
---|
| 904 | then |
---|
| 905 | |
---|
| 906 | # ZEILE DEFINIERT ERROR-KOMMANDO |
---|
| 907 | (( iec = iec + 1 )) |
---|
| 908 | zeile=$(echo $zeile | cut -c4-) |
---|
| 909 | err_command[$iec]="$zeile" |
---|
| 910 | |
---|
| 911 | elif [[ "$(echo $zeile | cut -c1-3)" = "IC:" ]] |
---|
| 912 | then |
---|
| 913 | |
---|
| 914 | # ZEILE DEFINIERT INPUT-KOMMANDO |
---|
| 915 | (( iic = iic + 1 )) |
---|
| 916 | zeile=$(echo $zeile | cut -c4-) |
---|
| 917 | in_command[$iic]="$zeile" |
---|
| 918 | |
---|
| 919 | elif [[ "$(echo $zeile | cut -c1-3)" = "OC:" ]] |
---|
| 920 | then |
---|
| 921 | |
---|
| 922 | # ZEILE DEFINIERT OUTPUT-KOMMANDO |
---|
| 923 | (( ioc = ioc + 1 )) |
---|
| 924 | zeile=$(echo $zeile | cut -c4-) |
---|
| 925 | out_command[$ioc]="$zeile" |
---|
| 926 | |
---|
| 927 | else |
---|
| 928 | |
---|
| 929 | # ZEILE DEFINIERT DATEIVERBINDUNG. EINLESEN DER DATEIEIGENSCHAFTEN |
---|
| 930 | # s2a: in/out - Feld |
---|
| 931 | # s2b: loc - Feld (optional) |
---|
| 932 | # s2c: tr/ar - Feld (optional) |
---|
[69] | 933 | # echo $zeile | cut -d" " -f1-2 | read s1 s2 |
---|
| 934 | s1=`echo $zeile | cut -d" " -f1` |
---|
| 935 | s2=`echo $zeile | cut -d" " -s -f2` |
---|
[1] | 936 | s2a=$(echo $s2 | cut -d":" -f1) |
---|
| 937 | if [[ $(echo $s2 | grep -c ":") = 0 ]] |
---|
| 938 | then |
---|
| 939 | s2b="" |
---|
| 940 | s2c="" |
---|
| 941 | else |
---|
[69] | 942 | # echo $s2 | cut -d":" -f2-3 | sed 's/:/ /g' | read s2b s2c |
---|
| 943 | s2b=`echo $s2 | cut -d":" -f2 | sed 's/:/ /g'` |
---|
| 944 | s2c=`echo $s2 | cut -d":" -s -f3 | sed 's/:/ /g'` |
---|
[1] | 945 | fi |
---|
[69] | 946 | # echo $zeile | cut -d" " -f3-6 | read s3 s4 s5 s6 |
---|
| 947 | s3=`echo $zeile | cut -d" " -f3` |
---|
| 948 | s4=`echo $zeile | cut -d" " -s -f4` |
---|
| 949 | s5=`echo $zeile | cut -d" " -s -f5` |
---|
| 950 | s6=`echo $zeile | cut -d" " -s -f6` |
---|
[1] | 951 | |
---|
| 952 | |
---|
| 953 | # ABSPEICHERN DER DATEIVERBINDUNG, FALLS IN INPUT- ODER OUTPUT-LIST |
---|
| 954 | # VERMERKT. VARIABLE S3 KANN AUCH LISTE ENTHALTEN (FELDTRENNER ":") |
---|
| 955 | # DATEIVERBINDUNG WIRD DANN NICHT ABGESPEICHERT UND GEPRUEFT, WENN |
---|
| 956 | # PROGRAMMLAUF AUF REMOTE-MASCHINE ERFOLGT UND DATEI NUR LOKAL VOR- |
---|
| 957 | # HANDEN SEIN MUSS (D.H. s2b = loc) |
---|
| 958 | IFSALT="$IFS"; IFS="$IFS:" |
---|
| 959 | if [[ "$s2a" = in && ! ( $do_remote = true && ( "$s2b" = loc || "$s2b" = locopt ) ) ]] |
---|
| 960 | then |
---|
| 961 | found=false |
---|
| 962 | for actual in $input_list |
---|
| 963 | do |
---|
| 964 | for formal in $s3 |
---|
| 965 | do |
---|
| 966 | [[ $actual = $formal || "$formal" = "-" ]] && found=true |
---|
| 967 | done |
---|
| 968 | done |
---|
| 969 | if [[ $found = true ]] |
---|
| 970 | then |
---|
| 971 | (( iin = iin + 1 )) |
---|
| 972 | localin[$iin]=$s1; transin[$iin]=$s2b; actionin[$iin]=$s2c; |
---|
| 973 | typein[$iin]=$s3; pathin[$iin]=$s4; endin[$iin]=$s5; |
---|
| 974 | extin[$iin]=$s6 |
---|
| 975 | fi |
---|
| 976 | elif [[ "$s2a" = out && ! ( $do_remote = true && "$s2b" = loc ) ]] |
---|
| 977 | then |
---|
| 978 | found=false |
---|
| 979 | for actual in $output_list |
---|
| 980 | do |
---|
| 981 | for formal in $s3 |
---|
| 982 | do |
---|
| 983 | [[ $actual = $formal || "$formal" = "-" ]] && found=true |
---|
| 984 | done |
---|
| 985 | done |
---|
| 986 | if [[ $found = true ]] |
---|
| 987 | then |
---|
| 988 | (( iout = iout + 1 )) |
---|
| 989 | localout[$iout]=$s1; actionout[$iout]=$s2c; typeout[$iout]=$s3; |
---|
| 990 | pathout[$iout]=$s4; endout[$iout]=$s5; extout[$iout]=$s6 |
---|
| 991 | fi |
---|
| 992 | elif [[ "$s2a" != in && "$s2a" != out ]] |
---|
| 993 | then |
---|
| 994 | printf "\n +++ I/O-attribute in configuration file $config_file has the invalid" |
---|
| 995 | printf "\n value \"$s2\". Only \"in\" and \"out\" are allowed!" |
---|
| 996 | locat=connect; exit |
---|
| 997 | fi |
---|
| 998 | IFS="$IFSALT" |
---|
| 999 | fi |
---|
| 1000 | done < $config_file |
---|
| 1001 | |
---|
| 1002 | else |
---|
| 1003 | |
---|
| 1004 | |
---|
| 1005 | # INTERPRETATION DER KONFIGURATIONSDATEI MITTELS FORTRAN 90 - PROGRAMM |
---|
| 1006 | [[ $silent = false ]] && printf "..." |
---|
| 1007 | export cond1 cond2 config_file do_remote do_trace input_list localhost output_list |
---|
| 1008 | export interpreted_config_file=.icf.$RANDOM |
---|
| 1009 | |
---|
| 1010 | |
---|
[69] | 1011 | |
---|
| 1012 | # ENVIRONMENT-VARIABLEN FUER INTERPRET_CONFIG UEBER NAMELIST_DATEI ZUR |
---|
| 1013 | # VERFUEGUNG STELLEN |
---|
| 1014 | cat > .mrun_environment << %%END%% |
---|
| 1015 | &mrun_environment cond1 = '$cond1', cond2 = '$cond2', |
---|
| 1016 | config_file = '$config_file', do_remote = '$do_remote', |
---|
| 1017 | do_trace = '$do_trace', host = '$host', |
---|
| 1018 | input_list = '$input_list', icf = '$interpreted_config_file', |
---|
| 1019 | localhost = '$localhost', output_list = '$output_list' / |
---|
| 1020 | |
---|
| 1021 | %%END%% |
---|
| 1022 | |
---|
| 1023 | # WERTE VON MRUN-OPTIONEN SICHERN UND DAMIT GEGEBENENFALLS SPAETER DIE |
---|
| 1024 | # IN DER KONFIGURAIONSDATEI ANGEGEBENEN WERTE UEBERSTEUERN |
---|
| 1025 | mrun_memory=$memory |
---|
[127] | 1026 | mrun_group_number=$group_number |
---|
[69] | 1027 | mrun_cpumax=$cpumax |
---|
| 1028 | mrun_numprocs=$numprocs |
---|
| 1029 | |
---|
[251] | 1030 | if [[ $localhost_realname = "sx-fep" ]] |
---|
[66] | 1031 | then |
---|
[251] | 1032 | /home/COAR/NC/raasch/pub/interpret_config_necriam.x |
---|
[66] | 1033 | else |
---|
[503] | 1034 | |
---|
| 1035 | if [[ "$host" != $localhost ]] |
---|
| 1036 | then |
---|
| 1037 | |
---|
| 1038 | # REMOTE JOB FROM LOCAL HOST: JUST TAKE THE FIRST EXECUTABLE FOUND |
---|
| 1039 | interpret_config_executable=`ls -1 ${PALM_BIN}/interpret_config*.x 2>/dev/null` |
---|
| 1040 | if [[ $? != 0 ]] |
---|
| 1041 | then |
---|
| 1042 | printf "\n\n +++ no interpret_config found" |
---|
| 1043 | printf "\n run \"mbuild -u -h ...\" to generate utilities for this host" |
---|
| 1044 | locat=interpret_config; exit |
---|
| 1045 | fi |
---|
| 1046 | interpret_config_executable=`echo $interpret_config_executable | cut -d" " -f1` |
---|
| 1047 | $interpret_config_executable |
---|
| 1048 | |
---|
| 1049 | else |
---|
| 1050 | |
---|
| 1051 | # CHECK, IF THERE IS AN EXECUTABLE FOR THE BLOCK |
---|
| 1052 | if [[ ! -f ${PALM_BIN}/interpret_config${block}.x ]] |
---|
| 1053 | then |
---|
| 1054 | printf "\n\n +++ no interpret_config found for given block \"$cond1 $cond2\"" |
---|
| 1055 | printf "\n run \"mbuild -u -h ...\" to generate utilities for this block" |
---|
| 1056 | locat=interpret_config; exit |
---|
| 1057 | else |
---|
| 1058 | interpret_config${block}.x |
---|
| 1059 | fi |
---|
| 1060 | |
---|
| 1061 | fi |
---|
[66] | 1062 | fi |
---|
[71] | 1063 | rm .mrun_environment |
---|
[1] | 1064 | |
---|
[71] | 1065 | |
---|
[1] | 1066 | # AUSFUEHRUNG DER GENERIERTEN SHELL-KOMMANDOS IN DIESER SHELL |
---|
| 1067 | chmod u+x $interpreted_config_file |
---|
| 1068 | export PATH=$PATH:. |
---|
| 1069 | . $interpreted_config_file |
---|
[71] | 1070 | rm $interpreted_config_file |
---|
[1] | 1071 | |
---|
[71] | 1072 | |
---|
[69] | 1073 | # OPTIONSWERTE UEBERSTEUERN KONFIGURATIONSDATEI |
---|
[759] | 1074 | [[ $mrun_memory != 0 ]] && memory=$mrun_memory |
---|
[127] | 1075 | [[ "$mrun_group_number" != "none" ]] && group_number=$mrun_group_number |
---|
[759] | 1076 | [[ $mrun_cpumax != 0 ]] && cpumax=$mrun_cpumax |
---|
| 1077 | [[ "$mrun_numprocs" != "" ]] && numprocs=$mrun_numprocs |
---|
| 1078 | [[ "$max_par_io_str" != "" ]] && maximum_parallel_io_streams=$max_par_io_str |
---|
| 1079 | [[ "$mrun_tasks_per_node" != "" ]] && tasks_per_node=$mrun_tasks_per_node |
---|
[69] | 1080 | |
---|
[1] | 1081 | fi |
---|
| 1082 | |
---|
| 1083 | |
---|
| 1084 | # QUELLTEXTVERZEICHNIS AUF LOKALER MASCHINE AUS KONFIGURATIONSDATEI |
---|
| 1085 | # BESTIMMEN (WUERDE SONST EVTL. DAS VERZEICHNIS DES JEWEILS UNTER -h |
---|
| 1086 | # ANGEGEBENEN REMOTE-RECHNERS SEIN) |
---|
| 1087 | # BEI BATCH-JOBS SIND DIE ZU UEBERSETZENDEN PROGRAMMTEILE SCHON KOMPLETT |
---|
| 1088 | if [[ "$SOURCES_COMPLETE" = "" ]] |
---|
| 1089 | then |
---|
| 1090 | |
---|
| 1091 | # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER |
---|
| 1092 | # VEREINBART WURDE |
---|
| 1093 | source_path="" |
---|
| 1094 | line="" |
---|
| 1095 | grep "%source_path" $config_file > tmp_mrun |
---|
| 1096 | while read line |
---|
| 1097 | do |
---|
| 1098 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 1099 | then |
---|
| 1100 | if [[ "$(echo $line | cut -d" " -f3)" = "" ]] |
---|
| 1101 | then |
---|
| 1102 | global_source_path=`echo $line | cut -d" " -f2` |
---|
| 1103 | fi |
---|
| 1104 | fi |
---|
| 1105 | done < tmp_mrun |
---|
| 1106 | |
---|
| 1107 | line="" |
---|
| 1108 | found=false |
---|
| 1109 | grep " $localhost" $config_file | grep "%source_path" > tmp_mrun |
---|
| 1110 | while read line |
---|
| 1111 | do |
---|
| 1112 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 1113 | then |
---|
| 1114 | if [[ $found = true ]] |
---|
| 1115 | then |
---|
| 1116 | printf "\n\n +++ more than one source path found in configuration file" |
---|
| 1117 | printf "\n for local host \"$localhost\" " |
---|
| 1118 | locat=source_path; exit |
---|
| 1119 | fi |
---|
| 1120 | source_path=`echo $line | cut -d" " -f2` |
---|
| 1121 | found=true |
---|
| 1122 | fi |
---|
| 1123 | done < tmp_mrun |
---|
| 1124 | rm tmp_mrun |
---|
| 1125 | |
---|
| 1126 | if [[ "$source_path" = "" ]] |
---|
| 1127 | then |
---|
| 1128 | if [[ "$global_source_path" != "" ]] |
---|
| 1129 | then |
---|
| 1130 | source_path=$global_source_path |
---|
| 1131 | else |
---|
| 1132 | printf "\n\n +++ no source path found in configuration file" |
---|
| 1133 | printf "\n for local host \"$localhost\" " |
---|
| 1134 | locat=source_path; exit |
---|
| 1135 | fi |
---|
| 1136 | fi |
---|
| 1137 | eval source_path=$source_path |
---|
| 1138 | |
---|
| 1139 | if [[ ! -d $source_path ]] |
---|
| 1140 | then |
---|
| 1141 | printf "\n\n +++ source path \"$source_path\" on local host" |
---|
| 1142 | printf "\n \"$localhost\" does not exist" |
---|
| 1143 | locat=source_path; exit |
---|
| 1144 | fi |
---|
| 1145 | |
---|
| 1146 | fi |
---|
| 1147 | |
---|
| 1148 | |
---|
[78] | 1149 | # GLOBALE REVISIONSNUMMER ERMITTELN (FORTSETZUNGSLAEUFEN WIRD DIESE |
---|
| 1150 | # DURCH OPTION -G MITGETEILT) |
---|
[693] | 1151 | if [[ "$global_revision" = "" && $host != "ibmkisti" ]] |
---|
[78] | 1152 | then |
---|
| 1153 | global_revision=`svnversion $source_path 2>/dev/null` |
---|
| 1154 | global_revision="Rev: $global_revision" |
---|
| 1155 | fi |
---|
[1] | 1156 | |
---|
[78] | 1157 | |
---|
[1] | 1158 | # NOCHMAL PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL |
---|
| 1159 | # (HOST KANN IN KONFIGURATIONSDATEI ANDERS FESTGELEGT WORDEN SEIN) |
---|
| 1160 | # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. |
---|
| 1161 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
| 1162 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
| 1163 | if [[ -n $host && "$host" != $localhost ]] |
---|
| 1164 | then |
---|
| 1165 | do_batch=true |
---|
| 1166 | do_remote=true |
---|
| 1167 | case $host in |
---|
[892] | 1168 | (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxe6|lcxt5m|lck|lckordi) true;; |
---|
[1] | 1169 | (*) printf "\n" |
---|
[83] | 1170 | printf "\n +++ sorry: execution of batch jobs on remote host \"$host\"" |
---|
| 1171 | printf "\n is not available" |
---|
[1] | 1172 | locat=nqs; (( iec = 0 )); exit;; |
---|
| 1173 | esac |
---|
| 1174 | else |
---|
| 1175 | host=$localhost |
---|
| 1176 | fi |
---|
| 1177 | |
---|
| 1178 | |
---|
| 1179 | # PRUEFUNG EINIGER PROZESSORZAHLANGABEN BEI RECHNUNGEN AUF PARALLELRECHNERN |
---|
| 1180 | if [[ "$cond1" = parallel || "$cond2" = parallel ]] |
---|
| 1181 | then |
---|
| 1182 | |
---|
| 1183 | # PRUEFEN, OB DIE ANZAHL DER ZU VERWENDENDEN PES ANGEGEBEN WURDE |
---|
| 1184 | if [[ ! -n $numprocs ]] |
---|
| 1185 | then |
---|
| 1186 | printf "\n" |
---|
| 1187 | printf "\n +++ option \"-K parallel\" requires additional specification" |
---|
| 1188 | printf "\n of the number of processors to be used by" |
---|
| 1189 | printf "\n mrun-option \"-X\" or by environment-variable" |
---|
| 1190 | printf "\n \"numprocs\" in the configuration file" |
---|
| 1191 | locat=numprocs; (( iec = 0 )); exit |
---|
| 1192 | fi |
---|
| 1193 | |
---|
| 1194 | # PRUEFEN, OB DIE PROZESSORANZAHL PRO KNOTEN ANGEGEBEN WURDE (GGF. |
---|
| 1195 | # DEFAULT-WERT SETZEN) UND OB SIE EIN GANZZAHLIGER TEILER DER |
---|
| 1196 | # GESAMTPROZESSORANZAHL IST |
---|
[847] | 1197 | if [[ "$tasks_per_node" = "" && $host != lcflow ]] |
---|
[1] | 1198 | then |
---|
[759] | 1199 | printf "\n" |
---|
| 1200 | printf "\n +++ option \"-T\" (tasks per node) is missing" |
---|
| 1201 | printf "\n set -T option or define tasks_per_node in the config file" |
---|
| 1202 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
| 1203 | fi |
---|
[848] | 1204 | if [[ $host != lcflow ]] |
---|
[759] | 1205 | then |
---|
[848] | 1206 | (( ival = $tasks_per_node )) |
---|
| 1207 | (( pes = numprocs )) |
---|
| 1208 | # if [[ $(echo $package_list | grep -c dvrp_graphics+1PE) = 1 ]] |
---|
| 1209 | # then |
---|
| 1210 | # (( pes = pes - 1 )) |
---|
| 1211 | # fi |
---|
| 1212 | (( ii = pes / ival )) |
---|
| 1213 | if (( pes - ii * ival > 0 )) |
---|
| 1214 | then |
---|
| 1215 | printf "\n" |
---|
| 1216 | printf "\n +++ tasks per node (option \"-T\") must be an integral" |
---|
| 1217 | printf "\n divisor of the total number of processors (option \"-X\")" |
---|
| 1218 | printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" |
---|
| 1219 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
| 1220 | fi |
---|
[1] | 1221 | fi |
---|
| 1222 | |
---|
[759] | 1223 | |
---|
[1] | 1224 | # IBMY HAT NUR EINEN KNOTEN |
---|
| 1225 | if [[ $host = ibmy ]] |
---|
| 1226 | then |
---|
| 1227 | if [[ "$tasks_per_node" != "" && "$tasks_per_node" != "$numprocs" ]] |
---|
| 1228 | then |
---|
| 1229 | printf "\n" |
---|
| 1230 | printf "\n +++ on ibmy, tasks per node (option \"-T\") must be equal to the" |
---|
| 1231 | printf "\n total number of processors (option \"-X\")" |
---|
| 1232 | printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" |
---|
| 1233 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
| 1234 | fi |
---|
| 1235 | fi |
---|
| 1236 | |
---|
[377] | 1237 | |
---|
| 1238 | # SETTINGS FOR SUBJOB-COMMAND |
---|
[622] | 1239 | TOPT="-T $tasks_per_node" |
---|
[1] | 1240 | OOPT="-O $threads_per_task" |
---|
| 1241 | |
---|
| 1242 | # GESAMTZAHL DER KNOTEN BESTIMMEN |
---|
| 1243 | if [[ "$tasks_per_node" != "" ]] |
---|
| 1244 | then |
---|
| 1245 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
| 1246 | fi |
---|
| 1247 | |
---|
| 1248 | # PRUEFEN, OB NODE USAGE EINEN ERLAUBTEN WERT HAT BZW. DEN DEFAULT |
---|
| 1249 | # SETZEN |
---|
| 1250 | if [[ $node_usage = default ]] |
---|
| 1251 | then |
---|
| 1252 | if [[ $host = ibms ]] |
---|
| 1253 | then |
---|
| 1254 | node_usage=shared |
---|
[181] | 1255 | elif [[ $(echo $host | cut -c1-5) = lcsgi ]] |
---|
| 1256 | then |
---|
| 1257 | node_usage=singlejob |
---|
[1] | 1258 | else |
---|
| 1259 | node_usage=not_shared |
---|
| 1260 | fi |
---|
| 1261 | fi |
---|
[181] | 1262 | |
---|
[635] | 1263 | if [[ $node_usage != shared && $node_usage != not_shared && $node_usage != singlejob && "$(echo $node_usage | cut -c1-3)" != "sla" ]] |
---|
[1] | 1264 | then |
---|
| 1265 | printf "\n" |
---|
| 1266 | printf "\n +++ node usage (option \"-n\") is only allowed to be set" |
---|
| 1267 | printf "\n \"shared\" or \"not_shared\"" |
---|
| 1268 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
| 1269 | fi |
---|
| 1270 | |
---|
| 1271 | fi |
---|
| 1272 | |
---|
| 1273 | # PRUEFEN, OB HOSTFILE EXISTIERT |
---|
| 1274 | if [[ -n $hostfile ]] |
---|
| 1275 | then |
---|
| 1276 | if [[ ! -f $hostfile ]] |
---|
| 1277 | then |
---|
| 1278 | printf "\n" |
---|
| 1279 | printf "\n +++ hostfile \"$hostfile\" does not exist" |
---|
| 1280 | locat=hostfile; exit |
---|
| 1281 | fi |
---|
| 1282 | fi |
---|
| 1283 | |
---|
| 1284 | # PRUEFEN, OB RHOSTS DATEI EXISTIERT. GEGEBENENFALLS ANLEGEN BZW. ERWEITERN |
---|
| 1285 | if [[ $host = ibmy && $do_remote = false ]] |
---|
| 1286 | then |
---|
| 1287 | if [[ ! -f $HOME/.rhosts ]] |
---|
| 1288 | then |
---|
| 1289 | echo "gfdl5.yonsei.ac.kr" > $HOME/.rhosts |
---|
| 1290 | printf "\n\n *** file:" |
---|
| 1291 | printf "\n $HOME/.rhosts" |
---|
| 1292 | printf "\n was created\n" |
---|
| 1293 | fi |
---|
| 1294 | if [[ $(grep -c gfdl5.yonsei.ac.kr $HOME/.rhosts) = 0 ]] |
---|
| 1295 | then |
---|
| 1296 | echo "gfdl5.yonsei.ac.kr" >> $HOME/.rhosts |
---|
| 1297 | printf "\n\n *** file:" |
---|
| 1298 | printf "\n $HOME/.rhosts" |
---|
| 1299 | printf "\n was extended by the name of the current host\n" |
---|
| 1300 | fi |
---|
| 1301 | fi |
---|
| 1302 | |
---|
| 1303 | |
---|
[759] | 1304 | # Set default value for the maximum number of parallel io streams |
---|
| 1305 | if [[ "$maximum_parallel_io_streams" = "" ]] |
---|
| 1306 | then |
---|
| 1307 | maximum_parallel_io_streams=$numprocs |
---|
| 1308 | fi |
---|
[1] | 1309 | |
---|
[759] | 1310 | |
---|
[1] | 1311 | # FALLS NICHT VORGEGEBEN, DEFAULT-QUEUE AUF DER ZIELMASCHINE FESTLEGEN |
---|
| 1312 | if [[ $queue = none ]] |
---|
| 1313 | then |
---|
| 1314 | case $host in |
---|
[312] | 1315 | (ibmh) queue=no_class;; |
---|
[693] | 1316 | (ibmkisti) queue=class.32plus;; |
---|
[1] | 1317 | (ibmy) queue=parallel;; |
---|
[440] | 1318 | (lckyoto) queue=ph;; |
---|
[821] | 1319 | (lcsgib) queue=testq;; |
---|
| 1320 | (lcsgih) queue=testq;; |
---|
[635] | 1321 | (lctit) queue=S;; |
---|
[1] | 1322 | (nech) queue=none;; |
---|
[253] | 1323 | (necriam) queue=SP;; |
---|
[1] | 1324 | (unics) queue=unics;; |
---|
| 1325 | esac |
---|
| 1326 | fi |
---|
| 1327 | |
---|
| 1328 | |
---|
| 1329 | # VOLLSTAENDIGE DATEINAMEN DER INPUT-FILES BILDEN, |
---|
| 1330 | # INPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER |
---|
| 1331 | # ERMITTELN |
---|
| 1332 | (( i = 0 )) |
---|
| 1333 | while (( i < iin )) |
---|
| 1334 | do |
---|
| 1335 | (( i = i + 1 )) |
---|
| 1336 | (( maxcycle = 0 )) |
---|
| 1337 | |
---|
| 1338 | # NAMENSBILDUNG (EVTL. IST FESTER DATEINAME VORGEGEBEN) |
---|
| 1339 | if [[ "${actionin[$i]}" = di ]] |
---|
| 1340 | then |
---|
| 1341 | remotepathin[$i]=${pathin[$i]}/${endin[$i]} # REMOTE-PFAD ERST AUF |
---|
| 1342 | # REM-MASCHINE AUSWERTEN |
---|
| 1343 | eval filename=${pathin[$i]}/${endin[$i]} |
---|
| 1344 | else |
---|
| 1345 | remotepathin[$i]=${pathin[$i]}/${afname}${endin[$i]} # REMOTE-PFAD ERST AUF |
---|
| 1346 | # REM-MASCHINE AUSWERTEN |
---|
| 1347 | eval filename=${pathin[$i]}/${afname}${endin[$i]} |
---|
| 1348 | fi |
---|
[892] | 1349 | eval pathname=${pathin[$i]} |
---|
[1] | 1350 | |
---|
[920] | 1351 | # SAVE INPUT FILE NAME FOR PARAMETER FILE CHECK |
---|
| 1352 | if [[ ("${transin[$i]}" = job) && (-f $filename) ]] |
---|
| 1353 | then |
---|
| 1354 | filename_input=$filename |
---|
| 1355 | fi |
---|
[892] | 1356 | |
---|
[1] | 1357 | # PRUEFEN AUF VORHANDENSEIN |
---|
| 1358 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
[746] | 1359 | $(ls $filename* 2>&1 | grep -c "nicht gefunden") = 1 || \ |
---|
[1] | 1360 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
| 1361 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
| 1362 | then |
---|
| 1363 | # DATEIEN MIT EXTENSION (Z.B. NC) MUESSEN NICHT ZWINGEND VORHANDEN |
---|
| 1364 | # SEIN, DESHALB IN SOLCHEN FAELLEN KEIN ABBRUCH. DIES IST NUR EINE |
---|
| 1365 | # VORUEBERGEHENDE LOESUNG (OKT 05). NICHT ZWINGEND BENOETIGTE |
---|
| 1366 | # EINGABEDATEIEN SOLLTEN EINE SPEZIELLE OPTION IN DER DATEI- |
---|
| 1367 | # VERBINDUNGSANWEISUNG BEKOMMEN (Z.B. inopt?) |
---|
| 1368 | if [[ "${transin[$i]}" != "locopt" ]] |
---|
| 1369 | then |
---|
| 1370 | printf "\n\n +++ INPUT-file: " |
---|
| 1371 | if [[ "${extin[$i]}" = "" ]] |
---|
| 1372 | then |
---|
| 1373 | printf "\n $filename" |
---|
| 1374 | else |
---|
| 1375 | printf "\n $filename.${extin[$i]}" |
---|
| 1376 | fi |
---|
| 1377 | printf "\n does not exist\n" |
---|
| 1378 | locat=input; exit |
---|
| 1379 | else |
---|
| 1380 | transin[$i]="unavailable" |
---|
| 1381 | fi |
---|
| 1382 | else |
---|
| 1383 | |
---|
| 1384 | # ZYKLUSNUMMER FESTSTELLEN |
---|
| 1385 | ls -1 -d $filename > filelist 2>/dev/null |
---|
| 1386 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
| 1387 | while read zeile |
---|
| 1388 | do |
---|
| 1389 | cycle=$(print $zeile | cut -f2 -d".") |
---|
| 1390 | if [[ "$cycle" = "$zeile" ]] |
---|
| 1391 | then |
---|
| 1392 | (( icycle = 0 )) |
---|
| 1393 | elif [[ "$cycle" = "${extin[$i]}" ]] |
---|
| 1394 | then |
---|
| 1395 | (( icycle = 0 )) |
---|
| 1396 | else |
---|
| 1397 | (( icycle = $cycle )) |
---|
| 1398 | fi |
---|
| 1399 | if (( icycle > maxcycle )) |
---|
| 1400 | then |
---|
| 1401 | (( maxcycle = icycle )) |
---|
| 1402 | file_to_be_used=$zeile |
---|
| 1403 | fi |
---|
| 1404 | done <filelist |
---|
| 1405 | rm filelist |
---|
| 1406 | |
---|
| 1407 | # EVTL. ZYKLUSNUMMER AN DATEINAMEN ANFUEGEN |
---|
| 1408 | if (( maxcycle > 0 )) |
---|
| 1409 | then |
---|
| 1410 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
| 1411 | then |
---|
| 1412 | filename=${filename}.$maxcycle.${extin[$i]} |
---|
| 1413 | else |
---|
| 1414 | filename=${filename}.$maxcycle |
---|
| 1415 | fi |
---|
| 1416 | else |
---|
| 1417 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
| 1418 | then |
---|
| 1419 | filename=${filename}.${extin[$i]} |
---|
| 1420 | fi |
---|
| 1421 | fi |
---|
| 1422 | |
---|
| 1423 | # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, |
---|
| 1424 | # DA SPAETER BEI RUECKSPEICHERN VOM ARCHIVSYSTEM EVTL. BENOETIGT |
---|
| 1425 | absnamein[$i]=$filename |
---|
| 1426 | if (( maxcycle > 0 )) |
---|
| 1427 | then |
---|
| 1428 | if [[ "${actionin[$i]}" = di ]] |
---|
| 1429 | then |
---|
| 1430 | frelin[$i]=${endin[$i]}.$maxcycle |
---|
| 1431 | else |
---|
| 1432 | frelin[$i]=${afname}${endin[$i]}.$maxcycle |
---|
| 1433 | fi |
---|
| 1434 | else |
---|
| 1435 | if [[ "${actionin[$i]}" = di ]] |
---|
| 1436 | then |
---|
| 1437 | frelin[$i]=${endin[$i]} |
---|
| 1438 | else |
---|
| 1439 | frelin[$i]=${afname}${endin[$i]} |
---|
| 1440 | fi |
---|
| 1441 | fi |
---|
| 1442 | |
---|
| 1443 | fi |
---|
| 1444 | done |
---|
[920] | 1445 | |
---|
[1] | 1446 | # VOLLSTAENDIGE DATEINAMEN (OHNE $ ODER ~) DER OUTPUT-FILES BILDEN, |
---|
| 1447 | # OUTPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER |
---|
| 1448 | # ERMITTELN ODER, FALLS NICHT VORHANDEN, PRUEFEN, OB SIE SICH ANLEGEN LASSEN |
---|
| 1449 | # DIESE AKTIONEN FINDEN NICHT STATT, WENN PROGRAMM AUF REMOTE-MASCHINE |
---|
| 1450 | # RECHNET UND DATEI ANSCHLIESSEND TRANSFERIERT WERDEN SOLL! |
---|
| 1451 | (( i = 0 )) |
---|
| 1452 | while (( i < iout )) |
---|
| 1453 | do |
---|
| 1454 | (( i = i + 1 )) |
---|
| 1455 | if [[ ! ( $fromhost != $localhost && ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]] |
---|
| 1456 | then |
---|
[260] | 1457 | if [[ "${actionout[$i]}" = tr ]] |
---|
[1] | 1458 | then |
---|
| 1459 | actionout[$i]="" |
---|
[260] | 1460 | elif [[ "${actionout[$i]}" = trpe ]] |
---|
| 1461 | then |
---|
| 1462 | actionout[$i]=pe |
---|
[1] | 1463 | elif [[ "${actionout[$i]}" = tra ]] |
---|
| 1464 | then |
---|
| 1465 | actionout[$i]=a |
---|
| 1466 | fi |
---|
| 1467 | (( maxcycle = 0 )) |
---|
| 1468 | eval filename=${pathout[$i]}/${fname}${endout[$i]} |
---|
| 1469 | eval catalogname=${pathout[$i]} |
---|
| 1470 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
[746] | 1471 | $(ls $filename* 2>&1 | grep -c "nicht gefunden") = 1 || \ |
---|
[1] | 1472 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
| 1473 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
| 1474 | then |
---|
| 1475 | |
---|
| 1476 | # OUTPUT-DATEI NICHT VORHANDEN. PRUEFEN, OB ANLEGEN MOEGLICH. |
---|
| 1477 | if cat /dev/null > $filename |
---|
| 1478 | then |
---|
| 1479 | rm $filename |
---|
| 1480 | else |
---|
| 1481 | |
---|
| 1482 | # PRUEFEN, OB KATALOG VORHANDEN UND EVTL. DIESEN ANLEGEN |
---|
| 1483 | if [[ ! -d $catalogname ]] |
---|
| 1484 | then |
---|
| 1485 | if mkdir -p $catalogname |
---|
| 1486 | then |
---|
| 1487 | printf "\n\n *** directory:" |
---|
| 1488 | printf "\n $catalogname" |
---|
| 1489 | printf "\n was created\n" |
---|
| 1490 | else |
---|
| 1491 | printf "\n\n +++ OUTPUT-file:" |
---|
| 1492 | printf "\n $filename" |
---|
| 1493 | printf "\n cannot be created, because directory does not exist" |
---|
| 1494 | printf "\n and cannot be created either" |
---|
| 1495 | printf "\n" |
---|
| 1496 | locat=output ; exit |
---|
| 1497 | fi 2>/dev/null |
---|
| 1498 | else |
---|
| 1499 | printf "\n\n +++ OUTPUT-file:" |
---|
| 1500 | printf "\n $filename" |
---|
| 1501 | printf "\n cannot be created, although directory exists" |
---|
| 1502 | printf "\n" |
---|
| 1503 | locat=output ; exit |
---|
| 1504 | fi |
---|
| 1505 | fi 2>/dev/null |
---|
| 1506 | else |
---|
| 1507 | |
---|
| 1508 | # ZYKLUSNUMMER FESTSTELLEN |
---|
| 1509 | ls -1 -d $filename > filelist 2>/dev/null |
---|
| 1510 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
| 1511 | while read zeile |
---|
| 1512 | do |
---|
| 1513 | cycle=$(print $zeile | cut -f2 -d".") |
---|
| 1514 | if [[ "$cycle" = "$zeile" || "$cycle" = ${extout[$i]} ]] |
---|
| 1515 | then |
---|
| 1516 | (( icycle = 1 )) |
---|
| 1517 | else |
---|
| 1518 | (( icycle = $cycle + 1 )) |
---|
| 1519 | fi |
---|
| 1520 | if (( icycle > maxcycle )) |
---|
| 1521 | then |
---|
| 1522 | (( maxcycle = icycle )) |
---|
| 1523 | fi |
---|
| 1524 | done <filelist |
---|
| 1525 | rm filelist |
---|
| 1526 | fi |
---|
| 1527 | |
---|
| 1528 | # EVTL. ZYKLUSNUMMER AN DATEINAMEN ANFUEGEN UND PRUEFEN, OB SICH |
---|
| 1529 | # DATEI AUCH WIRKLICH ANLEGEN LAESST. IM APPEND-FALL MUSS AN DEN |
---|
| 1530 | # HOECHSTEN VORHANDENEN ZYKLUS-ANGEHAENGT WERDEN. ANLAGEPRUEFUNG |
---|
| 1531 | # IST DANN NATUERLICH NICHT ZULAESSIG BZW. MOEGLICH |
---|
| 1532 | if [[ "${actionout[$i]}" != a ]] |
---|
| 1533 | then |
---|
| 1534 | if (( maxcycle > 0 )) |
---|
| 1535 | then |
---|
| 1536 | filename=${filename}.$maxcycle |
---|
| 1537 | if cat /dev/null > $filename |
---|
| 1538 | then |
---|
| 1539 | rm $filename |
---|
| 1540 | else |
---|
| 1541 | printf "\n +++ OUTPUT-file:" |
---|
| 1542 | printf "\n $filename" |
---|
| 1543 | printf "\n cannot be created" |
---|
| 1544 | locat=output ; exit |
---|
| 1545 | fi |
---|
| 1546 | fi |
---|
| 1547 | else |
---|
| 1548 | (( maxcycle = maxcycle - 1 )) |
---|
| 1549 | if (( maxcycle > 0 )) |
---|
| 1550 | then |
---|
| 1551 | filename=${filename}.$maxcycle |
---|
| 1552 | fi |
---|
| 1553 | fi |
---|
| 1554 | |
---|
| 1555 | # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, |
---|
| 1556 | # DA SPAETER BEI ABLAGE AUF ARCHIVSYSTEM BZW. FUER |
---|
| 1557 | # DATEI OUTPUT_FILE_CONNECTIONS EVTL. BENOETIGT |
---|
| 1558 | pathout[$i]=$filename |
---|
| 1559 | if (( maxcycle > 0 )) |
---|
| 1560 | then |
---|
| 1561 | frelout[$i]=${fname}${endout[$i]}.$maxcycle |
---|
| 1562 | else |
---|
| 1563 | frelout[$i]=${fname}${endout[$i]} |
---|
| 1564 | fi |
---|
| 1565 | |
---|
| 1566 | fi |
---|
| 1567 | done |
---|
| 1568 | |
---|
| 1569 | |
---|
[260] | 1570 | # DAS DVR-PAKET ERFORDERT EINE ENTSPRECHENDE BIBLIOTHEK |
---|
[83] | 1571 | if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
| 1572 | then |
---|
[260] | 1573 | if [[ "$dvr_inc" = "" ]] |
---|
[83] | 1574 | then |
---|
[260] | 1575 | printf "\n\n +++ no value for \"dvr_inc\" given in configuration file" |
---|
[83] | 1576 | printf "\n This is required for the dvrp_graphics package.\n" |
---|
[260] | 1577 | locat=dvr; exit |
---|
[83] | 1578 | fi |
---|
[260] | 1579 | if [[ "$dvr_lib" = "" ]] |
---|
[83] | 1580 | then |
---|
[260] | 1581 | printf "\n\n +++ no value for \"dvr_lib\" given in configuration file" |
---|
[83] | 1582 | printf "\n This is required for the dvrp_graphics package.\n" |
---|
[260] | 1583 | locat=dvr; exit |
---|
[83] | 1584 | fi |
---|
| 1585 | fi |
---|
| 1586 | |
---|
| 1587 | |
---|
[1] | 1588 | # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM ODER NUR EIN AUSFUEHRBARES |
---|
| 1589 | # PROGRAMM VEREINBART WURDE (IN DIESEM FALL BRAUCHT IM WEITEREN NICHT |
---|
| 1590 | # UEBERSETZT ZU WERDEN) |
---|
| 1591 | if [[ "$mainprog" = "" && "$executable" = "" ]] |
---|
| 1592 | then |
---|
| 1593 | printf "\n +++ neither main program nor executable defined" |
---|
| 1594 | locat=source; exit |
---|
| 1595 | elif [[ "$mainprog" != "" && "$executable" != "" ]] |
---|
| 1596 | then |
---|
| 1597 | printf "\n +++ main program as well as executable defined" |
---|
| 1598 | locat=source; exit |
---|
| 1599 | elif [[ "$mainprog" = "" && "$executable" != "" ]] |
---|
| 1600 | then |
---|
| 1601 | do_compile=false |
---|
| 1602 | fi |
---|
| 1603 | |
---|
| 1604 | |
---|
[191] | 1605 | # SOURCE-VERZEICHNIS ZUM AUFSAMMELN DER ZU UEBERSETZENDEN PROGRAMMTEILE |
---|
| 1606 | # ERZEUGEN. HIERHIN WERDEN SPAETER IM FALL VON BATCH-JOBS AUCH DAS MRUN- |
---|
| 1607 | # SCRIPTS SOWIE DIE KONFIGURATIONSDATEI KOPIERT |
---|
[193] | 1608 | if [[ $restart_run != true && "$SOURCES_COMPLETE" = "" ]] |
---|
[191] | 1609 | then |
---|
| 1610 | rm -rf SOURCES_FOR_RUN_$fname |
---|
| 1611 | mkdir SOURCES_FOR_RUN_$fname |
---|
| 1612 | fi |
---|
| 1613 | |
---|
| 1614 | |
---|
[1] | 1615 | # ALLE ZU UEBERSETZENDEN PROGRAMMTEILE ZUSAMMENSAMMELN |
---|
| 1616 | # BEI BATCH-JOBS IST DIES NICHT NOETIG, WEIL DIE PROGRAMMTEILE BEREITS DURCH |
---|
| 1617 | # DEN MRUN-AUFRUF ERMITTELT SIND, DER DEN BATCH-JOB GENERIERT HAT, UND |
---|
| 1618 | # IM VERZEICHNIS SOURCES_FOR_RUN_... ABGELEGT SIND |
---|
| 1619 | if [[ $do_compile = true && "$SOURCES_COMPLETE" = "" ]] |
---|
| 1620 | then |
---|
| 1621 | |
---|
[5] | 1622 | [[ "$source_list" = LM ]] && source_list=LOCALLY_MODIFIED |
---|
[1] | 1623 | |
---|
[838] | 1624 | if [[ "$source_list" = LOCALLY_MODIFIED ]] |
---|
[1] | 1625 | then |
---|
| 1626 | |
---|
[5] | 1627 | # MODIFIZIERTE DATEIEN DER SVN-ARBEITSKOPIE BESTIMMEN |
---|
| 1628 | source_list="" |
---|
| 1629 | cd $source_path |
---|
| 1630 | |
---|
| 1631 | |
---|
| 1632 | # PRUEFEN, OB VERZEICHNIS UEBERHAUPT UNTER SVN-KONTROLLE STEHT |
---|
| 1633 | if [[ ! -d .svn ]] |
---|
| 1634 | then |
---|
| 1635 | printf "\n\n +++ source directory" |
---|
| 1636 | printf "\n \"$source_path\" " |
---|
| 1637 | printf "\n is not under control of \"subversion\"." |
---|
[306] | 1638 | printf "\n Please do not use mrun-option \"-s LOCALLY_MODIFIED\"\n" |
---|
[5] | 1639 | fi |
---|
| 1640 | |
---|
| 1641 | |
---|
| 1642 | # ALLE MODIFIZIERTEN QUELLCODEDATEIEN AUFLISTEN |
---|
| 1643 | Filenames="" |
---|
[69] | 1644 | svn status > tmp_mrun |
---|
| 1645 | while read line |
---|
[5] | 1646 | do |
---|
| 1647 | firstc=`echo $line | cut -c1` |
---|
| 1648 | if [[ $firstc = M || $firstc = "?" ]] |
---|
| 1649 | then |
---|
| 1650 | Name=`echo "$line" | cut -c8-` |
---|
| 1651 | extension=`echo $Name | cut -d. -f2` |
---|
| 1652 | if [[ "$extension" = f90 || "$extension" = F90 || "$extension" = f || "$extension" = F || "$extension" = c ]] |
---|
| 1653 | then |
---|
| 1654 | Filenames="$Filenames "$Name |
---|
| 1655 | fi |
---|
| 1656 | fi |
---|
[69] | 1657 | done < tmp_mrun |
---|
[5] | 1658 | |
---|
| 1659 | |
---|
| 1660 | # DATEIEN NACH SOURCES_FOR_RUN_... KOPIEREN |
---|
| 1661 | for dateiname in $Filenames |
---|
| 1662 | do |
---|
| 1663 | cp $dateiname $working_directory/SOURCES_FOR_RUN_$fname |
---|
| 1664 | source_list=$source_list"$dateiname " |
---|
| 1665 | done |
---|
| 1666 | |
---|
| 1667 | cd - > /dev/null |
---|
| 1668 | |
---|
| 1669 | |
---|
[1] | 1670 | # MITTELS OPTION -s ANGEGEBENE DATEIEN NACH SOURCES_FOR_RUN_... KOPIEREN |
---|
| 1671 | # BEI AUTOMATISCHEN FORTSETZUNGSLAEUFEN SIND DORT SCHON ALLE DATEIEN |
---|
| 1672 | # VORHANDEN |
---|
[5] | 1673 | elif [[ "$source_list" != "" && $restart_run != true ]] |
---|
[1] | 1674 | then |
---|
| 1675 | |
---|
| 1676 | cd $source_path |
---|
| 1677 | |
---|
| 1678 | for filename in $source_list |
---|
| 1679 | do |
---|
| 1680 | |
---|
| 1681 | # QUELLTEXT-DATEI DARF KEINE PFADE BEINHALTEN |
---|
| 1682 | if [[ $(print $filename | grep -c "/") != 0 ]] |
---|
| 1683 | then |
---|
| 1684 | printf "\n +++ source code file: $filename" |
---|
| 1685 | printf "\n must not contain (\"/\") " |
---|
| 1686 | locat=source; exit |
---|
| 1687 | fi |
---|
| 1688 | |
---|
| 1689 | if [[ ! -f $filename ]] |
---|
| 1690 | then |
---|
| 1691 | printf "\n +++ source code file: $filename" |
---|
| 1692 | printf "\n does not exist" |
---|
| 1693 | locat=source; exit |
---|
| 1694 | else |
---|
| 1695 | cp $filename $working_directory/SOURCES_FOR_RUN_$fname |
---|
| 1696 | fi |
---|
| 1697 | |
---|
| 1698 | done |
---|
| 1699 | |
---|
| 1700 | cd - > /dev/null |
---|
| 1701 | |
---|
| 1702 | fi |
---|
| 1703 | |
---|
| 1704 | |
---|
| 1705 | # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM VORHANDEN UND ES EVTL. IN DER |
---|
| 1706 | # LISTE DER ZU UEBERSETZENDEN PROGRAMMTEILE MIT ENTHALTEN IST (WENN |
---|
| 1707 | # NICHT, WIRD ES DIESER LISTE HINZUGEFUEGT) |
---|
[5] | 1708 | if [[ $restart_run != true ]] |
---|
[1] | 1709 | then |
---|
| 1710 | |
---|
| 1711 | if [[ ! -f "$source_path/$mainprog" ]] |
---|
| 1712 | then |
---|
| 1713 | printf "\n\n +++ main program: $mainprog" |
---|
| 1714 | printf "\n does not exist in source directory" |
---|
| 1715 | printf "\n \"$source_path\"\n" |
---|
| 1716 | locat=source; exit |
---|
| 1717 | else |
---|
| 1718 | if [[ $(echo $source_list | grep -c $mainprog) = 0 ]] |
---|
| 1719 | then |
---|
| 1720 | cp $source_path/$mainprog SOURCES_FOR_RUN_$fname |
---|
| 1721 | source_list=${mainprog}" $source_list" |
---|
| 1722 | fi |
---|
| 1723 | fi |
---|
| 1724 | fi |
---|
| 1725 | |
---|
| 1726 | |
---|
[211] | 1727 | # MAKEFILE AUF VORHANDENSEIN PRUEFEN UND KOPIEREN |
---|
| 1728 | # BEI RESTART-LAEUFEN LIEGT ES SCHON IM VERZEICHNIS SOURCES_FOR_RUN... |
---|
| 1729 | if [[ "$restart_run" != true ]] |
---|
| 1730 | then |
---|
| 1731 | [[ "$makefile" = "" ]] && makefile=$source_path/Makefile |
---|
| 1732 | if [[ ! -f $makefile ]] |
---|
| 1733 | then |
---|
| 1734 | printf "\n +++ file \"$makefile\" does not exist" |
---|
| 1735 | locat=make; exit |
---|
| 1736 | else |
---|
| 1737 | cp $makefile SOURCES_FOR_RUN_$fname/Makefile |
---|
| 1738 | fi |
---|
| 1739 | fi |
---|
| 1740 | |
---|
| 1741 | |
---|
[1] | 1742 | # DATEIEN AUS ZUSAETZLICHEM QUELLVERZEICHNIS HINZUFUEGEN |
---|
[5] | 1743 | if [[ $restart_run != true && "$add_source_path" != "" ]] |
---|
[1] | 1744 | then |
---|
| 1745 | |
---|
| 1746 | # GIBT ES DAS VERZEICHNIS UEBERHAUPT? |
---|
| 1747 | if [[ ! -d $add_source_path ]] |
---|
| 1748 | then |
---|
| 1749 | printf "\n\n +++ WARNING: additional source code directory" |
---|
| 1750 | printf "\n \"$add_source_path\" " |
---|
| 1751 | printf "\n does not exist or is not a directory." |
---|
| 1752 | printf "\n No source code will be used from this directory!\n" |
---|
| 1753 | add_source_path="" |
---|
[931] | 1754 | if [[ $silent == false ]] |
---|
| 1755 | then |
---|
| 1756 | sleep 3 |
---|
| 1757 | fi |
---|
[1] | 1758 | else |
---|
| 1759 | |
---|
| 1760 | cd $add_source_path |
---|
[211] | 1761 | found=false |
---|
[1] | 1762 | |
---|
| 1763 | Names=$(ls -1 *.f90 2>&1) |
---|
| 1764 | [[ $(echo $Names | grep -c '*.f90') = 0 ]] && AddFilenames="$Names" |
---|
| 1765 | Names=$(ls -1 *.F90 2>&1) |
---|
| 1766 | [[ $(echo $Names | grep -c '*.F90') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
| 1767 | Names=$(ls -1 *.F 2>&1) |
---|
| 1768 | [[ $(echo $Names | grep -c '*.F') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
| 1769 | Names=$(ls -1 *.f 2>&1) |
---|
| 1770 | [[ $(echo $Names | grep -c '*.f') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
| 1771 | Names=$(ls -1 *.c 2>&1) |
---|
| 1772 | [[ $(echo $Names | grep -c '*.c') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
| 1773 | |
---|
| 1774 | cd - > /dev/null |
---|
| 1775 | cd SOURCES_FOR_RUN_$fname |
---|
| 1776 | |
---|
[211] | 1777 | # COPY MAKEFILE IF EXISTING |
---|
| 1778 | if [[ -f $add_source_path/Makefile ]] |
---|
| 1779 | then |
---|
| 1780 | printf "\n\n *** user Makefile from directory" |
---|
| 1781 | printf "\n \"$add_source_path\" is used \n" |
---|
[931] | 1782 | if [[ $silent == false ]] |
---|
| 1783 | then |
---|
| 1784 | sleep 1 |
---|
| 1785 | fi |
---|
[211] | 1786 | cp $add_source_path/Makefile . |
---|
| 1787 | fi |
---|
| 1788 | |
---|
[1] | 1789 | for dateiname in $AddFilenames |
---|
| 1790 | do |
---|
| 1791 | if [[ -f $dateiname ]] |
---|
| 1792 | then |
---|
| 1793 | printf "\n +++ source code file \"$dateiname\" found in additional" |
---|
| 1794 | printf "\n source code directory \"$add_source_path\" " |
---|
[211] | 1795 | printf "\n but was also given with option \"-s\" which means that it should be taken" |
---|
| 1796 | printf "\n from directory \"$source_path\"." |
---|
[1] | 1797 | locat=source; exit |
---|
| 1798 | fi |
---|
| 1799 | |
---|
| 1800 | cp $add_source_path/$dateiname . |
---|
| 1801 | source_list="$source_list $dateiname" |
---|
| 1802 | |
---|
[211] | 1803 | # CHECK IF FILE IS CONTAINED IN MAKEFILE |
---|
| 1804 | if [[ $(grep -c $dateiname Makefile) = 0 ]] |
---|
| 1805 | then |
---|
| 1806 | printf "\n\n +++ user file \"$dateiname\" " |
---|
| 1807 | printf "\n is not listed in Makefile \n" |
---|
| 1808 | locat=source; exit |
---|
| 1809 | else |
---|
| 1810 | |
---|
[1] | 1811 | # Default User-Interface von der Liste entfernen, falls Datei |
---|
| 1812 | # ein User-Interface enthaelt |
---|
[211] | 1813 | # if [[ $( cat $dateiname | grep -c "END SUBROUTINE user_parin" ) != 0 ]] |
---|
| 1814 | # then |
---|
| 1815 | # if [[ $dateiname != user_interface.f90 && -f user_interface.f90 ]] |
---|
| 1816 | # then |
---|
| 1817 | # rm -rf user_interface.f90 |
---|
| 1818 | # source_list=`echo $source_list | sed -e 's/user_interface.f90//'` |
---|
| 1819 | # printf "\n\n *** default \"user_interface.f90\" removed from the files to be translated" |
---|
| 1820 | # printf "\n since a user-interface is found in file" |
---|
| 1821 | # printf "\n \"$add_source_path/$dateiname\" \n" |
---|
| 1822 | # sleep 3 |
---|
| 1823 | # else |
---|
| 1824 | if [[ $found = false ]] |
---|
[1] | 1825 | then |
---|
[211] | 1826 | found=true |
---|
| 1827 | printf "\n\n *** following user file(s) added to the" |
---|
| 1828 | printf " files to be translated:\n " |
---|
[1] | 1829 | fi |
---|
[211] | 1830 | printf "$dateiname " |
---|
[931] | 1831 | if [[ $silent == false ]] |
---|
| 1832 | then |
---|
| 1833 | sleep 0.5 |
---|
| 1834 | fi |
---|
| 1835 | |
---|
[1] | 1836 | fi |
---|
| 1837 | done |
---|
[211] | 1838 | [[ $found = true ]] && printf "\n" |
---|
[1] | 1839 | cd - > /dev/null |
---|
| 1840 | fi |
---|
| 1841 | fi |
---|
| 1842 | |
---|
| 1843 | |
---|
| 1844 | # ALLE UNTERPROGRAMME, DIE ZU VEREINBARTEN SOFTWAREPAKETEN GEHOEREN, |
---|
| 1845 | # DER LISTE DER ZU UEBERSETZENDEN DATEIEN HINZUFUEGEN |
---|
[5] | 1846 | if [[ $restart_run != true && -n $package_list ]] |
---|
[1] | 1847 | then |
---|
| 1848 | |
---|
| 1849 | cd $source_path |
---|
| 1850 | |
---|
| 1851 | for package in $package_list |
---|
| 1852 | do |
---|
| 1853 | |
---|
| 1854 | [[ $package = "dvrp_graphics+1PE" ]] && package=dvrp_graphics |
---|
| 1855 | |
---|
| 1856 | # ERMITTELE ALLE DATEIEN, DIE ZUM PAKET GEHOEREN |
---|
| 1857 | # FEHLERMELDUNGEN WERDEN ABGEFANGEN, DA * AUCH VERZEICHNISSNAMEN |
---|
| 1858 | # LIEFERT |
---|
| 1859 | package_source_list=`grep "defined( __$package " * 2>/dev/null | cut -f1 -d:` |
---|
| 1860 | |
---|
| 1861 | |
---|
| 1862 | # FUEGE DIESE DATEIEN DER LISTE DER ZU UEBERSETZENDEN DATEIEN |
---|
| 1863 | # HINZU, FALLS SIE NOCH NICHT DAZUGEHOEREN |
---|
| 1864 | for source_list_name in $package_source_list |
---|
| 1865 | do |
---|
| 1866 | if [[ $(echo $source_list | grep -c $source_list_name) = 0 ]] |
---|
| 1867 | then |
---|
| 1868 | |
---|
| 1869 | # NUR DATEIEN MIT GUELTIGEN ENDUNGEN VERWENDEN |
---|
| 1870 | ending=`echo $source_list_name | cut -f2 -d.` |
---|
| 1871 | if [[ "$ending" = f90 || "$ending" = F90 || "$ending" = f || "$ending" = F || "$ending" = c ]] |
---|
| 1872 | then |
---|
| 1873 | cp $source_list_name $working_directory/SOURCES_FOR_RUN_$fname |
---|
| 1874 | source_list="$source_list $source_list_name" |
---|
| 1875 | fi |
---|
| 1876 | fi |
---|
| 1877 | done |
---|
| 1878 | done |
---|
| 1879 | |
---|
| 1880 | cd - > /dev/null |
---|
| 1881 | fi |
---|
| 1882 | |
---|
| 1883 | |
---|
| 1884 | # MAKEFILE AUF VORHANDENSEIN PRUEFEN UND KOPIEREN |
---|
| 1885 | # BEI RESTART-LAEUFEN LIEGT ES SCHON IM VERZEICHNIS SOURCES_FOR_RUN... |
---|
[211] | 1886 | # if [[ "$restart_run" != true ]] |
---|
| 1887 | # then |
---|
| 1888 | # [[ "$makefile" = "" ]] && makefile=$source_path/Makefile |
---|
| 1889 | # if [[ ! -f $makefile ]] |
---|
| 1890 | # then |
---|
| 1891 | # printf "\n +++ file \"$makefile\" does not exist" |
---|
| 1892 | # locat=make; exit |
---|
| 1893 | # else |
---|
| 1894 | # cp $makefile SOURCES_FOR_RUN_$fname/Makefile |
---|
| 1895 | # fi |
---|
| 1896 | # fi |
---|
[1] | 1897 | |
---|
| 1898 | fi # do_compile=true |
---|
| 1899 | |
---|
| 1900 | |
---|
| 1901 | # FALLS PROGRAMMTEILE UEBERSETZT WERDEN SOLLEN, FOLGEN JETZT EINIGE |
---|
| 1902 | # UEBERPRUEFUNGEN UND DAS SETZEN DER PRAEPROZESSOR-DIREKTIVEN |
---|
| 1903 | if [[ $do_compile = true ]] |
---|
| 1904 | then |
---|
| 1905 | |
---|
| 1906 | # PRAEPROZESSOR-DIREKTIVEN ZUM SELEKTIVEN AUSWAEHLEN VON CODETEILEN |
---|
| 1907 | # ZUSAMMENSETZEN |
---|
[83] | 1908 | # DIREKTIVEN ZUM AKTIVIEREN VON RECHNERSPEZIFISCHEM CODE |
---|
[1] | 1909 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
| 1910 | then |
---|
[82] | 1911 | cpp_options="${cpp_options},-D__ibm=__ibm" |
---|
[1] | 1912 | elif [[ $(echo $localhost | cut -c1-3) = nec ]] |
---|
| 1913 | then |
---|
[82] | 1914 | cpp_options="$cpp_options -D__nec" |
---|
| 1915 | elif [[ $(echo $localhost | cut -c1-2) = lc ]] |
---|
| 1916 | then |
---|
| 1917 | cpp_options="$cpp_options -D__lc" |
---|
[1] | 1918 | else |
---|
[82] | 1919 | cpp_options="$cpp_options -D__$localhost" |
---|
[1] | 1920 | fi |
---|
[83] | 1921 | |
---|
| 1922 | # DIREKTIVEN DIE DURCH OPTION -K BESTIMMT WERDEN (Z.B. PARALLEL) |
---|
[1] | 1923 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
| 1924 | then |
---|
[82] | 1925 | [[ -n $cond1 ]] && cpp_options="${cpp_options},-D__$cond1=__$cond1" |
---|
| 1926 | [[ -n $cond2 ]] && cpp_options="${cpp_options},-D__$cond2=__$cond2" |
---|
[1] | 1927 | else |
---|
[82] | 1928 | [[ -n $cond1 ]] && cpp_options="$cpp_options -D__$cond1" |
---|
| 1929 | [[ -n $cond2 ]] && cpp_options="$cpp_options -D__$cond2" |
---|
[1] | 1930 | fi |
---|
[83] | 1931 | |
---|
| 1932 | # DIREKTIVEN DIE SOFTWAREPAKETE AKTIVIEREN (OPTION -p) |
---|
[1] | 1933 | if [[ -n $package_list ]] |
---|
| 1934 | then |
---|
| 1935 | for package in $package_list |
---|
| 1936 | do |
---|
| 1937 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
| 1938 | then |
---|
| 1939 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
| 1940 | then |
---|
[82] | 1941 | cpp_options="${cpp_options},-D__$package=__$package" |
---|
[1] | 1942 | else |
---|
[82] | 1943 | cpp_options="${cpp_options},-D__dvrp_graphics=__dvrp_graphics" |
---|
[1] | 1944 | export use_seperate_pe_for_dvrp_output=true |
---|
| 1945 | fi |
---|
| 1946 | else |
---|
| 1947 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
| 1948 | then |
---|
[82] | 1949 | cpp_options="$cpp_options -D__$package" |
---|
[1] | 1950 | else |
---|
[82] | 1951 | cpp_options="$cpp_options -D__dvrp_graphics" |
---|
[1] | 1952 | export use_seperate_pe_for_dvrp_output=true |
---|
| 1953 | fi |
---|
| 1954 | fi |
---|
| 1955 | done |
---|
| 1956 | fi |
---|
[83] | 1957 | |
---|
| 1958 | # DIREKTIVEN DIE DURCH OPTION -D FESTGELEGT SIND |
---|
[1] | 1959 | if [[ -n $cpp_opts ]] |
---|
| 1960 | then |
---|
| 1961 | for popts in $cpp_opts |
---|
| 1962 | do |
---|
[82] | 1963 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
| 1964 | then |
---|
| 1965 | cpp_options="${cpp_options},-D__$popts=__$popts" |
---|
| 1966 | else |
---|
| 1967 | cpp_options="$cpp_options -D__$popts" |
---|
| 1968 | fi |
---|
[1] | 1969 | done |
---|
| 1970 | fi |
---|
| 1971 | |
---|
| 1972 | else |
---|
| 1973 | |
---|
| 1974 | |
---|
| 1975 | # BEI LOKALEN RECHNUNGEN PRUEFEN, OB EXECUTABLE VORHANDEN |
---|
| 1976 | if [[ $do_remote = false ]] |
---|
| 1977 | then |
---|
| 1978 | if [[ ! -f $executable ]] |
---|
| 1979 | then |
---|
| 1980 | printf "\n +++ executable file: $executable" |
---|
| 1981 | printf "\n does not exist" |
---|
| 1982 | locat=executable; exit |
---|
| 1983 | fi |
---|
| 1984 | fi |
---|
| 1985 | fi |
---|
| 1986 | |
---|
| 1987 | |
---|
| 1988 | # JOBMODUS FESTSTELLEN |
---|
[635] | 1989 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
[1] | 1990 | then |
---|
| 1991 | jobmo=BATCH |
---|
| 1992 | else |
---|
| 1993 | jobmo=INTERACTIVE |
---|
| 1994 | fi |
---|
| 1995 | |
---|
| 1996 | |
---|
[635] | 1997 | # no interactive runs on lctit |
---|
| 1998 | if [[ $host = lctit && $jobmo = INTERACTIVE && $do_batch = false ]] |
---|
| 1999 | then |
---|
| 2000 | printf "\n +++ no interactive runs allowed on host \"$host\" " |
---|
| 2001 | printf "\n please submit batch job using mrun option \"-b\" \n" |
---|
| 2002 | locat=normal; exit |
---|
| 2003 | fi |
---|
| 2004 | |
---|
| 2005 | |
---|
[1] | 2006 | # HOSTSPEZIFISCHE DEFAULT-COMPILER SETZEN, FALLS NICHT BEREITS |
---|
| 2007 | # DURCH BENUTZER ANDERWEITIG VEREINBART |
---|
| 2008 | if [[ "$compiler_name" = "" ]] |
---|
| 2009 | then |
---|
[82] | 2010 | |
---|
[220] | 2011 | printf "\n +++ no compiler specified for \"$host $cond1 $cond2\"" |
---|
[82] | 2012 | locat=compiler_name; exit |
---|
| 2013 | |
---|
[1] | 2014 | fi |
---|
| 2015 | |
---|
| 2016 | |
---|
[251] | 2017 | # COMPILER AUF RIAMS NEC UEBERSCHREIBEN |
---|
| 2018 | [[ $localhost = necriam ]] && compiler_name=mpif90 |
---|
[1] | 2019 | |
---|
| 2020 | |
---|
| 2021 | |
---|
| 2022 | # TEMPORAEREN KATALOGNAMEN BESTIMMEN |
---|
| 2023 | kennung=$RANDOM |
---|
| 2024 | if [[ "$tmp_user_catalog" = "" ]] |
---|
| 2025 | then |
---|
[312] | 2026 | if [[ $localhost = ibmh ]] |
---|
[1] | 2027 | then |
---|
[312] | 2028 | tmp_user_catalog=$SCRATCH |
---|
[1] | 2029 | elif [[ $localhost = nech ]] |
---|
| 2030 | then |
---|
| 2031 | tmp_user_catalog=$WRKSHR |
---|
| 2032 | else |
---|
| 2033 | tmp_user_catalog=/tmp |
---|
| 2034 | fi |
---|
| 2035 | fi |
---|
| 2036 | TEMPDIR=$tmp_user_catalog/${usern}.$kennung |
---|
| 2037 | |
---|
| 2038 | |
---|
| 2039 | # KATALOGNAMEN FUER ZWISCHENSPEICHERUNG VON FORTSETZUNGSLAUFDATEIEN |
---|
| 2040 | # BESTIMMEN |
---|
| 2041 | if [[ "$tmp_data_catalog" = "" ]] |
---|
| 2042 | then |
---|
[622] | 2043 | if [[ $localhost = nech ]] |
---|
[1] | 2044 | then |
---|
| 2045 | tmp_data_catalog=$WRKSHR/mrun_restart_data |
---|
| 2046 | else |
---|
| 2047 | tmp_data_catalog=/tmp/mrun_restart_data |
---|
| 2048 | fi |
---|
| 2049 | fi |
---|
| 2050 | |
---|
| 2051 | |
---|
| 2052 | # EVENTUELL BEI LOKALEN RECHNUNGEN $-ZEICHEN IN ENVIRONMENT-VARIABLEN |
---|
| 2053 | # ERSETZEN |
---|
| 2054 | if [[ $do_remote = false && $do_compile = true ]] |
---|
| 2055 | then |
---|
| 2056 | eval fopts=\"$fopts\" |
---|
| 2057 | eval lopts=\"$lopts\" |
---|
| 2058 | fi |
---|
| 2059 | |
---|
| 2060 | |
---|
| 2061 | |
---|
| 2062 | # COMPILE- UND LINK-OPTIONEN BESTIMMEN |
---|
[260] | 2063 | fopts="$fopts $netcdf_inc $dvr_inc" |
---|
| 2064 | lopts="$lopts $netcdf_lib $dvr_lib" |
---|
[1] | 2065 | ROPTS="$ropts" |
---|
[892] | 2066 | if [[ ( $(echo $host | cut -c1-3) = nec || $(echo $host | cut -c1-3) = ibm || $host = lckyoto || $host = lcsgih || $host = lcsgib || $host = lctit || $host = lcfimm || $host = lcxe6 || $host = lcxt5m || $host = lck || $host = lckordi) && -n $numprocs ]] |
---|
[1] | 2067 | then |
---|
| 2068 | XOPT="-X $numprocs" |
---|
| 2069 | fi |
---|
| 2070 | |
---|
| 2071 | |
---|
| 2072 | |
---|
| 2073 | # PRUEFEN DER CPU-ZEIT. (CPUMAX WIRD ALS ENV-VARIABLE VOM HAUTPRO- |
---|
| 2074 | # GRAMM BENOETIGT |
---|
| 2075 | done=false |
---|
| 2076 | while [[ $done = false ]] |
---|
| 2077 | do |
---|
| 2078 | cputime=$cpumax |
---|
| 2079 | if (( $cputime == 0 )) |
---|
| 2080 | then |
---|
[246] | 2081 | if [[ $do_batch = true ]] |
---|
| 2082 | then |
---|
| 2083 | printf "\n +++ cpu-time is undefined" |
---|
| 2084 | printf "\n >>> Please type CPU-time in seconds as INTEGER:" |
---|
| 2085 | printf "\n >>> " |
---|
| 2086 | read cputime 1>/dev/null 2>&1 |
---|
| 2087 | else |
---|
| 2088 | cputime=10000000 # NO CPU LIMIT FOR INTERACTIVE RUNS |
---|
| 2089 | fi |
---|
[1] | 2090 | else |
---|
| 2091 | done=true |
---|
| 2092 | fi |
---|
| 2093 | cpumax=$cputime |
---|
| 2094 | done |
---|
| 2095 | |
---|
| 2096 | (( minuten = cputime / 60 )) |
---|
| 2097 | (( sekunden = cputime - minuten * 60 )) |
---|
| 2098 | |
---|
| 2099 | |
---|
| 2100 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
| 2101 | if [[ $do_batch = true ]] |
---|
| 2102 | then |
---|
| 2103 | done=false |
---|
| 2104 | while [[ $done = false ]] |
---|
| 2105 | do |
---|
| 2106 | if (( memory == 0 )) |
---|
| 2107 | then |
---|
| 2108 | printf "\n +++ memory demand is undefined" |
---|
| 2109 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
| 2110 | printf "\n >>> " |
---|
| 2111 | read memory 1>/dev/null 2>&1 |
---|
| 2112 | else |
---|
| 2113 | done=true |
---|
| 2114 | fi |
---|
| 2115 | done |
---|
| 2116 | fi |
---|
| 2117 | |
---|
| 2118 | |
---|
| 2119 | # PRUEFEN, OB FUER REMOTE-RECHNUNGEN EIN BENUTZERNAME ANGEGEBEN WURDE |
---|
| 2120 | if [[ $do_remote = true && -z $remote_username ]] |
---|
| 2121 | then |
---|
| 2122 | while [[ -z $remote_username ]] |
---|
| 2123 | do |
---|
| 2124 | printf "\n +++ username on remote host \"$host\" is undefined" |
---|
| 2125 | printf "\n >>> Please type username:" |
---|
| 2126 | printf "\n >>> " |
---|
| 2127 | read remote_username |
---|
| 2128 | done |
---|
| 2129 | mc="$mc -u$remote_username" |
---|
| 2130 | fi |
---|
| 2131 | |
---|
[892] | 2132 | # CHECK FOR INITIAL COMMANDS AFTER LOGIN |
---|
| 2133 | if [[ "$login_init_cmd" != "" ]] |
---|
| 2134 | then |
---|
| 2135 | export init_cmds="${login_init_cmd};" |
---|
| 2136 | fi |
---|
[221] | 2137 | |
---|
[892] | 2138 | |
---|
[493] | 2139 | # set module load command and export for subjob |
---|
| 2140 | if [[ "$modules" != "" ]] |
---|
| 2141 | then |
---|
[678] | 2142 | if [[ $host = lctit ]] |
---|
| 2143 | then |
---|
| 2144 | export module_calls=". $modules" |
---|
| 2145 | else |
---|
| 2146 | export module_calls="module load ${modules};" |
---|
| 2147 | fi |
---|
[493] | 2148 | fi |
---|
| 2149 | |
---|
[683] | 2150 | # bugfix for wrong netcdf module and for netCDF4 usage in case of mpt |
---|
[562] | 2151 | if [[ $host = lcsgib || $host = lcsgih ]] |
---|
[555] | 2152 | then |
---|
| 2153 | if [[ $(echo $module_calls | grep -c netcdf/3.6.3-intel) != 0 ]] |
---|
| 2154 | then |
---|
[562] | 2155 | export module_calls="$module_calls export LD_LIBRARY_PATH=/sw/dataformats/netcdf/3.6.3-intel/lib:\$LD_LIBRARY_PATH;" |
---|
[555] | 2156 | fi |
---|
[721] | 2157 | # if [[ $(echo $module_calls | grep -c mpt) != 0 ]] |
---|
| 2158 | # then |
---|
| 2159 | # export module_calls="$module_calls export LD_LIBRARY_PATH=/sw/sgi/mpt/2011-02-07/lib:\$LD_LIBRARY_PATH;" |
---|
| 2160 | # echo "*** module_calls = $module_calls" |
---|
| 2161 | # fi |
---|
[555] | 2162 | fi |
---|
[493] | 2163 | |
---|
[555] | 2164 | |
---|
[221] | 2165 | # SET DEFAULT VALUE FOR MPI MODULE TO BE USED ON SGI-ALTIX |
---|
| 2166 | if [[ $host = lcsgib || $host = lcsgih ]] |
---|
| 2167 | then |
---|
[493] | 2168 | if [[ $(echo $modules | grep -c mpt ) != 0 ]] |
---|
| 2169 | then |
---|
| 2170 | mpilib=mpt |
---|
| 2171 | elif [[ $(echo $modules | grep -c mvapich ) != 0 ]] |
---|
| 2172 | then |
---|
| 2173 | mpilib=mvapich |
---|
[738] | 2174 | elif [[ $(echo $modules | grep -c impi ) != 0 ]] |
---|
| 2175 | then |
---|
| 2176 | mpilib=impi |
---|
[493] | 2177 | fi |
---|
[221] | 2178 | fi |
---|
| 2179 | |
---|
| 2180 | |
---|
| 2181 | |
---|
[1] | 2182 | ########################################################################### |
---|
| 2183 | # HEADER-AUSGABE |
---|
| 2184 | ########################################################################### |
---|
| 2185 | |
---|
| 2186 | |
---|
| 2187 | calltime=$(date) |
---|
| 2188 | printf "\n" |
---|
| 2189 | # [[ $silent = false ]] && clear |
---|
| 2190 | printf "#--------------------------------------------------------------# \n" |
---|
| 2191 | printf "| $version$calltime | \n" |
---|
| 2192 | printf "| | \n" |
---|
| 2193 | spalte1="called on:"; spalte2=$localhost_realname |
---|
| 2194 | printf "| $spalte1$spalte2 | \n" |
---|
| 2195 | if [[ $local_compile = false ]] |
---|
| 2196 | then |
---|
| 2197 | if [[ $do_remote = true ]] |
---|
| 2198 | then |
---|
| 2199 | spalte1="execution on:"; spalte2="$host (username: $remote_username)" |
---|
| 2200 | else |
---|
| 2201 | spalte1="execution on:"; spalte2="$host ($localhost_realname)" |
---|
| 2202 | fi |
---|
| 2203 | else |
---|
| 2204 | spalte1="compiling test only!"; spalte2="" |
---|
| 2205 | fi |
---|
| 2206 | printf "| $spalte1$spalte2 | \n" |
---|
| 2207 | if [[ -n $numprocs ]] |
---|
| 2208 | then |
---|
| 2209 | spalte1="number of PEs:"; spalte2=$numprocs |
---|
| 2210 | printf "| $spalte1$spalte2 | \n" |
---|
| 2211 | fi |
---|
| 2212 | if [[ -n $tasks_per_node ]] |
---|
| 2213 | then |
---|
| 2214 | spalte1="tasks per node:"; spalte2="$tasks_per_node (number of nodes: $nodes)" |
---|
| 2215 | printf "| $spalte1$spalte2 | \n" |
---|
| 2216 | fi |
---|
[759] | 2217 | if [[ $maximum_parallel_io_streams != $numprocs ]] |
---|
| 2218 | then |
---|
| 2219 | spalte1="max par io streams:"; spalte2="$maximum_parallel_io_streams" |
---|
| 2220 | printf "| $spalte1$spalte2 | \n" |
---|
| 2221 | fi |
---|
[622] | 2222 | if [[ $use_openmp = true ]] |
---|
[1] | 2223 | then |
---|
| 2224 | spalte1="threads per task:"; spalte2="$threads_per_task" |
---|
| 2225 | printf "| $spalte1$spalte2 | \n" |
---|
| 2226 | fi |
---|
| 2227 | printf "| | \n" |
---|
| 2228 | if [[ $do_compile = true ]] |
---|
| 2229 | then |
---|
[475] | 2230 | if [[ "$mopts" != "" ]] |
---|
| 2231 | then |
---|
[493] | 2232 | spalte1="make options:"; spalte2=$mopts |
---|
[475] | 2233 | printf "| $spalte1$spalte2 | \n" |
---|
| 2234 | zeile=$(echo "$mopts" | cut -c41-) |
---|
| 2235 | while [[ "$zeile" != "" ]] |
---|
| 2236 | do |
---|
| 2237 | spalte1="" |
---|
| 2238 | spalte2=$zeile |
---|
| 2239 | printf "| $spalte1$spalte2 | \n" |
---|
| 2240 | zeile=$(echo "$zeile" | cut -c41-) |
---|
| 2241 | done |
---|
| 2242 | fi |
---|
| 2243 | |
---|
[493] | 2244 | spalte1="cpp directives:"; spalte2=$cpp_options |
---|
[1] | 2245 | printf "| $spalte1$spalte2 | \n" |
---|
[82] | 2246 | zeile=$(echo "$cpp_options" | cut -c41-) |
---|
[1] | 2247 | while [[ "$zeile" != "" ]] |
---|
| 2248 | do |
---|
| 2249 | spalte1="" |
---|
| 2250 | spalte2=$zeile |
---|
| 2251 | printf "| $spalte1$spalte2 | \n" |
---|
| 2252 | zeile=$(echo "$zeile" | cut -c41-) |
---|
| 2253 | done |
---|
| 2254 | |
---|
[493] | 2255 | spalte1="compiler options:"; spalte2="$fopts" |
---|
[1] | 2256 | printf "| $spalte1$spalte2 | \n" |
---|
[82] | 2257 | zeile=$(echo "$fopts" | cut -c41-) |
---|
[1] | 2258 | while [[ "$zeile" != "" ]] |
---|
| 2259 | do |
---|
| 2260 | spalte1="" |
---|
| 2261 | spalte2=$zeile |
---|
| 2262 | printf "| $spalte1$spalte2 | \n" |
---|
| 2263 | zeile=$(echo "$zeile" | cut -c41-) |
---|
| 2264 | done |
---|
| 2265 | |
---|
[493] | 2266 | spalte1="linker options:"; spalte2=$lopts |
---|
[1] | 2267 | printf "| $spalte1$spalte2 | \n" |
---|
[82] | 2268 | zeile=$(echo "$lopts" | cut -c41-) |
---|
[1] | 2269 | while [[ "$zeile" != "" ]] |
---|
| 2270 | do |
---|
| 2271 | spalte1="" |
---|
| 2272 | spalte2=$zeile |
---|
| 2273 | printf "| $spalte1$spalte2 | \n" |
---|
| 2274 | zeile=$(echo "$zeile" | cut -c41-) |
---|
| 2275 | done |
---|
| 2276 | |
---|
[493] | 2277 | spalte1="modules to be load:"; spalte2=$modules |
---|
| 2278 | printf "| $spalte1$spalte2 | \n" |
---|
| 2279 | zeile=$(echo "$modules" | cut -c41-) |
---|
| 2280 | while [[ "$zeile" != "" ]] |
---|
| 2281 | do |
---|
| 2282 | spalte1="" |
---|
| 2283 | spalte2=$zeile |
---|
| 2284 | printf "| $spalte1$spalte2 | \n" |
---|
| 2285 | zeile=$(echo "$zeile" | cut -c41-) |
---|
| 2286 | done |
---|
| 2287 | |
---|
[1] | 2288 | spalte1="main program":; spalte2=$mainprog |
---|
| 2289 | printf "| $spalte1$spalte2 | \n" |
---|
| 2290 | else |
---|
| 2291 | spalte1=executable:; spalte2=$executable |
---|
| 2292 | printf "| $spalte1$spalte2 | \n" |
---|
| 2293 | fi |
---|
| 2294 | printf "| | \n" |
---|
| 2295 | spalte1="base name of files":; spalte2=$fname |
---|
| 2296 | printf "| $spalte1$spalte2 | \n" |
---|
| 2297 | if [[ $fname != $afname ]] |
---|
| 2298 | then |
---|
| 2299 | spalte1="base name of input files":; spalte2=$afname |
---|
| 2300 | printf "| $spalte1$spalte2 | \n" |
---|
| 2301 | fi |
---|
| 2302 | spalte1="INPUT control list":; spalte2=$input_list |
---|
| 2303 | printf "| $spalte1$spalte2 | \n" |
---|
| 2304 | spalte1="OUTPUT control list":; spalte2=$output_list |
---|
| 2305 | printf "| $spalte1$spalte2 | \n" |
---|
| 2306 | |
---|
| 2307 | if [[ $do_batch = true || "$LOADLBATCH" = yes ]] |
---|
| 2308 | then |
---|
| 2309 | spalte1="memory demand / PE":; spalte2="$memory MB" |
---|
| 2310 | printf "| $spalte1$spalte2 | \n" |
---|
| 2311 | spalte1=CPU-time:; spalte2="$minuten:$sekunden" |
---|
| 2312 | printf "| $spalte1$spalte2 | \n" |
---|
| 2313 | fi |
---|
| 2314 | |
---|
| 2315 | if [[ $do_compile = true ]] |
---|
| 2316 | then |
---|
| 2317 | printf "| | \n" |
---|
| 2318 | printf "| Files to be compiled: | \n" |
---|
| 2319 | zeile=$source_list |
---|
| 2320 | while [[ "$zeile" != "" ]] |
---|
| 2321 | do |
---|
| 2322 | spalte3=$zeile |
---|
| 2323 | printf "| $spalte3 | \n" |
---|
| 2324 | zeile=$(echo "$zeile" | cut -c61-) |
---|
| 2325 | done |
---|
| 2326 | fi |
---|
| 2327 | printf "#--------------------------------------------------------------#" |
---|
| 2328 | |
---|
| 2329 | |
---|
| 2330 | |
---|
| 2331 | # BEDINGTE AUSGABE DER DATEIVERBINDUNGEN |
---|
| 2332 | if [[ $do_trace = true ]] |
---|
| 2333 | then |
---|
| 2334 | (( i = 0 )) |
---|
| 2335 | while (( i < iin )) |
---|
| 2336 | do |
---|
| 2337 | (( i = i + 1 )) |
---|
| 2338 | if (( i == 1 )) |
---|
| 2339 | then |
---|
| 2340 | printf "\n\n >>> INPUT-file assignments:\n" |
---|
| 2341 | fi |
---|
| 2342 | printf "\n ${localin[$i]} : ${absnamein[$i]}" |
---|
| 2343 | done |
---|
| 2344 | (( i = 0 )) |
---|
| 2345 | while (( i < iout )) |
---|
| 2346 | do |
---|
| 2347 | (( i = i + 1 )) |
---|
| 2348 | if (( i == 1 )) |
---|
| 2349 | then |
---|
| 2350 | printf "\n\n >>> OUTPUT-file assignments:\n" |
---|
| 2351 | fi |
---|
| 2352 | printf "\n ${localout[$i]} : ${pathout[$i]}" |
---|
| 2353 | done |
---|
| 2354 | (( i = 0 )) |
---|
| 2355 | while (( i < iic )) |
---|
| 2356 | do |
---|
| 2357 | (( i = i + 1 )) |
---|
| 2358 | if (( i == 1 )) |
---|
| 2359 | then |
---|
| 2360 | printf "\n\n >>> INPUT-commands:\n" |
---|
| 2361 | fi |
---|
| 2362 | printf "\n ${in_command[$i]}" |
---|
| 2363 | done |
---|
| 2364 | (( i = 0 )) |
---|
| 2365 | while (( i < ioc )) |
---|
| 2366 | do |
---|
| 2367 | (( i = i + 1 )) |
---|
| 2368 | if (( i == 1 )) |
---|
| 2369 | then |
---|
| 2370 | printf "\n\n >>> OUTPUT-commands:\n" |
---|
| 2371 | fi |
---|
| 2372 | printf "\n ${out_command[$i]}" |
---|
| 2373 | done |
---|
| 2374 | fi |
---|
| 2375 | |
---|
| 2376 | |
---|
| 2377 | # ABFRAGEN BEI AUFRUF AUF LOKALER MASCHINE |
---|
| 2378 | if [[ $remotecall = false && $silent = false && $jobmo != BATCH ]] |
---|
| 2379 | then |
---|
| 2380 | antwort=dummy |
---|
| 2381 | printf "\n\n" |
---|
| 2382 | while [[ "$antwort" != y && "$antwort" != Y && "$antwort" != n && "$antwort" != N ]] |
---|
| 2383 | do |
---|
| 2384 | printf " >>> everything o.k. (y/n) ? " |
---|
| 2385 | read antwort |
---|
| 2386 | done |
---|
| 2387 | if [[ $antwort = n || $antwort = N ]] |
---|
| 2388 | then |
---|
| 2389 | locat=user_abort; (( iec = 0 )); exit |
---|
| 2390 | fi |
---|
| 2391 | if [[ $do_batch = true ]] |
---|
| 2392 | then |
---|
| 2393 | printf " >>> batch-job will be created and submitted" |
---|
| 2394 | else |
---|
| 2395 | if [[ $local_compile = false ]] |
---|
| 2396 | then |
---|
| 2397 | printf " >>> MRUN will now continue to execute on this machine" |
---|
| 2398 | else |
---|
| 2399 | printf " >>> a test compilation will now be carried out on this machine" |
---|
| 2400 | fi |
---|
| 2401 | fi |
---|
| 2402 | fi |
---|
| 2403 | |
---|
[807] | 2404 | #### PERFORM PARAMETER FILE CHECK (COUPLED RUNS ARE NOT SUPPORTED YET) |
---|
[841] | 2405 | |
---|
| 2406 | #DEFINE VARIABLES FOR FREQUENTLY USED DIRECTORIES |
---|
| 2407 | check_depository="${working_directory}/trunk/UTIL" |
---|
| 2408 | check_sources="${working_directory}/tmp_check_namelist_files" |
---|
[818] | 2409 | skip_check=false |
---|
[841] | 2410 | |
---|
| 2411 | #CHECK IF NAMELIST_FILE_CHECK HAS BEEN COMPILED SUCCESSFULLY |
---|
[920] | 2412 | if [[ ! -f $check_depository/check_namelist_files.tar ]] |
---|
[841] | 2413 | then |
---|
[892] | 2414 | skip_check=true |
---|
[920] | 2415 | reason="run on remote host or parameter file check has not been compiled." |
---|
| 2416 | fi |
---|
| 2417 | if [[ ! -f $PALM_BIN/check_namelist_files.x ]] |
---|
| 2418 | then |
---|
| 2419 | skip_check=true |
---|
[892] | 2420 | reason="parameter file check has not been compiled." |
---|
| 2421 | fi |
---|
[841] | 2422 | |
---|
[892] | 2423 | #CHECK FOR PARALLEL RUN; OTHERWISE SKIP CHECK |
---|
| 2424 | if [[ "$cond1" != "parallel" && "$cond2" != "parallel" ]] |
---|
| 2425 | then |
---|
| 2426 | skip_check=true |
---|
| 2427 | reason="serial run." |
---|
[841] | 2428 | fi |
---|
| 2429 | |
---|
| 2430 | #ONLY PERFORM CHECK IF -z OPTION IS NOT SET, NO RESTART RUN IS CARRIED OUT AND IF THE EXECUTION HOST IS THE LOCAL HOST |
---|
[892] | 2431 | if [[ $check_namelist_files == false ]] |
---|
[807] | 2432 | then |
---|
[892] | 2433 | skip_check=true |
---|
| 2434 | reason="-z option set." |
---|
[815] | 2435 | fi |
---|
[892] | 2436 | |
---|
| 2437 | if [[ $fromhost != $localhost ]] |
---|
[815] | 2438 | then |
---|
[892] | 2439 | skip_check=true |
---|
| 2440 | reason="submitting host is local host." |
---|
| 2441 | fi |
---|
[1] | 2442 | |
---|
[892] | 2443 | if [[ $run_coupled_model == true ]] |
---|
| 2444 | then |
---|
| 2445 | skip_check=true |
---|
| 2446 | reason="coupled run." |
---|
| 2447 | fi |
---|
[1] | 2448 | |
---|
[892] | 2449 | if [[ $restart_run == true ]] |
---|
| 2450 | then |
---|
| 2451 | skip_check=true |
---|
| 2452 | reason="restart run." |
---|
[807] | 2453 | |
---|
[892] | 2454 | fi |
---|
[807] | 2455 | |
---|
[892] | 2456 | #SKIP CHECK IN CASE OF RESTART RUN: CHECK WHETHER THE LAST CHAR IS "f" IN PARIN |
---|
[920] | 2457 | ((last_char = `echo $filename_input | wc -c` - 1)) |
---|
| 2458 | last_char=`echo $filename_input |cut -c$last_char` |
---|
[892] | 2459 | if [[ "$last_char" == "f" ]] |
---|
| 2460 | then |
---|
| 2461 | skip_check=true |
---|
| 2462 | reason="restart run.)" |
---|
| 2463 | fi |
---|
[807] | 2464 | |
---|
[892] | 2465 | if [[ $skip_check == false ]] |
---|
| 2466 | then |
---|
[807] | 2467 | |
---|
[892] | 2468 | tmp_check=${working_directory}/tmp_check |
---|
[841] | 2469 | |
---|
[818] | 2470 | # GET TOPOGRAPHY PARAMETER FILE SUFFIX (USUALLY "_P3DF"). THIS FILE MIGHT IS |
---|
| 2471 | # NOT NECESSARILY REQUIRED |
---|
| 2472 | line="" |
---|
| 2473 | found=false |
---|
[892] | 2474 | grep "TOPOGRAPHY_DATA" $config_file > $tmp_check |
---|
[818] | 2475 | while read line1 |
---|
| 2476 | do |
---|
| 2477 | line="$line1" |
---|
| 2478 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 2479 | then |
---|
| 2480 | topo_suffix=`echo $line | tr -s " " | cut -d" " -s -f5` |
---|
| 2481 | found=true |
---|
| 2482 | fi |
---|
| 2483 | done < $tmp_check |
---|
[807] | 2484 | |
---|
[818] | 2485 | if [[ $found = false ]] |
---|
| 2486 | then |
---|
| 2487 | printf "\n +++ no TOPOGRAPHY list entry found in the configuration file." |
---|
| 2488 | fi |
---|
| 2489 | |
---|
[807] | 2490 | rm -rf ${working_directory}/tmp_check |
---|
| 2491 | |
---|
| 2492 | # CHECK IF THE A P3DF FILE MUST BE CHECKED |
---|
| 2493 | for item in $input_list |
---|
| 2494 | do |
---|
[892] | 2495 | if [[ "$item" == "restart" ]] |
---|
[807] | 2496 | then |
---|
| 2497 | check_restart=1 |
---|
| 2498 | else |
---|
| 2499 | check_restart=0 |
---|
| 2500 | fi |
---|
| 2501 | done |
---|
| 2502 | |
---|
| 2503 | # ERROR IF NO PARAMETER FILE WAS FOUND, OTHERWISE PROCEED |
---|
[920] | 2504 | if [[ (! -f $filename_input) && ( "$filename_input" != "") ]] |
---|
[807] | 2505 | then |
---|
[920] | 2506 | printf "\n\n +++ ERROR: parameter file ($filename_input) not found." |
---|
[807] | 2507 | locat=check_namelist; exit |
---|
| 2508 | fi |
---|
| 2509 | |
---|
| 2510 | # CHECK IF THE RESTART PARAMETER FILE EXISTS (IF NECESSARY) |
---|
| 2511 | if [[ $check_restart == 1 ]] |
---|
| 2512 | then |
---|
[892] | 2513 | |
---|
| 2514 | |
---|
| 2515 | |
---|
[920] | 2516 | filenamef="${filename_input}f" |
---|
[892] | 2517 | if [[ ! -f $filenamef ]] |
---|
[807] | 2518 | then |
---|
[892] | 2519 | printf "\n\n +++ WARNING: restart parameter file ($filenamef) is missing." |
---|
[807] | 2520 | check_restart=0 |
---|
| 2521 | answer=dummy |
---|
| 2522 | printf "\n\n" |
---|
| 2523 | |
---|
[818] | 2524 | if [[ $silent == false ]] |
---|
[807] | 2525 | then |
---|
[818] | 2526 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
| 2527 | do |
---|
| 2528 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
| 2529 | read answer |
---|
| 2530 | done |
---|
| 2531 | if [[ $answer = a || $answer = A ]] |
---|
| 2532 | then |
---|
| 2533 | printf "\n +++ Aborting...." |
---|
| 2534 | locat=normal; exit |
---|
| 2535 | fi |
---|
[807] | 2536 | fi |
---|
| 2537 | else |
---|
| 2538 | check_restart=1 |
---|
| 2539 | fi |
---|
| 2540 | fi |
---|
| 2541 | |
---|
| 2542 | # CREATE TEMPORARY SOURCES_FOR_CHECK PATH |
---|
| 2543 | mkdir $check_sources |
---|
| 2544 | cd $check_sources |
---|
| 2545 | |
---|
[892] | 2546 | |
---|
[807] | 2547 | # CHECK FOR USER CODE, OTHERWISE USE THE PRECOMPILED CHECK_NAMELIST_FILES.X |
---|
[892] | 2548 | if [[ -d $add_source_path ]] |
---|
[807] | 2549 | then |
---|
| 2550 | printf "\n\n *** copying files from $check_depository" |
---|
| 2551 | cp $check_depository/check_namelist_files.tar ./ |
---|
| 2552 | |
---|
| 2553 | printf "\n\n *** untar of makefile and source files in $check_sources" |
---|
| 2554 | tar -xf check_namelist_files.tar > /dev/null 2>&1 |
---|
| 2555 | |
---|
| 2556 | printf "\n\n *** adding user code." |
---|
[892] | 2557 | cp $add_source_path/* ./ |
---|
[807] | 2558 | touch check_namelist_files.f90 |
---|
| 2559 | |
---|
| 2560 | # GET COMPILER OPTIONS AND PERFORM MAKE |
---|
| 2561 | printf "\n\n *** compiling code if necessary...\n" |
---|
| 2562 | copts_check="-cpp -D_parallel -D__check" |
---|
| 2563 | make -f Makefile_check F90=$compiler_name_ser COPT="$copts_check" |
---|
| 2564 | |
---|
| 2565 | # GET MAKE OUTPUT |
---|
| 2566 | if [[ $? != 0 ]] |
---|
| 2567 | then |
---|
[815] | 2568 | printf "\n +++ error during make." |
---|
| 2569 | answer=dummy |
---|
| 2570 | printf "\n\n" |
---|
[818] | 2571 | if [[ $silent == false ]] |
---|
[815] | 2572 | then |
---|
[818] | 2573 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
| 2574 | do |
---|
| 2575 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
| 2576 | read answer |
---|
| 2577 | done |
---|
| 2578 | if [[ $answer = a || $answer = A ]] |
---|
| 2579 | then |
---|
| 2580 | printf "\n +++ Aborting..." |
---|
| 2581 | rm -rf $check_sources |
---|
| 2582 | locat=normal; exit |
---|
| 2583 | else |
---|
| 2584 | skip_check=true |
---|
| 2585 | fi |
---|
[815] | 2586 | else |
---|
| 2587 | skip_check=true |
---|
| 2588 | fi |
---|
[807] | 2589 | fi |
---|
| 2590 | else |
---|
| 2591 | cp $PALM_BIN/check_namelist_files.x ./ |
---|
| 2592 | fi |
---|
| 2593 | |
---|
[920] | 2594 | cp $filename_input ./PARIN |
---|
[807] | 2595 | if [[ $check_restart == 1 ]] |
---|
| 2596 | then |
---|
[892] | 2597 | cp $filenamef ./PARINF |
---|
[807] | 2598 | fi |
---|
| 2599 | |
---|
[892] | 2600 | if [[ -f ${pathname}/${fname}${topo_suffix} && $skip_check == false ]] |
---|
[818] | 2601 | then |
---|
| 2602 | printf "\n *** adding topography data" |
---|
[892] | 2603 | cp ${pathname}/${fname}${topo_suffix} ./TOPOGRAPHY_DATA |
---|
[818] | 2604 | |
---|
| 2605 | # IN CASE OF TOPOGRAPHY AND HIGH GRID POINT NUMBERS, THE STACK SIZE |
---|
| 2606 | # MUST BE INCREASED. THIS IS DUE TO THE ARRAY nzb_local AND topo_height, |
---|
| 2607 | # WHICH REQUIRE SUFFICIENT MEMORY |
---|
| 2608 | ulimit -s unlimited |
---|
| 2609 | fi |
---|
| 2610 | |
---|
[807] | 2611 | # CREATE ENVPAR FILE, WHICH IS NEEDED BY CHECK_NAMELIST_FILES.X |
---|
| 2612 | cat > ENVPAR << %%END%% |
---|
[823] | 2613 | &envpar run_identifier = '$fname', host = '$host', |
---|
[807] | 2614 | write_binary = '$write_binary', tasks_per_node = $tasks_per_node, |
---|
| 2615 | maximum_parallel_io_streams = $maximum_parallel_io_streams, |
---|
| 2616 | maximum_cpu_time_allowed = ${cpumax}., |
---|
| 2617 | revision = '$global_revision', |
---|
| 2618 | local_dvrserver_running = $local_dvrserver_running / |
---|
| 2619 | |
---|
| 2620 | %%END%% |
---|
| 2621 | |
---|
| 2622 | # SAFETY CHECK: ONLY PROCEED IF THE PARAMETER CHECK PROGRAM WAS PROPERLY COMPILED |
---|
[818] | 2623 | if [[ ! -f check_namelist_files.x && $skip_check == false ]] then |
---|
[807] | 2624 | printf "\n +++ WARNING: check_namelist_files.x not found." |
---|
| 2625 | answer=dummy |
---|
| 2626 | printf "\n\n" |
---|
[818] | 2627 | |
---|
| 2628 | if [[ $silent == false ]] |
---|
[807] | 2629 | then |
---|
[818] | 2630 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
| 2631 | do |
---|
| 2632 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
| 2633 | read answer |
---|
| 2634 | done |
---|
| 2635 | if [[ $answer = a || $answer = A ]] |
---|
| 2636 | then |
---|
| 2637 | printf "\n +++ Aborting..." |
---|
| 2638 | rm -rf $check_sources |
---|
| 2639 | locat=normal; exit |
---|
| 2640 | else |
---|
| 2641 | printf "\n *** Skipping parameter file check." |
---|
| 2642 | |
---|
| 2643 | fi |
---|
| 2644 | fi |
---|
| 2645 | |
---|
[815] | 2646 | elif [[ $skip_check == false ]] |
---|
| 2647 | then |
---|
[807] | 2648 | # STARTING THE PARAMETER FILE CHECK |
---|
| 2649 | printf "\n\n *** starting parameter file check..." |
---|
| 2650 | |
---|
| 2651 | # CHECKING THE P3D FILE |
---|
[920] | 2652 | printf "\n\n (1) checking $filename_input" |
---|
[931] | 2653 | echo "$numprocs 0 0" > VARIN |
---|
[807] | 2654 | errors=`./check_namelist_files.x < VARIN 2>&1` |
---|
| 2655 | |
---|
| 2656 | check_error=false |
---|
| 2657 | if [[ "$errors" == "" ]] |
---|
| 2658 | then |
---|
| 2659 | printf " --> o.k." |
---|
| 2660 | else |
---|
| 2661 | printf " --> failed." |
---|
| 2662 | check_error=true |
---|
| 2663 | printf "\n\n $errors" |
---|
| 2664 | fi |
---|
| 2665 | |
---|
| 2666 | # CHECKING THE PD3F FILE IF NECESSARY |
---|
| 2667 | if [[ $check_restart == 1 && $check_error == false ]] |
---|
| 2668 | then |
---|
[892] | 2669 | printf "\n\n (2) checking $filenamef" |
---|
[807] | 2670 | |
---|
| 2671 | # FIRST CHECK IF INITIALIZING_ACTIONS="READ_RESTART_DATA" IS SET IN &INIPAR LIST |
---|
| 2672 | found=false |
---|
| 2673 | cat PARINF|while read line |
---|
| 2674 | do |
---|
| 2675 | line=$(echo $line|sed 's/ //g') |
---|
| 2676 | if [[ $line == *"&inipar"* ]] |
---|
| 2677 | then |
---|
| 2678 | start_search=true |
---|
| 2679 | fi |
---|
| 2680 | |
---|
| 2681 | if [[ $start_search == true ]] |
---|
| 2682 | then |
---|
| 2683 | if [[ $line == *"initializing_actions='read_restart_data'"* ]] |
---|
| 2684 | then |
---|
| 2685 | found=true |
---|
| 2686 | break |
---|
| 2687 | fi |
---|
| 2688 | fi |
---|
| 2689 | |
---|
| 2690 | if [[ $line == *"/"* ]] |
---|
| 2691 | then |
---|
| 2692 | start_search=false |
---|
| 2693 | fi |
---|
| 2694 | |
---|
| 2695 | done |
---|
| 2696 | |
---|
| 2697 | if [[ $found = false ]] |
---|
| 2698 | then |
---|
| 2699 | printf "\n\n +++ ERROR: initializing_actions = 'read_restart_data' not found" |
---|
| 2700 | printf "\n in &inipar list in $fname$p3df_suffix." |
---|
| 2701 | rm -rf $check_sources |
---|
| 2702 | locat=check_namelist; exit |
---|
| 2703 | fi |
---|
| 2704 | |
---|
[931] | 2705 | # READ max_user_pr FROM FILES |
---|
| 2706 | if [[ -f parin_for_check ]] |
---|
| 2707 | then |
---|
| 2708 | read max_pr_user < parin_for_check |
---|
| 2709 | else |
---|
| 2710 | max_user_pr=0 |
---|
| 2711 | fi |
---|
| 2712 | |
---|
| 2713 | echo "$numprocs 1 $max_pr_user" > VARIN |
---|
[807] | 2714 | errors=`./check_namelist_files.x < VARIN 2>&1` |
---|
| 2715 | |
---|
| 2716 | if [[ "$errors" == "" ]] |
---|
| 2717 | then |
---|
| 2718 | printf " --> o.k." |
---|
| 2719 | else |
---|
| 2720 | printf " --> failed." |
---|
| 2721 | check_error=true |
---|
| 2722 | printf "\n\n $errors" |
---|
| 2723 | fi |
---|
| 2724 | fi |
---|
| 2725 | |
---|
| 2726 | # REPORT ERRORS AND CONTINUE/EXIT |
---|
| 2727 | if [[ $check_error == true ]] |
---|
| 2728 | then |
---|
| 2729 | printf "\n +++ errors found in the parameter file!\n" |
---|
| 2730 | answer=dummy |
---|
| 2731 | printf "\n\n" |
---|
| 2732 | |
---|
| 2733 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
| 2734 | do |
---|
| 2735 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
| 2736 | read answer |
---|
| 2737 | done |
---|
| 2738 | |
---|
| 2739 | if [[ $answer = a || $answer = A ]] |
---|
| 2740 | then |
---|
| 2741 | printf "\n +++ Aborting..." |
---|
| 2742 | rm -rf $check_sources |
---|
| 2743 | locat=normal; exit |
---|
| 2744 | fi |
---|
| 2745 | else |
---|
| 2746 | printf "\n\n *** parameter file(s) seem(s) to be o.k.\n" |
---|
| 2747 | fi |
---|
| 2748 | rm -rf $check_sources |
---|
| 2749 | fi |
---|
| 2750 | else |
---|
[892] | 2751 | printf "\n\n +++ skipping parameter file check due to following reason: $reason" |
---|
[807] | 2752 | fi |
---|
| 2753 | |
---|
[818] | 2754 | # DELETE TEMPORARY DIRECTORY AND FINISH NAMELIST FILE CHECK |
---|
| 2755 | rm -rf $check_sources |
---|
[807] | 2756 | cd $working_directory |
---|
| 2757 | |
---|
[892] | 2758 | |
---|
[807] | 2759 | # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- |
---|
| 2760 | # CHENDE AKTIONEN DURCHGEFUEHRT |
---|
[1] | 2761 | if [[ $do_batch = false ]] |
---|
| 2762 | then |
---|
| 2763 | |
---|
| 2764 | |
---|
| 2765 | # TEMPORAEREN KATALOG ERZEUGEN |
---|
| 2766 | mkdir -p $TEMPDIR |
---|
| 2767 | chmod go+rx $TEMPDIR |
---|
| 2768 | tmpcreate=true |
---|
| 2769 | |
---|
[493] | 2770 | # set striping on lustre file system |
---|
| 2771 | # if [[ $localhost = lcsgih ]] |
---|
| 2772 | # then |
---|
| 2773 | # lfs setstripe -s 8192k -c 16 $TEMPDIR |
---|
| 2774 | # lfs getstripe $TEMPDIR |
---|
| 2775 | # fi |
---|
[1] | 2776 | |
---|
[493] | 2777 | |
---|
[1] | 2778 | # SAEMTLICHE QUELLTEXT-DATEIEN BZW. AUSFUEHRBARES PROGRAMM IN |
---|
| 2779 | # TEMPORAERES VERZEICHNIS KOPIEREN |
---|
| 2780 | if [[ $do_compile = true ]] |
---|
| 2781 | then |
---|
| 2782 | |
---|
| 2783 | # ON NEC, COMPILATION IS DONE ON HOST CROSS VIA CROSS COMPILING |
---|
| 2784 | # CREATE A TEMPORARY DIRECTORY ON THAT MACHINE (HOME MOUNTED VIA NFS) |
---|
| 2785 | if [[ $localhost = nech ]] |
---|
| 2786 | then |
---|
| 2787 | TEMPDIR_COMPILE=$HOME/work/${usern}.$kennung |
---|
| 2788 | if mkdir -p $TEMPDIR_COMPILE |
---|
| 2789 | then |
---|
| 2790 | printf "\n *** \"$TEMPDIR_COMPILE\" " |
---|
| 2791 | printf "\n is generated as temporary directory for cross compiling\n" |
---|
| 2792 | else |
---|
| 2793 | printf "\n +++ creating directory \"$TEMPDIR_COMPILE\" " |
---|
| 2794 | printf "\n needed for cross compilation failed" |
---|
| 2795 | locat=compile |
---|
| 2796 | exit |
---|
| 2797 | fi |
---|
| 2798 | else |
---|
| 2799 | TEMPDIR_COMPILE=$TEMPDIR |
---|
| 2800 | fi |
---|
| 2801 | |
---|
| 2802 | |
---|
[82] | 2803 | # PFADNAMEN FUER DAS MAKE-DEPOSITORY ERMITTELN |
---|
| 2804 | line="" |
---|
| 2805 | grep "%depository_path" $config_file > tmp_mrun |
---|
| 2806 | while read line |
---|
| 2807 | do |
---|
| 2808 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 2809 | then |
---|
| 2810 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
[1] | 2811 | then |
---|
[82] | 2812 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
[1] | 2813 | fi |
---|
[82] | 2814 | fi |
---|
| 2815 | done < tmp_mrun |
---|
[1] | 2816 | |
---|
[82] | 2817 | line="" |
---|
| 2818 | grep " $localhost" $config_file | grep "%depository_path" > tmp_mrun |
---|
| 2819 | while read line |
---|
| 2820 | do |
---|
| 2821 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 2822 | then |
---|
[211] | 2823 | if [[ "$(echo $line | cut -d" " -s -f4)" = "$cond1" && "$(echo $line | cut -d" " -s -f5)" = "$cond2" ]] |
---|
| 2824 | then |
---|
| 2825 | local_depository_path=`echo $line | cut -d" " -s -f2` |
---|
| 2826 | fi |
---|
[1] | 2827 | fi |
---|
[82] | 2828 | done < tmp_mrun |
---|
[1] | 2829 | |
---|
[82] | 2830 | if [[ "$local_depository_path" = "" ]] |
---|
| 2831 | then |
---|
| 2832 | if [[ "$global_depository_path" != "" ]] |
---|
[1] | 2833 | then |
---|
[82] | 2834 | local_depository_path=$global_depository_path |
---|
[1] | 2835 | else |
---|
[82] | 2836 | printf "\n\n +++ no depository path found in configuration file" |
---|
| 2837 | printf "\n for local host \"$localhost\" " |
---|
| 2838 | printf "\n please set \"\%depository_path\" in configuration file\n" |
---|
| 2839 | locat=config_file; exit |
---|
[1] | 2840 | fi |
---|
[82] | 2841 | fi |
---|
| 2842 | eval local_depository_path=$local_depository_path |
---|
[215] | 2843 | [[ "$cond1" != "" ]] && local_depository_path=${local_depository_path}_$cond1 |
---|
| 2844 | [[ "$cond2" != "" ]] && local_depository_path=${local_depository_path}_$cond2 |
---|
[1] | 2845 | |
---|
[215] | 2846 | |
---|
[82] | 2847 | basename=`print $mainprog | cut -f1 -d"."` |
---|
| 2848 | eval make_depository=${local_depository_path}/${basename}_current_version.tar |
---|
| 2849 | if [[ ! -f $make_depository ]] |
---|
| 2850 | then |
---|
| 2851 | printf "\n" |
---|
| 2852 | printf "\n *** WARNING: make depository \"$make_depository\" not found" |
---|
| 2853 | printf "\n \"make\" will fail, if the Makefile or other source files are missing\n" |
---|
| 2854 | else |
---|
| 2855 | cp $make_depository $TEMPDIR_COMPILE |
---|
[1] | 2856 | cd $TEMPDIR_COMPILE |
---|
[82] | 2857 | tar -xf $make_depository > /dev/null 2>&1 |
---|
[1] | 2858 | cd - > /dev/null |
---|
| 2859 | fi |
---|
[82] | 2860 | |
---|
| 2861 | cp SOURCES_FOR_RUN_$fname/* $TEMPDIR_COMPILE |
---|
| 2862 | |
---|
[1] | 2863 | else |
---|
[475] | 2864 | |
---|
[1] | 2865 | cp $executable ${TEMPDIR}/a.out |
---|
[475] | 2866 | |
---|
[1] | 2867 | fi |
---|
| 2868 | |
---|
| 2869 | |
---|
| 2870 | # WECHSEL IN TEMPORAEREN KATALOG |
---|
[475] | 2871 | cd $TEMPDIR |
---|
[1] | 2872 | printf "\n *** changed to temporary directory: $TEMPDIR" |
---|
| 2873 | |
---|
| 2874 | |
---|
| 2875 | # OUTPUT-DATEI-VERBINDUNGEN AUF TEMPORAERER DATEI ABLEGEN |
---|
| 2876 | # DIESE DATEI KANN VON SPAETER AUFZURUFENDEN BENUTZERPROZEDUREN GELESEN |
---|
| 2877 | # WERDEN, UM ZU LOKALEN DATEINAMEN GEHOERENDE PERMANENTE NAMEN ZU |
---|
| 2878 | # ERMITTELN |
---|
| 2879 | (( i = 0 )) |
---|
| 2880 | while (( i < iout )) |
---|
| 2881 | do |
---|
| 2882 | (( i = i + 1 )) |
---|
| 2883 | if [[ "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ]] |
---|
| 2884 | then |
---|
| 2885 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${localhost}_${fname}${endout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
| 2886 | else |
---|
| 2887 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${frelout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
| 2888 | fi |
---|
| 2889 | done |
---|
| 2890 | |
---|
| 2891 | |
---|
| 2892 | # EVTL. UEBERSETZUNGSAKTIONEN STARTEN |
---|
| 2893 | if [[ $do_compile = true ]] |
---|
| 2894 | then |
---|
| 2895 | |
---|
| 2896 | |
---|
| 2897 | # COMPILING WITH MAKE (ON NEC COMPILER IS CALLED ON HOST CROSS) |
---|
[82] | 2898 | printf "\n\n\n *** compilation starts \n$striche\n" |
---|
| 2899 | printf " *** compilation with make using following options:\n" |
---|
[211] | 2900 | printf " make depository: $make_depository" |
---|
[475] | 2901 | if [[ "$mopts" != "" ]] |
---|
| 2902 | then |
---|
| 2903 | printf " make options: $mopts\n" |
---|
| 2904 | fi |
---|
[82] | 2905 | printf " compilername: $compiler_name\n" |
---|
[475] | 2906 | printf " compiler options: $fopts\n" |
---|
[493] | 2907 | printf " preprocessor directives: $cpp_options \n" |
---|
| 2908 | printf " linker options: $lopts \n" |
---|
| 2909 | if [[ "$modules" != "" ]] |
---|
| 2910 | then |
---|
| 2911 | printf " modules to be load: $modules \n" |
---|
| 2912 | fi |
---|
[82] | 2913 | printf " source code files: $source_list \n" |
---|
| 2914 | |
---|
| 2915 | if [[ $localhost = nech ]] |
---|
[1] | 2916 | then |
---|
[892] | 2917 | # init_cmds was ". /SX/opt/etc/initsx.sh;" |
---|
| 2918 | ssh 136.172.44.192 -l $usern "$init_cmds $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
[82] | 2919 | cp $TEMPDIR_COMPILE/a.out . |
---|
| 2920 | [[ $? != 0 ]] && compile_error=true |
---|
| 2921 | rm -rf $TEMPDIR_COMPILE |
---|
[312] | 2922 | elif [[ $localhost = ibmh ]] |
---|
| 2923 | then |
---|
[325] | 2924 | printf " compiler is called via ssh on \"plogin1\" \n" |
---|
[892] | 2925 | ssh plogin1 -l $usern "$init_cmds export PATH=/sw/ibm/xlf/13.1.0.8/usr/bin:$PATH; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
[312] | 2926 | [[ ! -f a.out ]] && compile_error=true |
---|
| 2927 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
[197] | 2928 | elif [[ $localhost = lcsgib ]] |
---|
| 2929 | then |
---|
[540] | 2930 | printf " compiler is called via ssh on \"bicegate0\" \n" |
---|
[892] | 2931 | ssh bicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
[197] | 2932 | [[ ! -f a.out ]] && compile_error=true |
---|
| 2933 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
| 2934 | elif [[ $localhost = lcsgih ]] |
---|
| 2935 | then |
---|
[738] | 2936 | printf " compiler is called via ssh on \"hicegate0\" \n" |
---|
[892] | 2937 | ssh hicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" 2>&1 " |
---|
[197] | 2938 | [[ ! -f a.out ]] && compile_error=true |
---|
| 2939 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
[755] | 2940 | elif [[ $localhost = lcflow ]] |
---|
| 2941 | then |
---|
| 2942 | printf " compiler is called via ssh on \"flow\" \n" |
---|
[892] | 2943 | ssh flow02.hpc.uni-oldenburg.de -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
[755] | 2944 | [[ ! -f a.out ]] && compile_error=true |
---|
| 2945 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
[1] | 2946 | else |
---|
[920] | 2947 | [[ "$init_cmds" != "" ]] && eval $init_cmds |
---|
[493] | 2948 | [[ "$module_calls" != "" ]] && eval $module_calls |
---|
[475] | 2949 | make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" |
---|
[807] | 2950 | |
---|
[82] | 2951 | fi |
---|
[1] | 2952 | |
---|
| 2953 | if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] |
---|
| 2954 | then |
---|
| 2955 | printf "\n +++ error occured while compiling or linking" |
---|
| 2956 | locat=compile |
---|
[181] | 2957 | |
---|
[182] | 2958 | # WORKAROUND: REMOVE IF CONSTRUCT LATER, BUT KEEP THE EXIT! |
---|
[197] | 2959 | # if [[ $localhost != lcsgib && $localhost != lcsgih ]] |
---|
| 2960 | # then |
---|
[181] | 2961 | exit |
---|
[197] | 2962 | # else |
---|
| 2963 | # locat=normal |
---|
| 2964 | # fi |
---|
[1] | 2965 | else |
---|
| 2966 | printf "$striche\n *** compilation finished \n" |
---|
| 2967 | fi |
---|
| 2968 | fi |
---|
| 2969 | |
---|
| 2970 | |
---|
| 2971 | # FALLS NUR TESTWEISE KOMPILIERT WERDEN SOLLTE, IST MRUN JETZT FERTIG |
---|
| 2972 | if [[ $local_compile = true ]] |
---|
| 2973 | then |
---|
| 2974 | cd $HOME |
---|
| 2975 | rm -rf $TEMPDIR |
---|
| 2976 | locat=local_compile; exit |
---|
| 2977 | fi |
---|
| 2978 | |
---|
| 2979 | |
---|
| 2980 | # BEREITSTELLEN DER INPUT-DATEIEN |
---|
| 2981 | # SCHLEIFE UEBER ALLE VOM BENUTZER ANGEGEBENEN DATEIEN |
---|
| 2982 | (( i = 0 )) |
---|
| 2983 | while (( i < iin )) |
---|
| 2984 | do |
---|
| 2985 | (( i = i + 1 )) |
---|
| 2986 | if (( i == 1 )) |
---|
| 2987 | then |
---|
| 2988 | printf "\n\n *** providing INPUT-files:\n$striche" |
---|
| 2989 | fi |
---|
| 2990 | |
---|
| 2991 | |
---|
| 2992 | # OPTIONALE DATEIEN BEI NICHTVORHANDENSEIN UEBERGEHEN |
---|
| 2993 | if [[ "${transin[$i]}" = unavailable ]] |
---|
| 2994 | then |
---|
| 2995 | if [[ "${extin[$i]}" = "" || "${extin[$i]}" = " " ]] |
---|
| 2996 | then |
---|
| 2997 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}\" " |
---|
| 2998 | printf "\n is not available!" |
---|
| 2999 | else |
---|
| 3000 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}.${extin[$i]}\" " |
---|
| 3001 | printf "\n is not available!" |
---|
| 3002 | fi |
---|
| 3003 | continue |
---|
| 3004 | fi |
---|
| 3005 | |
---|
| 3006 | # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR |
---|
| 3007 | files_for_pes=false; datentyp=file |
---|
| 3008 | if [[ "${actionin[$i]}" = pe && -n $numprocs ]] |
---|
| 3009 | then |
---|
| 3010 | files_for_pes=true; datentyp=directory |
---|
| 3011 | actionin[$i]="" |
---|
| 3012 | elif [[ "${actionin[$i]}" = pe && ! -n $numprocs ]] |
---|
| 3013 | then |
---|
| 3014 | actionin[$i]="" |
---|
| 3015 | elif [[ "${actionin[$i]}" = arpe && -n $numprocs ]] |
---|
| 3016 | then |
---|
| 3017 | files_for_pes=true; datentyp=directory |
---|
| 3018 | actionin[$i]="ar" |
---|
| 3019 | elif [[ "${actionin[$i]}" = arpe && ! -n $numprocs ]] |
---|
| 3020 | then |
---|
| 3021 | actionin[$i]="ar" |
---|
| 3022 | elif [[ "${actionin[$i]}" = flpe && -n $numprocs ]] |
---|
| 3023 | then |
---|
| 3024 | files_for_pes=true; datentyp=directory |
---|
| 3025 | actionin[$i]="fl" |
---|
| 3026 | elif [[ "${actionin[$i]}" = flpe && ! -n $numprocs ]] |
---|
| 3027 | then |
---|
| 3028 | actionin[$i]="fl" |
---|
| 3029 | fi |
---|
| 3030 | |
---|
| 3031 | if [[ $files_for_pes = true ]] |
---|
| 3032 | then |
---|
| 3033 | printf "\n >>> INPUT: ${absnamein[$i]}/.... to ${localin[$i]}" |
---|
| 3034 | else |
---|
| 3035 | printf "\n >>> INPUT: ${absnamein[$i]} to ${localin[$i]}" |
---|
| 3036 | fi |
---|
| 3037 | |
---|
| 3038 | # INPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. ES WIRD GEPRUEFT, |
---|
| 3039 | # OB DIESE DATEI NOCH AUF DEM TEMPORAEREN DATENKATALOG VORHANDEN |
---|
| 3040 | # IST. FALLS NICHT, WIRD VERSUCHT, SIE ANSCHLIESSEND VOM ARCHIV- |
---|
| 3041 | # SERVER ZU HOLEN |
---|
| 3042 | if [[ "${actionin[$i]}" = fl ]] |
---|
| 3043 | then |
---|
| 3044 | printf "\n $datentyp will be fetched from temporary directory \"${tmp_data_catalog}\" !" |
---|
| 3045 | if [[ $files_for_pes = false ]] |
---|
| 3046 | then |
---|
| 3047 | if [[ -f "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
| 3048 | then |
---|
| 3049 | ln $tmp_data_catalog/${frelin[$i]} ${localin[$i]} |
---|
| 3050 | got_tmp[$i]=true |
---|
| 3051 | elif [[ -f "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
| 3052 | then |
---|
| 3053 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
| 3054 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
| 3055 | cp $WORK/${frelin[$i]} ${localin[$i]} |
---|
| 3056 | else |
---|
| 3057 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
| 3058 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
| 3059 | printf "\n *** trying to get copy from archive" |
---|
| 3060 | actionin[$i]=ar |
---|
| 3061 | fi |
---|
| 3062 | else |
---|
| 3063 | if [[ -d "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
| 3064 | then |
---|
| 3065 | mkdir ${localin[$i]} |
---|
[149] | 3066 | cd $tmp_data_catalog/${frelin[$i]} |
---|
| 3067 | for file in $(ls *) |
---|
| 3068 | do |
---|
| 3069 | ln $file $TEMPDIR/${localin[$i]} |
---|
| 3070 | done |
---|
| 3071 | cd $TEMPDIR |
---|
[1] | 3072 | got_tmp[$i]=true |
---|
| 3073 | elif [[ -d "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
| 3074 | then |
---|
| 3075 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
| 3076 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
| 3077 | cp -r $WORK/${frelin[$i]} ${localin[$i]} |
---|
| 3078 | else |
---|
| 3079 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
| 3080 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
| 3081 | printf "\n *** trying to get copy from archive" |
---|
| 3082 | actionin[$i]=ar |
---|
| 3083 | fi |
---|
| 3084 | fi |
---|
| 3085 | fi |
---|
| 3086 | |
---|
| 3087 | |
---|
| 3088 | # DATEI LIEGT AUF ARCHIV-SERVER |
---|
| 3089 | if [[ "${actionin[$i]}" = ar ]] |
---|
| 3090 | then |
---|
| 3091 | |
---|
| 3092 | if [[ $files_for_pes = false ]] |
---|
| 3093 | then |
---|
| 3094 | printf "\n file will be restored from archive-system ($archive_system)!" |
---|
| 3095 | else |
---|
| 3096 | printf "\n directory will be restored from archive-system ($archive_system)!" |
---|
| 3097 | fi |
---|
| 3098 | |
---|
| 3099 | file_restored=false |
---|
| 3100 | |
---|
| 3101 | if [[ $archive_system = asterix ]] |
---|
| 3102 | then |
---|
| 3103 | do_stagein=true |
---|
| 3104 | (( stagein_anz = 0 )) |
---|
| 3105 | while [[ $do_stagein = true ]] |
---|
| 3106 | do |
---|
| 3107 | if [[ $files_for_pes = false ]] |
---|
| 3108 | then |
---|
| 3109 | stagein -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
| 3110 | else |
---|
| 3111 | stagein -t -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
| 3112 | fi |
---|
| 3113 | cat STAGEIN_OUTPUT |
---|
| 3114 | if [[ $(grep -c "st.msg:i24" STAGEIN_OUTPUT) != 0 ]] |
---|
| 3115 | then |
---|
| 3116 | file_restored=true |
---|
| 3117 | do_stagein=false |
---|
| 3118 | else |
---|
| 3119 | (( stagein_anz = stagein_anz + 1 )) |
---|
| 3120 | if (( stagein_anz == 10 )) |
---|
| 3121 | then |
---|
| 3122 | printf "\n +++ stagein stoped after 10 tries" |
---|
| 3123 | locat=stage |
---|
| 3124 | exit |
---|
| 3125 | fi |
---|
| 3126 | printf "\n +++ restoring from archive failed, trying again:" |
---|
| 3127 | sleep 900 |
---|
| 3128 | fi |
---|
| 3129 | done |
---|
| 3130 | elif [[ $archive_system = DMF ]] |
---|
| 3131 | then |
---|
| 3132 | if [[ $files_for_pes = false ]] |
---|
| 3133 | then |
---|
| 3134 | printf "\n +++ restoring of single files impossible with $archive_system !\n" |
---|
| 3135 | locat=DMF |
---|
| 3136 | exit |
---|
| 3137 | else |
---|
| 3138 | find $ARCHIVE/${frelin[$i]} -type m -print | dmget |
---|
| 3139 | cp -r $ARCHIVE/${frelin[$i]} $PWD |
---|
| 3140 | file_restored=true |
---|
| 3141 | fi |
---|
| 3142 | elif [[ $archive_system = tivoli ]] |
---|
| 3143 | then |
---|
| 3144 | if [[ $files_for_pes = false ]] |
---|
| 3145 | then |
---|
[399] | 3146 | if [[ $localhost = lcsgih ]] |
---|
[1] | 3147 | then |
---|
[399] | 3148 | ssh $usern@hicedata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" |
---|
[1] | 3149 | else |
---|
[399] | 3150 | ssh $usern@bicedata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" |
---|
[1] | 3151 | fi |
---|
| 3152 | else |
---|
| 3153 | (( inode = 0 )) |
---|
| 3154 | while (( inode < nodes )) |
---|
| 3155 | do |
---|
[399] | 3156 | if [[ $localhost = lcsgih ]] |
---|
[1] | 3157 | then |
---|
[399] | 3158 | ssh $usern@hicedata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" |
---|
[1] | 3159 | else |
---|
[399] | 3160 | ssh $usern@bicedata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" |
---|
[1] | 3161 | fi |
---|
| 3162 | (( inode = inode + 1 )) |
---|
| 3163 | done |
---|
| 3164 | fi |
---|
| 3165 | file_restored=true |
---|
| 3166 | elif [[ $archive_system = ut ]] |
---|
| 3167 | then |
---|
| 3168 | if [[ $files_for_pes = false ]] |
---|
| 3169 | then |
---|
| 3170 | cp $UT/${frelin[$i]} . |
---|
| 3171 | else |
---|
| 3172 | (( inode = 0 )) |
---|
| 3173 | while (( inode < nodes )) |
---|
| 3174 | do |
---|
| 3175 | tar xf $UT/${frelin[$i]}/${frelin[$i]}.node_$inode.tar |
---|
| 3176 | (( inode = inode + 1 )) |
---|
| 3177 | done |
---|
| 3178 | fi |
---|
| 3179 | file_restored=true |
---|
| 3180 | else |
---|
| 3181 | printf "\n +++ archive_system=\"$archive_system\" restore impossible!" |
---|
| 3182 | locat=rearchive |
---|
| 3183 | exit |
---|
| 3184 | fi |
---|
| 3185 | |
---|
| 3186 | if [[ $file_restored = true ]] |
---|
| 3187 | then |
---|
| 3188 | |
---|
| 3189 | # DATEI AUCH AUF TEMPORAERES DATENVERZEICHNIS LEGEN, DAMIT |
---|
| 3190 | # SIE BEI WEITEREN ZUGRIFFEN NOCH VORHANDEN IST |
---|
| 3191 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog; chmod g+rx $tmp_data_catalog |
---|
| 3192 | if [[ $files_for_pes = false ]] |
---|
| 3193 | then |
---|
| 3194 | ln -f ${frelin[$i]} $tmp_data_catalog/${frelin[$i]} |
---|
| 3195 | else |
---|
| 3196 | mkdir $tmp_data_catalog/${frelin[$i]} |
---|
| 3197 | ln -f ${frelin[$i]}/* $tmp_data_catalog/${frelin[$i]} |
---|
| 3198 | fi |
---|
| 3199 | got_tmp[$i]=true |
---|
| 3200 | |
---|
| 3201 | # DATEI UNTER LOKALEM NAMEN ZUR VERFUEGUNG STELLEN |
---|
| 3202 | mv ${frelin[$i]} ${localin[$i]} |
---|
| 3203 | |
---|
| 3204 | fi |
---|
| 3205 | fi |
---|
| 3206 | |
---|
| 3207 | |
---|
| 3208 | # DATEI LIEGT IM VOM BENUTZER ANGEGEBENEN VERZEICHNIS |
---|
| 3209 | if [[ "${actionin[$i]}" = "" || "${actionin[$i]}" = "di" || "${actionin[$i]}" = "npe" ]] |
---|
| 3210 | then |
---|
| 3211 | |
---|
| 3212 | if [[ "${actionin[$i]}" = "npe" && -n $numprocs ]] |
---|
| 3213 | then |
---|
| 3214 | |
---|
| 3215 | # DATEI WIRD FUER DIE PROZESSOREN EINES PARALLERECHNERS BEREITGESTELLT |
---|
| 3216 | printf "\n file will be provided for $numprocs processors" |
---|
| 3217 | mkdir ${localin[$i]} |
---|
| 3218 | ival=$numprocs |
---|
| 3219 | (( ii = 0 )) |
---|
| 3220 | while (( ii <= ival-1 )) |
---|
| 3221 | do |
---|
| 3222 | if (( ii < 10 )) |
---|
| 3223 | then |
---|
| 3224 | cp ${absnamein[$i]} ${localin[$i]}/_000$ii |
---|
| 3225 | elif (( ii < 100 )) |
---|
| 3226 | then |
---|
| 3227 | cp ${absnamein[$i]} ${localin[$i]}/_00$ii |
---|
| 3228 | elif (( ii < 1000 )) |
---|
| 3229 | then |
---|
| 3230 | cp ${absnamein[$i]} ${localin[$i]}/_0$ii |
---|
| 3231 | else |
---|
| 3232 | cp ${absnamein[$i]} ${localin[$i]}/_$ii |
---|
| 3233 | fi |
---|
| 3234 | (( ii = ii + 1 )) |
---|
| 3235 | done |
---|
| 3236 | |
---|
| 3237 | else |
---|
| 3238 | |
---|
| 3239 | if [[ $files_for_pes = true ]] |
---|
| 3240 | then |
---|
| 3241 | |
---|
| 3242 | # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN |
---|
| 3243 | # DATEIEN WERDEN BEREITGESTELLT, INDEM ZUERST DER GESAMTE |
---|
| 3244 | # KATALOGINHALT KOPIERT UND DANN DIE EINZELNEN DATEIEN |
---|
| 3245 | # PER MOVE UMBENANNT WERDEN |
---|
| 3246 | printf "\n providing $numprocs files for the respective processors" |
---|
| 3247 | mkdir ${localin[$i]} |
---|
[183] | 3248 | if [[ $link_local_input = true ]] |
---|
| 3249 | then |
---|
| 3250 | printf " using ln -f\n" |
---|
| 3251 | cd ${absnamein[$i]} |
---|
| 3252 | for file in $(ls *) |
---|
| 3253 | do |
---|
| 3254 | ln -f $file ${localin[$i]} |
---|
| 3255 | done |
---|
| 3256 | cd $TEMPDIR |
---|
| 3257 | fi |
---|
| 3258 | # If "ln -f" fails of if "$link_local_input = false" do a normal "cp -r" |
---|
| 3259 | if [[ ! -f "${localin[$i]}/_0000" ]] |
---|
| 3260 | then |
---|
| 3261 | if [[ $link_local_input = true ]] |
---|
| 3262 | then |
---|
| 3263 | printf " ln failed for .../_0000, using cp...\n" |
---|
| 3264 | fi |
---|
| 3265 | cp -r ${absnamein[$i]}/* ${localin[$i]} |
---|
| 3266 | fi |
---|
[1] | 3267 | |
---|
| 3268 | else |
---|
| 3269 | # BEREITSTELLUNG AUF EINPROZESSORRECHNERN |
---|
[183] | 3270 | if [[ $link_local_input = true ]] |
---|
| 3271 | then |
---|
| 3272 | printf " using ln -f\n" |
---|
| 3273 | ln -f ${absnamein[$i]} ${localin[$i]} |
---|
| 3274 | fi |
---|
| 3275 | # If "ln -f" fails of if "$link_local_input = false" do a normal "cp" |
---|
| 3276 | if [[ ! -f "${localin[$i]}" ]] |
---|
| 3277 | then |
---|
| 3278 | if [[ $link_local_input = true ]] |
---|
| 3279 | then |
---|
| 3280 | printf " ln failed, using cp...\n" |
---|
| 3281 | fi |
---|
| 3282 | cp ${absnamein[$i]} ${localin[$i]} |
---|
| 3283 | fi |
---|
[1] | 3284 | fi |
---|
| 3285 | fi |
---|
| 3286 | fi |
---|
| 3287 | |
---|
| 3288 | done |
---|
| 3289 | if (( i != 0 )) |
---|
| 3290 | then |
---|
| 3291 | printf "\n$striche\n *** all INPUT-files provided \n" |
---|
| 3292 | fi |
---|
| 3293 | |
---|
| 3294 | |
---|
| 3295 | # EVENTUELLE INPUT-KOMMANDOS ABARBEITEN |
---|
| 3296 | (( i = 0 )) |
---|
| 3297 | while (( i < iic )) |
---|
| 3298 | do |
---|
| 3299 | (( i = i + 1 )) |
---|
| 3300 | if (( i == 1 )) |
---|
| 3301 | then |
---|
| 3302 | printf "\n\n *** execution of INPUT-commands:\n$striche" |
---|
| 3303 | fi |
---|
| 3304 | printf "\n >>> ${in_command[$i]}" |
---|
| 3305 | eval ${in_command[$i]} |
---|
| 3306 | if (( i == iic )) |
---|
| 3307 | then |
---|
| 3308 | printf "\n$striche\n" |
---|
| 3309 | fi |
---|
| 3310 | done |
---|
| 3311 | |
---|
| 3312 | |
---|
| 3313 | # VERBLEIBENDE CPU-ZEIT BERECHNEN |
---|
| 3314 | cpurest=${cpumax}. |
---|
| 3315 | |
---|
| 3316 | |
---|
[260] | 3317 | # START DVR STREAMING SERVER |
---|
| 3318 | if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
| 3319 | then |
---|
| 3320 | if [[ "$dvr_server" != "" ]] |
---|
| 3321 | then |
---|
| 3322 | |
---|
| 3323 | printf "\n\n *** preparing the dvr streaming server configuration file" |
---|
| 3324 | |
---|
| 3325 | # Check, if a dvr server is already running |
---|
| 3326 | running_dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config | grep -v grep) | cut -d" " -f2` |
---|
| 3327 | if [[ "$running_dvrserver_id" != "" ]] |
---|
| 3328 | then |
---|
| 3329 | |
---|
[261] | 3330 | printf "\n\n +++ WARNING: A dvr server with id=$running_dvrserver_id is already running!" |
---|
[260] | 3331 | printf "\n This server is used instead starting a new one!" |
---|
[261] | 3332 | printf "\n If required, script \"process_dvr_output\" has to be run manually." |
---|
[260] | 3333 | |
---|
| 3334 | else |
---|
| 3335 | |
---|
| 3336 | # COPY CONFIGURATION FILE FOR STREAMING SERVER FROM REPOSITORY TO HERE |
---|
| 3337 | if [[ -f ${PALM_BIN}/.dvrserver.config ]] |
---|
| 3338 | then |
---|
| 3339 | cp ${PALM_BIN}/.dvrserver.config . |
---|
| 3340 | |
---|
| 3341 | # Entering the BASEDIR, UID and GID into this file |
---|
| 3342 | user_id=`id -u` |
---|
| 3343 | group_id=`id -g` |
---|
| 3344 | # & is needed as seperator, because TEMPDIR contains / |
---|
| 3345 | sed "s&<replace by dvr data directory>&${TEMPDIR}&g" .dvrserver.config > .dvrserver.1 |
---|
| 3346 | sed "s/<replace by user id>/$user_id/g" .dvrserver.1 > .dvrserver.2 |
---|
| 3347 | sed "s/<replace by group id>/$group_id/g" .dvrserver.2 > .dvrserver.3 |
---|
| 3348 | mv .dvrserver.3 .dvrserver.config |
---|
| 3349 | rm .dvrserver.1 .dvrserver.2 |
---|
| 3350 | |
---|
| 3351 | # Start dvr server in background, get his id and print on terminal |
---|
| 3352 | $dvr_server .dvrserver.config >> DVR_LOGFILE 2>&1 & |
---|
| 3353 | dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config) | cut -d" " -f2` |
---|
| 3354 | printf "\n *** streaming server with id=$dvrserver_id is started in background" |
---|
| 3355 | local_dvrserver_running=.TRUE. |
---|
| 3356 | else |
---|
| 3357 | printf "\n +++ missing file \".dvrserver.config\" in directory:" |
---|
| 3358 | printf "\n \"$PALM_BIN\" " |
---|
| 3359 | locat=dvr |
---|
| 3360 | exit |
---|
| 3361 | fi |
---|
| 3362 | |
---|
| 3363 | fi |
---|
| 3364 | |
---|
| 3365 | else |
---|
| 3366 | printf "\n\n --- INFORMATIVE: no dvr streaming server will be started" |
---|
| 3367 | fi |
---|
| 3368 | fi |
---|
| 3369 | |
---|
| 3370 | |
---|
| 3371 | # NAMELIST-DATEI MIT WERTEN VON ENVIRONMENT-VARIABLEN ERZEUGEN (ZU |
---|
| 3372 | # LESEN VON PALM) |
---|
| 3373 | cat > ENVPAR << %%END%% |
---|
| 3374 | &envpar run_identifier = '$fname', host = '$localhost', |
---|
| 3375 | write_binary = '$write_binary', tasks_per_node = $tasks_per_node, |
---|
[759] | 3376 | maximum_parallel_io_streams = $maximum_parallel_io_streams, |
---|
[260] | 3377 | maximum_cpu_time_allowed = ${cpumax}., |
---|
| 3378 | revision = '$global_revision', |
---|
| 3379 | local_dvrserver_running = $local_dvrserver_running / |
---|
| 3380 | |
---|
| 3381 | %%END%% |
---|
| 3382 | |
---|
| 3383 | |
---|
[1] | 3384 | # PROGRAMMSTART |
---|
| 3385 | printf "\n\n *** execution starts in directory\n \"`pwd`\"\n$striche\n" |
---|
| 3386 | PATH=$PATH:$TEMPDIR |
---|
| 3387 | |
---|
[359] | 3388 | # MPI debug option (argument checking, slows down execution due to increased latency) |
---|
| 3389 | if [[ "$mpi_debug" = true ]] |
---|
| 3390 | then |
---|
| 3391 | export MPI_CHECK_ARGS=1 |
---|
| 3392 | printf "\n +++ MPI_CHECK_ARGS=$MPI_CHECK_ARGS" |
---|
| 3393 | fi |
---|
| 3394 | |
---|
[693] | 3395 | if [[ "$totalview" = true ]] |
---|
| 3396 | then |
---|
| 3397 | printf "\n *** totalview debugger will be used" |
---|
| 3398 | tv_opt="-tv" |
---|
| 3399 | else |
---|
| 3400 | tv_opt="" |
---|
| 3401 | fi |
---|
| 3402 | |
---|
[1] | 3403 | if [[ "$cond1" = debug || "$cond2" = debug ]] |
---|
| 3404 | then |
---|
| 3405 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
| 3406 | then |
---|
[211] | 3407 | if [[ $(echo $localhost | cut -c1-5) != lcsgi ]] |
---|
| 3408 | then |
---|
| 3409 | printf "\n +++ debug is allowed in interactive mode only" |
---|
| 3410 | locat=debug |
---|
| 3411 | exit |
---|
| 3412 | fi |
---|
[1] | 3413 | fi |
---|
[5] | 3414 | if [[ $localhost = decalpha ]] |
---|
[1] | 3415 | then |
---|
| 3416 | dxladebug a.out |
---|
[622] | 3417 | elif [[ $localhost = ibmh ]] |
---|
[1] | 3418 | then |
---|
| 3419 | |
---|
| 3420 | # SETUP THE IBM MPI ENVIRONMENT |
---|
| 3421 | export MP_SHARED_MEMORY=yes |
---|
| 3422 | export AIXTHREADS_SCOPE=S |
---|
| 3423 | export OMP_NUM_THREADS=$threads_per_task |
---|
| 3424 | export AUTHSTATE=files |
---|
| 3425 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
| 3426 | |
---|
| 3427 | # FOLLOWING OPTIONS ARE MANDATORY FOR TOTALVIEW |
---|
| 3428 | export MP_ADAPTER_USE=shared |
---|
| 3429 | export MP_CPU_USE=multiple |
---|
| 3430 | export MP_TIMEOUT=1200 |
---|
| 3431 | |
---|
| 3432 | unset MP_TASK_AFFINITY |
---|
| 3433 | |
---|
| 3434 | # SO FAR, TOTALVIEW NEEDS HOSTFILE MECHANISM FOR EXECUTION |
---|
| 3435 | #(( ii = 1 )) |
---|
| 3436 | #while (( ii <= $numprocs )) |
---|
| 3437 | #do |
---|
| 3438 | # echo $localhost_realname >> hostfile |
---|
| 3439 | # (( ii = ii + 1 )) |
---|
| 3440 | #done |
---|
| 3441 | #export MP_HOSTFILE=hostfile |
---|
| 3442 | |
---|
| 3443 | if [[ "$LOADLBATCH" = yes ]] |
---|
| 3444 | then |
---|
| 3445 | totalview poe a.out $ROPTS |
---|
| 3446 | else |
---|
| 3447 | echo totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
| 3448 | export TVDSVRLAUNCHCMD=ssh |
---|
| 3449 | totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
| 3450 | fi |
---|
[211] | 3451 | elif [[ $(echo $localhost | cut -c1-5) = lcsgi ]] |
---|
| 3452 | then |
---|
| 3453 | # CURRENTLY NO DEBUGGER ON LCSGI |
---|
| 3454 | if [[ $run_coupled_model = true ]] |
---|
| 3455 | then |
---|
| 3456 | printf "\n +++ no debug in coupled mode available on \"$localhost\" " |
---|
| 3457 | locat=debug |
---|
| 3458 | exit |
---|
[223] | 3459 | else |
---|
| 3460 | echo "no_coupling" > runfile_atmos |
---|
[211] | 3461 | fi |
---|
| 3462 | (( ii = $numprocs / $threads_per_task )) |
---|
| 3463 | export OMP_NUM_THREADS=$threads_per_task |
---|
| 3464 | echo "OMP_NUM_THREADS=$OMP_NUM_THREADS" |
---|
| 3465 | if [[ $threads_per_task != 1 ]] |
---|
| 3466 | then |
---|
| 3467 | printf "\n threads per task: $threads_per_task" |
---|
| 3468 | fi |
---|
| 3469 | printf "\n\n" |
---|
[223] | 3470 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
| 3471 | then |
---|
| 3472 | # export MPI_LAUNCH_TIMEOUT=360 |
---|
| 3473 | if [[ "$totalview" = true ]] |
---|
| 3474 | then |
---|
| 3475 | printf "\n running totalview debugger" |
---|
[693] | 3476 | mpiexec_mpt $tv_opt -n $ii ./a.out $ROPTS < runfile_atmos |
---|
[223] | 3477 | else |
---|
| 3478 | mpiexec_mpt -np $ii ./a.out $ROPTS < runfile_atmos |
---|
| 3479 | fi |
---|
| 3480 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
| 3481 | then |
---|
| 3482 | # ulimit -s 300000 # A too large stack size causes problems |
---|
| 3483 | # export MV2_NUM_PORTS=2 |
---|
| 3484 | # export MV2_CPU_MAPPING=0:1:2:3 |
---|
[362] | 3485 | if [[ "$totalview" = true ]] |
---|
| 3486 | then |
---|
| 3487 | printf "\n running totalview debugger" |
---|
[693] | 3488 | mpiexec $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
[362] | 3489 | else |
---|
| 3490 | mpiexec ./a.out $ROPTS < runfile_atmos |
---|
| 3491 | fi |
---|
[223] | 3492 | fi |
---|
[1] | 3493 | else |
---|
| 3494 | printf "\n +++ no debug available on \"$localhost\" " |
---|
| 3495 | printf "\n or not implemented in mrun so far" |
---|
| 3496 | locat=debug |
---|
| 3497 | exit |
---|
| 3498 | fi |
---|
[622] | 3499 | |
---|
| 3500 | # end debug mode |
---|
[1] | 3501 | else |
---|
[622] | 3502 | |
---|
| 3503 | # normal execution |
---|
[1] | 3504 | if [[ -n $numprocs ]] |
---|
| 3505 | then |
---|
| 3506 | # RUNNING THE PROGRAM ON PARALLEL MACHINES |
---|
| 3507 | if [[ $(echo $host | cut -c1-3) = ibm ]] |
---|
| 3508 | then |
---|
| 3509 | # SETUP THE IBM MPI ENVIRONMENT |
---|
[693] | 3510 | if [[ $host != ibmh && $host != ibmkisti ]] |
---|
[312] | 3511 | then |
---|
| 3512 | export MP_SHARED_MEMORY=yes |
---|
| 3513 | export AIXTHREAD_SCOPE=S |
---|
| 3514 | export OMP_NUM_THREADS=$threads_per_task |
---|
| 3515 | export XLSMPOPTS="spins=0:yields=0:stack=20000000" |
---|
| 3516 | export AUTHSTATE=files |
---|
| 3517 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
| 3518 | # export MP_PRINTENV=yes |
---|
[1] | 3519 | |
---|
[312] | 3520 | # TUNING-VARIABLEN ZUR VERBESSERUNG DER KOMMUNIKATION |
---|
| 3521 | # ZEIGEN ABER DERZEIT (SEP 04, FEDERATION) KAUM WIRKUNG |
---|
| 3522 | export MP_WAIT_MODE=poll |
---|
| 3523 | [[ $node_usage = not_shared ]] && export MP_SINGLE_THREAD=yes |
---|
| 3524 | fi |
---|
[693] | 3525 | |
---|
| 3526 | if [[ $host = ibmkisti ]] |
---|
| 3527 | then |
---|
| 3528 | export LANG=en_US |
---|
| 3529 | export MP_SHARED_MEMORY=yes |
---|
[696] | 3530 | if [[ $threads_per_task = 1 ]] |
---|
| 3531 | then |
---|
| 3532 | export MP_SINGLE_THREAD=yes |
---|
| 3533 | export MEMORY_AFFINITY=MCM |
---|
| 3534 | else |
---|
| 3535 | export OMP_NUM_THREADS=$threads_per_task |
---|
| 3536 | fi |
---|
[693] | 3537 | fi |
---|
| 3538 | |
---|
[1] | 3539 | if [[ "$LOADLBATCH" = yes ]] |
---|
| 3540 | then |
---|
| 3541 | printf "\n--- Control: OMP_NUM_THREADS = \"$OMP_NUM_THREADS\" \n" |
---|
| 3542 | if [[ "$cond1" = hpmcount || "$cond2" = hpmcount ]] |
---|
| 3543 | then |
---|
[102] | 3544 | /opt/optibm/HPM_2_4_1/bin/hpmcount a.out $ROPTS |
---|
[1] | 3545 | else |
---|
[343] | 3546 | if [[ $run_coupled_model = false ]] |
---|
| 3547 | then |
---|
| 3548 | if [[ "$ocean_file_appendix" = true ]] |
---|
| 3549 | then |
---|
| 3550 | echo "precursor_ocean" > runfile_atmos |
---|
| 3551 | else |
---|
| 3552 | echo "precursor_atmos" > runfile_atmos |
---|
| 3553 | fi |
---|
| 3554 | else |
---|
| 3555 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
| 3556 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
| 3557 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
| 3558 | printf "\n using $coupled_mode coupling" |
---|
| 3559 | printf "\n\n" |
---|
| 3560 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
| 3561 | fi |
---|
| 3562 | poe ./a.out $ROPTS < runfile_atmos |
---|
[1] | 3563 | fi |
---|
| 3564 | else |
---|
[622] | 3565 | if [[ $localhost = ibmh || $localhost = ibms ]] |
---|
[1] | 3566 | then |
---|
[102] | 3567 | poe a.out -procs $numprocs -nodes 1 -rmpool 0 $ROPTS |
---|
[693] | 3568 | elif [[ $localhost = ibmkisti || $localhost = ibmku || $localhost = ibmy ]] |
---|
[1] | 3569 | then |
---|
| 3570 | if [[ -f $hostfile ]] |
---|
| 3571 | then |
---|
| 3572 | cp $hostfile hostfile |
---|
| 3573 | else |
---|
| 3574 | (( ii = 1 )) |
---|
| 3575 | while (( ii <= $numprocs )) |
---|
| 3576 | do |
---|
| 3577 | echo $localhost_realname >> hostfile |
---|
| 3578 | (( ii = ii + 1 )) |
---|
| 3579 | done |
---|
| 3580 | fi |
---|
| 3581 | export MP_HOSTFILE=hostfile |
---|
[331] | 3582 | if [[ $run_coupled_model = false ]] |
---|
| 3583 | then |
---|
| 3584 | if [[ "$ocean_file_appendix" = true ]] |
---|
| 3585 | then |
---|
| 3586 | echo "precursor_ocean" > runfile_atmos |
---|
| 3587 | else |
---|
| 3588 | echo "precursor_atmos" > runfile_atmos |
---|
| 3589 | fi |
---|
| 3590 | else |
---|
| 3591 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
| 3592 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
| 3593 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
| 3594 | printf "\n using $coupled_mode coupling" |
---|
| 3595 | printf "\n\n" |
---|
| 3596 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
| 3597 | fi |
---|
[622] | 3598 | if [[ $localhost = ibmy ]] |
---|
| 3599 | then |
---|
| 3600 | ./a.out -procs $tasks_per_node $ROPTS < runfile_atmos |
---|
| 3601 | else |
---|
| 3602 | poe ./a.out -procs $numprocs $ROPTS < runfile_atmos |
---|
| 3603 | fi |
---|
[331] | 3604 | |
---|
[1] | 3605 | else |
---|
| 3606 | if [[ "$host_file" = "" ]] |
---|
| 3607 | then |
---|
| 3608 | printf "\n +++ no hostfile given in configuration file" |
---|
| 3609 | locat=config_file |
---|
| 3610 | exit |
---|
| 3611 | else |
---|
| 3612 | eval host_file=$host_file |
---|
| 3613 | fi |
---|
| 3614 | export MP_HOSTFILE=$host_file |
---|
[102] | 3615 | poe a.out -procs $numprocs -tasks_per_node $numprocs $ROPTS |
---|
[1] | 3616 | fi |
---|
| 3617 | fi |
---|
[251] | 3618 | elif [[ $host = nech || $host = necriam ]] |
---|
[1] | 3619 | then |
---|
| 3620 | (( ii = nodes )) |
---|
| 3621 | if [[ $ii = 1 ]] |
---|
| 3622 | then |
---|
| 3623 | export F_ERRCNT=0 # acceptable number of errors before program is stopped |
---|
| 3624 | export MPIPROGINF=YES |
---|
[61] | 3625 | # export F_TRACE=YES|FMT1|FMT2 # output of ftrace informations to job protocol |
---|
[1] | 3626 | echo "*** execution on single node with mpirun" |
---|
[102] | 3627 | mpirun -np $numprocs ./a.out $ROPTS |
---|
[1] | 3628 | else |
---|
| 3629 | (( i = 0 )) |
---|
| 3630 | while (( i < ii )) |
---|
| 3631 | do |
---|
| 3632 | echo "-h $i -p $tasks_per_node -e ./mpi_exec_shell" >> multinode_config |
---|
| 3633 | (( i = i + 1 )) |
---|
| 3634 | done |
---|
| 3635 | |
---|
| 3636 | echo "#!/bin/sh" > mpi_exec_shell |
---|
| 3637 | echo " " >> mpi_exec_shell |
---|
| 3638 | echo "set -u" >> mpi_exec_shell |
---|
| 3639 | echo "F_ERRCNT=0" >> mpi_exec_shell |
---|
| 3640 | echo "MPIPROGINV=YES" >> mpi_exec_shell |
---|
| 3641 | echo "OMP_NUM_THREADS=$threads_per_task" >> mpi_exec_shell |
---|
| 3642 | echo "cpurest=$cpurest" >> mpi_exec_shell |
---|
| 3643 | echo "fname=$fname" >> mpi_exec_shell |
---|
| 3644 | echo "localhost=$localhost" >> mpi_exec_shell |
---|
| 3645 | echo "return_addres=$return_addres" >> mpi_exec_shell |
---|
| 3646 | echo "return_username=$return_username" >> mpi_exec_shell |
---|
| 3647 | echo "tasks_per_node=$tasks_per_node" >> mpi_exec_shell |
---|
| 3648 | echo "write_binary=$write_binary" >> mpi_exec_shell |
---|
| 3649 | echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
| 3650 | echo " " >> mpi_exec_shell |
---|
| 3651 | echo "export F_ERRCNT" >> mpi_exec_shell |
---|
| 3652 | echo "export MPIPROGINV" >> mpi_exec_shell |
---|
| 3653 | echo "export OMP_NUM_THREADS" >> mpi_exec_shell |
---|
| 3654 | echo "export cpurest" >> mpi_exec_shell |
---|
| 3655 | echo "export fname" >> mpi_exec_shell |
---|
| 3656 | echo "export localhost" >> mpi_exec_shell |
---|
| 3657 | echo "export return_addres" >> mpi_exec_shell |
---|
| 3658 | echo "export return_username" >> mpi_exec_shell |
---|
| 3659 | echo "export tasks_per_node" >> mpi_exec_shell |
---|
| 3660 | echo "export write_binary" >> mpi_exec_shell |
---|
| 3661 | echo "export use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
| 3662 | echo " " >> mpi_exec_shell |
---|
[102] | 3663 | echo "exec ./a.out" >> mpi_exec_shell |
---|
[1] | 3664 | |
---|
| 3665 | chmod u+x mpi_exec_shell |
---|
| 3666 | export MPIPROGINF=YES |
---|
| 3667 | mpirun -f multinode_config & |
---|
| 3668 | wait |
---|
| 3669 | |
---|
| 3670 | fi |
---|
[440] | 3671 | elif [[ $(echo $host | cut -c1-2) = lc && $host != lckyoto && $host != lctit ]] |
---|
[1] | 3672 | then |
---|
| 3673 | |
---|
| 3674 | # COPY HOSTFILE FROM SOURCE DIRECTORY OR CREATE IT, IF IT |
---|
| 3675 | # DOES NOT EXIST |
---|
[179] | 3676 | if [[ $host != lcsgih && $host != lcsgib ]] |
---|
[1] | 3677 | then |
---|
[179] | 3678 | if [[ -f $hostfile ]] |
---|
| 3679 | then |
---|
| 3680 | cp $hostfile hostfile |
---|
[746] | 3681 | (( ii = $numprocs / $threads_per_task )) |
---|
[179] | 3682 | else |
---|
| 3683 | (( ii = 1 )) |
---|
| 3684 | while (( ii <= $numprocs / $threads_per_task )) |
---|
| 3685 | do |
---|
| 3686 | echo $localhost_realname >> hostfile |
---|
| 3687 | (( ii = ii + 1 )) |
---|
| 3688 | done |
---|
| 3689 | fi |
---|
| 3690 | eval zeile=\"`head -n $ii hostfile`\" |
---|
| 3691 | printf "\n *** running on: $zeile" |
---|
[1] | 3692 | fi |
---|
[179] | 3693 | |
---|
[1] | 3694 | (( ii = $numprocs / $threads_per_task )) |
---|
| 3695 | export OMP_NUM_THREADS=$threads_per_task |
---|
[696] | 3696 | # echo "*** OMP_NUM_THREADS=$OMP_NUM_THREADS" |
---|
[1] | 3697 | if [[ $threads_per_task != 1 ]] |
---|
| 3698 | then |
---|
[405] | 3699 | # increase stack size to unlimited, because large runs |
---|
| 3700 | # may abort otherwise |
---|
| 3701 | ulimit -Ss unlimited |
---|
| 3702 | printf "\n threads per task: $threads_per_task stacksize: unlimited" |
---|
[1] | 3703 | fi |
---|
[102] | 3704 | if [[ $run_coupled_model = false ]] |
---|
[1] | 3705 | then |
---|
[291] | 3706 | if [[ "$ocean_file_appendix" = true ]] |
---|
| 3707 | then |
---|
| 3708 | echo "precursor_ocean" > runfile_atmos |
---|
| 3709 | else |
---|
| 3710 | echo "precursor_atmos" > runfile_atmos |
---|
| 3711 | fi |
---|
[102] | 3712 | printf "\n\n" |
---|
[179] | 3713 | if [[ $host = lcsgih || $host = lcsgib ]] |
---|
[164] | 3714 | then |
---|
[221] | 3715 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
| 3716 | then |
---|
[366] | 3717 | # MPI_DSM_DISTRIBUTE not necessary when MPI_DSM_CPULIST is set |
---|
| 3718 | # export MPI_DSM_DISTRIBUTE=1 |
---|
| 3719 | # MPI_DSM_CPULIST: pin MPI processes to cores |
---|
[377] | 3720 | if [[ $use_openmp = false ]] |
---|
| 3721 | then |
---|
[412] | 3722 | if [[ "$sgi_feature" = ice2 ]] |
---|
| 3723 | then |
---|
| 3724 | export MPI_DSM_CPULIST="0,4,1,5,2,6,3,7:allhosts" |
---|
| 3725 | else |
---|
| 3726 | export MPI_DSM_CPULIST="0,1,4,5,2,3,6,7:allhosts" |
---|
| 3727 | fi |
---|
[622] | 3728 | else |
---|
| 3729 | unset MPI_DSM_CPULIST |
---|
[377] | 3730 | fi |
---|
[366] | 3731 | # MPI_IB_RAILS: use both IB rails on ICE2 |
---|
| 3732 | export MPI_BUFS_PER_HOST=512 |
---|
| 3733 | export MPI_IB_RAILS=2 |
---|
[369] | 3734 | # NECESSARY, IF MORE THAN 4096 PEs ARE USED |
---|
| 3735 | export MPI_CONNECTIONS_THRESHOLD=8192 |
---|
[738] | 3736 | # echo "*** MPI_DSM_CPULIST=$MPI_DSM_CPULIST" |
---|
[562] | 3737 | export MPI_TYPE_DEPTH=20 |
---|
[738] | 3738 | # echo "*** MPI_TYPE_DEPTH=$MPI_TYPE_DEPTH" |
---|
[683] | 3739 | export MPI_GROUP_MAX=64 |
---|
[738] | 3740 | # echo "*** MPI_GROUP_MAX=$MPI_GROUP_MAX" |
---|
[693] | 3741 | if [[ $use_openmp = true ]] |
---|
| 3742 | then |
---|
| 3743 | echo " mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos" |
---|
| 3744 | mpiexec -npernode $tasks_per_node $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
| 3745 | else |
---|
| 3746 | mpiexec_mpt -np $ii $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
| 3747 | fi |
---|
[388] | 3748 | |
---|
| 3749 | # next is test for openmp usage |
---|
[622] | 3750 | # echo "mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos" |
---|
| 3751 | # mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos |
---|
[221] | 3752 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
| 3753 | then |
---|
[374] | 3754 | export MV2_NUM_PORTS=2 |
---|
[376] | 3755 | # The default setting of MV2_CPU_MAPPING gives best results |
---|
[405] | 3756 | # export MV2_ENABLE_AFFINITY=1 |
---|
[376] | 3757 | # export MV2_CPU_MAPPING=0,1,4,5,2,3,6,7 |
---|
[412] | 3758 | # if [[ "$sgi_feature" = ice2 ]] |
---|
| 3759 | # then |
---|
| 3760 | # export MV2_CPU_MAPPING=0,4,1,5,2,6,3,7 |
---|
| 3761 | # else |
---|
| 3762 | # export MV2_CPU_MAPPING=0,1,4,5,2,3,6,7 |
---|
| 3763 | # fi |
---|
[678] | 3764 | if [[ $use_openmp = true ]] |
---|
| 3765 | then |
---|
| 3766 | unset MV2_CPU_MAPPING |
---|
| 3767 | export MV2_ENABLE_AFFINITY=0 |
---|
| 3768 | fi |
---|
[412] | 3769 | echo "*** MV2_CPU_MAPPING=$MV2_CPU_MAPPING" |
---|
[678] | 3770 | echo "*** MV2_ENABLE_AFFINITY=$MV2_ENABLE_AFFINITY" |
---|
[622] | 3771 | if [[ $use_openmp = true ]] |
---|
[405] | 3772 | then |
---|
[678] | 3773 | echo " mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos" |
---|
[693] | 3774 | mpiexec -npernode $tasks_per_node $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
[405] | 3775 | else |
---|
[693] | 3776 | mpiexec -np $ii $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
[405] | 3777 | fi |
---|
[738] | 3778 | elif [[ "$mpilib" = impi ]] |
---|
| 3779 | then |
---|
| 3780 | echo "mpirun -np $tasks_per_node inspxe-cl -r result -collect mi3 -- ./a.out < runfile_atmos" |
---|
| 3781 | mpirun -np $tasks_per_node inspxe-cl -r result -collect mi3 -- ./a.out < runfile_atmos |
---|
[221] | 3782 | fi |
---|
[892] | 3783 | elif [[ $host = lcxe6 || $host = lcxt5m ]] |
---|
[179] | 3784 | then |
---|
[544] | 3785 | aprun -n $ii -N $tasks_per_node a.out $ROPTS < runfile_atmos |
---|
[755] | 3786 | elif [[ $host = lcflow ]] |
---|
| 3787 | then |
---|
| 3788 | mpiexec -machinefile $TMPDIR/machines -n $ii -env I_MPI_FABRICS shm:ofa a.out < runfile_atmos $ROPTS |
---|
[164] | 3789 | else |
---|
[223] | 3790 | mpiexec -machinefile hostfile -n $ii a.out < runfile_atmos $ROPTS |
---|
[164] | 3791 | fi |
---|
[1] | 3792 | else |
---|
[164] | 3793 | |
---|
[206] | 3794 | # currently there is no full MPI-2 support on ICE and XT4 |
---|
| 3795 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
| 3796 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
| 3797 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
| 3798 | printf "\n using $coupled_mode coupling" |
---|
[102] | 3799 | printf "\n\n" |
---|
[164] | 3800 | |
---|
[206] | 3801 | if [[ $coupled_mode = "mpi2" ]] |
---|
[164] | 3802 | then |
---|
[206] | 3803 | echo "atmosphere_to_ocean $iia $iio" > runfile_atmos |
---|
| 3804 | echo "ocean_to_atmosphere $iia $iio" > runfile_ocean |
---|
| 3805 | if [[ $host = lcsgih || $host = lcsgib ]] |
---|
| 3806 | then |
---|
[197] | 3807 | |
---|
[221] | 3808 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
| 3809 | then |
---|
| 3810 | # export MPI_LAUNCH_TIMEOUT=360 |
---|
| 3811 | mpiexec_mpt -np $iia ./a.out $ROPTS < runfile_atmos & |
---|
| 3812 | mpiexec_mpt -np $iio ./a.out $ROPTS < runfile_ocean & |
---|
| 3813 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
| 3814 | then |
---|
| 3815 | # ulimit -s 300000 # A too large stack size causes problems |
---|
| 3816 | # export MV2_NUM_PORTS=2 |
---|
| 3817 | # export MV2_CPU_MAPPING=0:1:2:3 |
---|
| 3818 | mpiexec -n $iia ./a.out $ROPTS < runfile_atmos & |
---|
| 3819 | mpiexec -n $iio ./a.out $ROPTS < runfile_ocean & |
---|
| 3820 | fi |
---|
[197] | 3821 | |
---|
[892] | 3822 | elif [[ $host = lcxe6 || $host = lcxt5m ]] |
---|
[206] | 3823 | then |
---|
[197] | 3824 | |
---|
[206] | 3825 | aprun -n $iia -N $tasks_per_node a.out < runfile_atmos $ROPTS & |
---|
| 3826 | aprun -n $iio -N $tasks_per_node a.out < runfile_ocean $ROPTS & |
---|
| 3827 | |
---|
| 3828 | else |
---|
| 3829 | # WORKAROUND BECAUSE mpiexec WITH -env option IS NOT AVAILABLE ON SOME SYSTEMS |
---|
| 3830 | mpiexec -machinefile hostfile -n $iia a.out $ROPTS < runfile_atmos & |
---|
| 3831 | mpiexec -machinefile hostfile -n $iio a.out $ROPTS < runfile_ocean & |
---|
| 3832 | # mpiexec -machinefile hostfile -n $iia -env coupling_mode atmosphere_to_ocean a.out $ROPTS & |
---|
| 3833 | # mpiexec -machinefile hostfile -n $iio -env coupling_mode ocean_to_atmosphere a.out $ROPTS & |
---|
| 3834 | fi |
---|
| 3835 | wait |
---|
| 3836 | |
---|
[164] | 3837 | else |
---|
| 3838 | |
---|
[206] | 3839 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
| 3840 | if [[ $host = lcsgih || $host = lcsgib ]] |
---|
| 3841 | then |
---|
| 3842 | |
---|
[221] | 3843 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
| 3844 | then |
---|
| 3845 | # export MPI_LAUNCH_TIMEOUT=360 |
---|
| 3846 | mpiexec_mpt -np $ii ./a.out $ROPTS < runfile_atmos |
---|
| 3847 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
| 3848 | then |
---|
| 3849 | # ulimit -s 300000 # A too large stack size causes problems |
---|
| 3850 | # export MV2_NUM_PORTS=2 |
---|
| 3851 | # export MV2_CPU_MAPPING=0:1:2:3 |
---|
| 3852 | mpiexec ./a.out $ROPTS < runfile_atmos |
---|
| 3853 | fi |
---|
[206] | 3854 | |
---|
[892] | 3855 | elif [[ $host = lcxe6 || $host = lcxt5m ]] |
---|
[206] | 3856 | then |
---|
| 3857 | |
---|
| 3858 | aprun -n $ii -N $tasks_per_node a.out < runfile_atmos $ROPTS |
---|
| 3859 | |
---|
[718] | 3860 | elif [[ $host = lck || $host = lckordi ]] |
---|
[367] | 3861 | then |
---|
| 3862 | mpiexec -n $ii ./a.out $ROPTS < runfile_atmos & |
---|
[206] | 3863 | fi |
---|
| 3864 | wait |
---|
[164] | 3865 | fi |
---|
[102] | 3866 | |
---|
[206] | 3867 | fi |
---|
[1] | 3868 | elif [[ $host = decalpha ]] |
---|
| 3869 | then |
---|
[102] | 3870 | dmpirun -np $numprocs a.out $ROPTS |
---|
[440] | 3871 | elif [[ $host = lckyoto ]] |
---|
| 3872 | then |
---|
| 3873 | set -xv |
---|
| 3874 | export P4_RSHCOMMAND=plesh |
---|
| 3875 | echo " P4_RSHCOMMAND = $P4_RSHCOMMAND" |
---|
| 3876 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
| 3877 | then |
---|
[505] | 3878 | if [[ "$cond2" = fujitsu ]] |
---|
| 3879 | then |
---|
| 3880 | mpiexec -n $numprocs ./a.out $ROPTS # for fujitsu-compiler |
---|
| 3881 | elif [[ "cond2" = pgi ]] |
---|
| 3882 | then |
---|
| 3883 | mpirun -np $numprocs -machinefile ${QSUB_NODEINF} ./a.out $ROPTS |
---|
| 3884 | else |
---|
| 3885 | mpirun_rsh -np $numprocs -hostfile ${QSUB_NODEINF} MV2_USE_SRQ=0 ./a.out ${ROPTS} || /bin/true |
---|
| 3886 | fi |
---|
[440] | 3887 | else |
---|
[505] | 3888 | if [[ "$cond2" = "" ]] |
---|
| 3889 | then |
---|
| 3890 | mpiruni_rsh -np $numprocs ./a.out $ROPTS # for intel |
---|
| 3891 | else |
---|
| 3892 | mpirun -np $numprocs ./a.out $ROPTS |
---|
| 3893 | fi |
---|
[440] | 3894 | fi |
---|
| 3895 | set +xv |
---|
[1] | 3896 | elif [[ $host = lctit ]] |
---|
| 3897 | then |
---|
[678] | 3898 | export OMP_NUM_THREADS=$threads_per_task |
---|
| 3899 | echo "OMP_NUM_THREADS=$OMP_NUM_THREADS" |
---|
| 3900 | if [[ "$threads_per_task" != 1 ]] |
---|
| 3901 | then |
---|
| 3902 | export MV2_ENABLE_AFFINITY=0 |
---|
| 3903 | fi |
---|
| 3904 | echo "----- PBS_NODEFILE content:" |
---|
| 3905 | cat $PBS_NODEFILE |
---|
| 3906 | echo "-----" |
---|
| 3907 | (( ii = $numprocs / $threads_per_task )) |
---|
| 3908 | echo "mpirun -np $ii -hostfile $PBS_NODEFILE ./a.out $ROPTS" |
---|
| 3909 | mpirun -np $ii -hostfile $PBS_NODEFILE ./a.out $ROPTS |
---|
[1] | 3910 | else |
---|
[102] | 3911 | mpprun -n $numprocs a.out $ROPTS |
---|
[1] | 3912 | fi |
---|
| 3913 | [[ $? != 0 ]] && execution_error=true |
---|
| 3914 | |
---|
| 3915 | |
---|
| 3916 | # PERFORMANCE-AUSWERTUNG MIT APPRENTICE |
---|
| 3917 | if [[ "$cond1" = apprentice || "$cond2" = apprentice ]] |
---|
| 3918 | then |
---|
| 3919 | apprentice |
---|
| 3920 | fi |
---|
| 3921 | else |
---|
[102] | 3922 | a.out $ROPTS |
---|
[1] | 3923 | fi |
---|
| 3924 | fi |
---|
| 3925 | if [[ $? != 0 || $execution_error = true ]] |
---|
| 3926 | then |
---|
| 3927 | |
---|
| 3928 | # ABBRUCH BEI LAUFZEITFEHLER |
---|
[102] | 3929 | # [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output* |
---|
[1] | 3930 | printf "\n +++ runtime error occured" |
---|
| 3931 | locat=execution |
---|
| 3932 | exit |
---|
| 3933 | else |
---|
[102] | 3934 | # [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output* |
---|
[1] | 3935 | printf "\n$striche\n *** execution finished \n" |
---|
[260] | 3936 | |
---|
[261] | 3937 | # Stop the dvr streaming server and process the dvr output in order |
---|
| 3938 | # to create dvrs- and html-files containing all streams |
---|
[260] | 3939 | if [[ "$dvrserver_id" != "" ]] |
---|
| 3940 | then |
---|
| 3941 | kill $dvrserver_id |
---|
| 3942 | printf "\n *** dvr server with id=$dvrserver_id has been stopped" |
---|
[261] | 3943 | |
---|
[262] | 3944 | # If there is a directory, data have been output by the |
---|
| 3945 | # streaming server. Otherwise, user has chosen dvrp_output=local |
---|
| 3946 | if [[ -d DATA_DVR ]] |
---|
| 3947 | then |
---|
[261] | 3948 | |
---|
[262] | 3949 | # Add the current dvr configuration file to the dvr output |
---|
| 3950 | # directory |
---|
| 3951 | cp .dvrserver.config DATA_DVR |
---|
| 3952 | |
---|
| 3953 | # Process the dvr output (option -s for also generating |
---|
| 3954 | # sequence mode data) |
---|
| 3955 | process_dvr_output -d DATA_DVR -f $fname -s |
---|
| 3956 | |
---|
| 3957 | else |
---|
| 3958 | |
---|
| 3959 | # Process the local output |
---|
| 3960 | process_dvr_output -l -d DATA_DVR -f $fname |
---|
| 3961 | |
---|
| 3962 | fi |
---|
| 3963 | |
---|
| 3964 | elif [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
| 3965 | then |
---|
| 3966 | |
---|
| 3967 | # Process dvr output generated in local mode (dvrp_output=local) |
---|
| 3968 | process_dvr_output -l -d DATA_DVR -f $fname |
---|
| 3969 | |
---|
[260] | 3970 | fi |
---|
[1] | 3971 | fi |
---|
| 3972 | |
---|
| 3973 | |
---|
| 3974 | |
---|
[503] | 3975 | # Call of combine_plot_fields in order to merge single files written |
---|
| 3976 | # by each PE into one file. |
---|
[920] | 3977 | if [[ ! -f ${PALM_BIN}/combine_plot_fields${block}.x ]] |
---|
| 3978 | then |
---|
| 3979 | printf "\n\n\n +++ WARNING: no combine_plot_fields found for given block \"$cond1 $cond2\"" |
---|
| 3980 | printf "\n 2d- and/or 3d-data may be incomplete!" |
---|
| 3981 | printf "\n Run \"mbuild -u -h $localhost\" to generate utilities for this block.\n" |
---|
| 3982 | elif [[ "$combine_plot_fields" == true ]] |
---|
| 3983 | then |
---|
| 3984 | printf "\n\n\n *** post-processing: now executing \"combine_plot_fields${block}.x\" ..." |
---|
| 3985 | combine_plot_fields${block}.x |
---|
| 3986 | else |
---|
| 3987 | # Temporary solution to skip combine_plot_fields. This is necessary in case of huge amount of |
---|
| 3988 | # data output. To do: extend this branch by creating a batch job for combine_plot_fields. |
---|
| 3989 | printf "\n\n\n *** post-processing: skipping combine_plot_fields (-Z option set) ..." |
---|
| 3990 | fi |
---|
[503] | 3991 | |
---|
| 3992 | |
---|
| 3993 | |
---|
[1] | 3994 | # EVENTUELLE OUTPUT-KOMMANDOS ABARBEITEN |
---|
| 3995 | (( i = 0 )) |
---|
| 3996 | while (( i < ioc )) |
---|
| 3997 | do |
---|
| 3998 | (( i = i + 1 )) |
---|
| 3999 | if (( i == 1 )) |
---|
| 4000 | then |
---|
| 4001 | printf "\n\n *** execution of OUTPUT-commands:\n$striche" |
---|
| 4002 | fi |
---|
| 4003 | printf "\n >>> ${out_command[$i]}" |
---|
| 4004 | eval ${out_command[$i]} |
---|
| 4005 | if (( i == ioc )) |
---|
| 4006 | then |
---|
| 4007 | printf "\n$striche\n" |
---|
| 4008 | fi |
---|
| 4009 | done |
---|
| 4010 | |
---|
| 4011 | |
---|
| 4012 | # EVTL. INHALT DES AKTUELLEN VERZEICHNISSES AUSGEBEN |
---|
| 4013 | if [[ $do_trace = true ]] |
---|
| 4014 | then |
---|
| 4015 | printf "\n\n" |
---|
| 4016 | ls -al |
---|
| 4017 | fi |
---|
| 4018 | |
---|
| 4019 | |
---|
| 4020 | |
---|
| 4021 | # OUTPUT-DATEIEN AN IHRE ZIELORTE KOPIEREN |
---|
| 4022 | (( i = 0 )) |
---|
| 4023 | while (( i < iout )) |
---|
| 4024 | do |
---|
| 4025 | (( i = i + 1 )) |
---|
| 4026 | if (( i == 1 )) |
---|
| 4027 | then |
---|
| 4028 | printf "\n\n *** saving OUTPUT-files:\n$striche" |
---|
| 4029 | fi |
---|
| 4030 | |
---|
| 4031 | # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR |
---|
| 4032 | files_for_pes=false; filetyp=file |
---|
| 4033 | if [[ "${actionout[$i]}" = pe && -n $numprocs ]] |
---|
| 4034 | then |
---|
| 4035 | files_for_pes=true; filetyp=directory |
---|
| 4036 | actionout[$i]="" |
---|
| 4037 | elif [[ "${actionout[$i]}" = pe && ! -n $numprocs ]] |
---|
| 4038 | then |
---|
| 4039 | actionout[$i]="" |
---|
| 4040 | elif [[ "${actionout[$i]}" = arpe && -n $numprocs ]] |
---|
| 4041 | then |
---|
| 4042 | files_for_pes=true; filetyp=directory |
---|
| 4043 | actionout[$i]="ar" |
---|
| 4044 | elif [[ "${actionout[$i]}" = arpe && ! -n $numprocs ]] |
---|
| 4045 | then |
---|
| 4046 | actionout[$i]="ar" |
---|
| 4047 | elif [[ "${actionout[$i]}" = flpe && -n $numprocs ]] |
---|
| 4048 | then |
---|
| 4049 | files_for_pes=true; filetyp=directory |
---|
| 4050 | actionout[$i]="fl" |
---|
| 4051 | elif [[ "${actionout[$i]}" = flpe && ! -n $numprocs ]] |
---|
| 4052 | then |
---|
| 4053 | actionout[$i]="fl" |
---|
| 4054 | elif [[ "${actionout[$i]}" = trpe && -n $numprocs ]] |
---|
| 4055 | then |
---|
| 4056 | files_for_pes=true; filetyp=directory |
---|
| 4057 | actionout[$i]="tr" |
---|
| 4058 | elif [[ "${actionout[$i]}" = trpe && ! -n $numprocs ]] |
---|
| 4059 | then |
---|
| 4060 | actionout[$i]="tr" |
---|
| 4061 | fi |
---|
| 4062 | |
---|
| 4063 | if [[ ! -f ${localout[$i]} && $files_for_pes = false ]] |
---|
| 4064 | then |
---|
| 4065 | printf "\n +++ temporary OUTPUT-file ${localout[$i]} does not exist\n" |
---|
[260] | 4066 | elif [[ ! -d ${localout[$i]} && $files_for_pes = true ]] |
---|
[1] | 4067 | then |
---|
| 4068 | printf "\n +++ temporary OUTPUT-file ${localout[$i]}/.... does not exist\n" |
---|
| 4069 | else |
---|
| 4070 | |
---|
| 4071 | |
---|
| 4072 | # KOPIEREN PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG |
---|
| 4073 | # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI |
---|
| 4074 | # REMOTE-RECHNUNGEN |
---|
| 4075 | if [[ "${actionout[$i]}" = tr ]] |
---|
| 4076 | then |
---|
| 4077 | if [[ $localhost != $fromhost ]] |
---|
| 4078 | then |
---|
| 4079 | if [[ $files_for_pes = false ]] |
---|
| 4080 | then |
---|
| 4081 | cps="" |
---|
| 4082 | cst="" |
---|
| 4083 | else |
---|
| 4084 | cps=-c |
---|
| 4085 | cst="/" |
---|
| 4086 | fi |
---|
[622] | 4087 | if [[ $localhost = nech ]] |
---|
[1] | 4088 | then |
---|
| 4089 | |
---|
| 4090 | # TRANSFER IN EIGENSTAENDIGEM JOB |
---|
| 4091 | # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS |
---|
| 4092 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
| 4093 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
| 4094 | if [[ $files_for_pes = false ]] |
---|
| 4095 | then |
---|
| 4096 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
| 4097 | else |
---|
| 4098 | mkdir $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
| 4099 | ln ${localout[$i]}/* $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
| 4100 | fi |
---|
| 4101 | |
---|
| 4102 | echo "set -x" > transfer_${localout[$i]} |
---|
| 4103 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
[82] | 4104 | |
---|
| 4105 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP in seperate job to" |
---|
| 4106 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst" |
---|
| 4107 | printf "\n or higher cycle\n" |
---|
| 4108 | echo "batch_scp $cps -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
| 4109 | |
---|
[1] | 4110 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
| 4111 | |
---|
| 4112 | if [[ $localhost = nech ]] |
---|
| 4113 | then |
---|
[82] | 4114 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 transfer_${localout[$i]} |
---|
[1] | 4115 | else |
---|
| 4116 | if [[ "$LOGNAME" = b323013 ]] |
---|
| 4117 | then |
---|
[164] | 4118 | subjob -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
[1] | 4119 | else |
---|
[164] | 4120 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
[1] | 4121 | fi |
---|
| 4122 | fi |
---|
| 4123 | |
---|
| 4124 | else |
---|
| 4125 | |
---|
| 4126 | # TRANSFER INNERHALB DIESES JOBS |
---|
| 4127 | transfer_failed=false |
---|
[82] | 4128 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP to" |
---|
| 4129 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst\n" |
---|
| 4130 | batch_scp $cps -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
| 4131 | [[ $? != 0 ]] && transfer_failed=true |
---|
[1] | 4132 | |
---|
| 4133 | # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF |
---|
| 4134 | # LOKALER MASCHINE ANLEGEN |
---|
| 4135 | if [[ $transfer_failed = true ]] |
---|
| 4136 | then |
---|
| 4137 | printf " +++ transfer failed. Trying to save a copy on the local host under:\n" |
---|
| 4138 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
| 4139 | |
---|
| 4140 | # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS |
---|
| 4141 | # ANLEGEN. |
---|
| 4142 | eval local_catalog=${pathout[$i]} |
---|
| 4143 | if [[ ! -d $local_catalog ]] |
---|
| 4144 | then |
---|
| 4145 | printf " *** local directory does not exist. Trying to create:\n" |
---|
| 4146 | printf " $local_catalog \n" |
---|
| 4147 | mkdir -p $local_catalog |
---|
| 4148 | fi |
---|
| 4149 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
| 4150 | transfer_problems=true |
---|
| 4151 | fi |
---|
| 4152 | fi |
---|
| 4153 | else |
---|
| 4154 | |
---|
| 4155 | # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR KOPIERT WIRD |
---|
| 4156 | actionout[$i]="" |
---|
| 4157 | fi |
---|
| 4158 | fi |
---|
| 4159 | |
---|
| 4160 | |
---|
| 4161 | # APPEND PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG |
---|
| 4162 | # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI |
---|
| 4163 | # REMOTE-RECHNUNGEN |
---|
| 4164 | if [[ "${actionout[$i]}" = tra ]] |
---|
| 4165 | then |
---|
| 4166 | if [[ $localhost != $fromhost ]] |
---|
| 4167 | then |
---|
[622] | 4168 | if [[ $localhost = ibmh || $localhost = nech ]] |
---|
[1] | 4169 | then |
---|
| 4170 | |
---|
| 4171 | # TRANSFER IN EIGENSTAENDIGEM JOB |
---|
| 4172 | # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS |
---|
| 4173 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
| 4174 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
| 4175 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
| 4176 | |
---|
| 4177 | echo "set -x" > transfer_${localout[$i]} |
---|
| 4178 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
[82] | 4179 | |
---|
| 4180 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP in seperate job to" |
---|
| 4181 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" |
---|
| 4182 | printf "\n or higher cycle\n" |
---|
| 4183 | echo "batch_scp -A -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
| 4184 | |
---|
[1] | 4185 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
| 4186 | |
---|
| 4187 | if [[ $localhost = nech ]] |
---|
| 4188 | then |
---|
[82] | 4189 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 transfer_${localout[$i]} |
---|
[1] | 4190 | else |
---|
| 4191 | if [[ $LOGNAME = b323013 ]] |
---|
| 4192 | then |
---|
[164] | 4193 | subjob -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
[1] | 4194 | else |
---|
[164] | 4195 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
[1] | 4196 | fi |
---|
| 4197 | fi |
---|
| 4198 | |
---|
| 4199 | else |
---|
| 4200 | |
---|
| 4201 | # TRANSFER INNERHALB DIESES JOBS |
---|
| 4202 | transfer_failed=false |
---|
[82] | 4203 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP to" |
---|
| 4204 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" |
---|
| 4205 | batch_scp -A -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
| 4206 | [[ $? != 0 ]] && transfer_failed=true |
---|
[1] | 4207 | |
---|
| 4208 | # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF |
---|
| 4209 | # LOKALER MASCHINE ANLEGEN |
---|
| 4210 | if [[ $transfer_failed = true ]] |
---|
| 4211 | then |
---|
| 4212 | printf " +++ transfer failed. Trying to save a copy on the local host under:\n" |
---|
| 4213 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
| 4214 | |
---|
| 4215 | # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS |
---|
| 4216 | # ANLEGEN |
---|
| 4217 | eval local_catalog=${pathout[$i]} |
---|
| 4218 | if [[ ! -d $local_catalog ]] |
---|
| 4219 | then |
---|
| 4220 | printf " *** local directory does not exist. Trying to create:\n" |
---|
| 4221 | printf " $local_catalog \n" |
---|
| 4222 | mkdir -p $local_catalog |
---|
| 4223 | fi |
---|
| 4224 | |
---|
| 4225 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
| 4226 | transfer_problems=true |
---|
| 4227 | fi |
---|
| 4228 | fi |
---|
| 4229 | else |
---|
| 4230 | |
---|
| 4231 | # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR APPEND AUF |
---|
| 4232 | # LOKALER MASCHINE DURCHGEFUEHRT WIRD |
---|
| 4233 | actionout[$i]=a |
---|
| 4234 | fi |
---|
| 4235 | fi |
---|
| 4236 | |
---|
| 4237 | |
---|
| 4238 | # OUTPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. DATEI WIRD PER |
---|
| 4239 | # LINK AUF DEN TEMPORAEREN DATENKATALOG GELEGT. OPTION -f WIRD |
---|
| 4240 | # VERWENDET, FALLS DORT NOCH EINE DATEI GLEICHEN NAMENS VORHANDEN |
---|
| 4241 | # SEIN SOLLTE. ANSCHLIESSEND WIRD SEINE ARCHIVIERUNG ANGESTOSSEN |
---|
| 4242 | if [[ "${actionout[$i]}" = fl ]] |
---|
| 4243 | then |
---|
| 4244 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
| 4245 | chmod g+rx $tmp_data_catalog |
---|
| 4246 | if [[ $files_for_pes = false ]] |
---|
| 4247 | then |
---|
| 4248 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
| 4249 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
| 4250 | ln -f ${localout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
| 4251 | else |
---|
| 4252 | printf "\n >>> OUTPUT: ${localout[$i]}/.... to" |
---|
| 4253 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
| 4254 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
[149] | 4255 | cd ${localout[$i]} |
---|
| 4256 | for file in $(ls *) |
---|
| 4257 | do |
---|
| 4258 | ln -f $file $tmp_data_catalog/${frelout[$i]} |
---|
| 4259 | done |
---|
| 4260 | cd $TEMPDIR |
---|
[1] | 4261 | fi |
---|
| 4262 | |
---|
| 4263 | |
---|
| 4264 | # ARCHIVIERUNGSJOB WIRD ERZEUGT UND ABGESCHICKT |
---|
| 4265 | if [[ $store_on_archive_system = true ]] |
---|
| 4266 | then |
---|
| 4267 | |
---|
| 4268 | if [[ $archive_system = asterix ]] |
---|
| 4269 | then |
---|
| 4270 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
| 4271 | if [[ $files_for_pes = false ]] |
---|
| 4272 | then |
---|
| 4273 | echo "stageout ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
| 4274 | else |
---|
| 4275 | echo "stageout -t ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
| 4276 | fi |
---|
| 4277 | echo "cat STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
| 4278 | echo "if [[ \$(grep -c \"st.msg:150\" STAGE_OUTPUT${i}_$kennung) != 0 ]]" >> archive_${frelout[$i]} |
---|
| 4279 | echo "then" >> archive_${frelout[$i]} |
---|
| 4280 | echo " do_stageout=false" >> archive_${frelout[$i]} |
---|
| 4281 | echo "else" >> archive_${frelout[$i]} |
---|
| 4282 | echo " echo \" +++ $filetyp ${frelout[$i]} could not be stored on archive-system\" " >> archive_${frelout[$i]} |
---|
| 4283 | echo " cat /dev/null > ~/job_queue/ARCHIVE_ERROR_$fname" >> archive_${frelout[$i]} |
---|
| 4284 | echo " cat STAGE_OUTPUT${i}_$kennung > ~/job_queue/archive_${frelout[$i]}_error" >> archive_${frelout[$i]} |
---|
| 4285 | echo " echo \" *** $filetyp ${frelout[$i]} will be copied to \$WORK as backup\" " >> archive_${frelout[$i]} |
---|
| 4286 | if [[ $files_for_pes = false ]] |
---|
| 4287 | then |
---|
| 4288 | echo " cp ${frelout[$i]} \$WORK" >> archive_${frelout[$i]} |
---|
| 4289 | else |
---|
| 4290 | echo " cp -r ${frelout[$i]} \$WORK/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4291 | fi |
---|
| 4292 | echo " echo \" *** $filetyp ${frelout[$i]} saved\" " >> archive_${frelout[$i]} |
---|
| 4293 | echo "fi" >> archive_${frelout[$i]} |
---|
| 4294 | echo "rm STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
| 4295 | elif [[ $archive_system = DMF ]] |
---|
| 4296 | then |
---|
| 4297 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
| 4298 | if [[ $files_for_pes = false ]] |
---|
| 4299 | then |
---|
| 4300 | printf "\n +++ archiving of single files impossible with $archive_system !\n" |
---|
| 4301 | locat=DMF |
---|
| 4302 | exit |
---|
| 4303 | else |
---|
| 4304 | # FUER RECHNER IN JUELICH. DORT KOENNTEN AUCH |
---|
| 4305 | # EINZELNE DATEIEN GESICHERT WERDEN (SPAETER KORR.) |
---|
| 4306 | echo "rm -rf \$ARCHIVE/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4307 | echo "cp -r ${frelout[$i]} \$ARCHIVE" >> archive_${frelout[$i]} |
---|
| 4308 | fi |
---|
| 4309 | elif [[ $archive_system = tivoli ]] |
---|
| 4310 | then |
---|
| 4311 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
| 4312 | if [[ $files_for_pes = false ]] |
---|
| 4313 | then |
---|
| 4314 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
| 4315 | echo "set -x" >> archive_${frelout[$i]} |
---|
| 4316 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4317 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4318 | else |
---|
| 4319 | |
---|
| 4320 | echo "set -x" >> archive_${frelout[$i]} |
---|
| 4321 | echo "rm -rf \$PERM/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
| 4322 | echo "[[ ! -d \$PERM/${frelout[$i]} ]] && mkdir $PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4323 | cd $tmp_data_catalog |
---|
| 4324 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
| 4325 | cd - > /dev/null |
---|
| 4326 | (( inode = 0 )) |
---|
| 4327 | (( tp1 = tasks_per_node + 1 )) |
---|
| 4328 | while (( inode < nodes )) |
---|
| 4329 | do |
---|
| 4330 | # echo "*** all_files = \"$all_files\" " |
---|
| 4331 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
| 4332 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
| 4333 | # echo "*** tasks_per_node = \"$tasks_per_node\" " |
---|
| 4334 | # echo "*** files = \"$files\" " |
---|
| 4335 | # echo "*** all_files = \"$all_files\" " |
---|
[416] | 4336 | echo "tar cvf \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
| 4337 | ### echo "tar cvf ${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
| 4338 | ### echo "cp ${frelout[$i]}.node_$inode.tar \$PERM/${frelout[$i]}/" >> archive_${frelout[$i]} |
---|
| 4339 | ###echo "rm ${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
[397] | 4340 | # echo "dsmc incremental \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
| 4341 | # echo "dsmmigrate \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
[1] | 4342 | (( inode = inode + 1 )) |
---|
| 4343 | done |
---|
| 4344 | # echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
| 4345 | # echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4346 | fi |
---|
| 4347 | elif [[ $archive_system = ut ]] |
---|
| 4348 | then |
---|
| 4349 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
| 4350 | if [[ $files_for_pes = false ]] |
---|
| 4351 | then |
---|
| 4352 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
| 4353 | echo "set -x" >> archive_${frelout[$i]} |
---|
| 4354 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4355 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4356 | else |
---|
| 4357 | |
---|
| 4358 | echo "set -x" >> archive_${frelout[$i]} |
---|
| 4359 | echo "rm -rf \$UT/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
| 4360 | echo "[[ ! -d \$UT/${frelout[$i]} ]] && mkdir $UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4361 | cd $tmp_data_catalog |
---|
| 4362 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
| 4363 | cd - > /dev/null |
---|
| 4364 | (( inode = 0 )) |
---|
| 4365 | (( tp1 = tasks_per_node + 1 )) |
---|
| 4366 | while (( inode < nodes )) |
---|
| 4367 | do |
---|
| 4368 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
| 4369 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
| 4370 | echo "tar cvf \$UT/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
| 4371 | (( inode = inode + 1 )) |
---|
| 4372 | done |
---|
| 4373 | fi |
---|
| 4374 | elif [[ $archive_system = none ]] |
---|
| 4375 | then |
---|
| 4376 | printf " +++ archiving on $localhost not available!\n" |
---|
| 4377 | fi |
---|
| 4378 | |
---|
| 4379 | if [[ $archive_system != none ]] |
---|
| 4380 | then |
---|
[399] | 4381 | if [[ $localhost = lcsgih || $localhost = lcsgib ]] |
---|
[1] | 4382 | then |
---|
[164] | 4383 | # subjob -d -v -q cdata -X 0 -m 1000 -t 43200 -c $job_catalog archive_${frelout[$i]} |
---|
[416] | 4384 | subjob -v -q permq -X 1 -T 1 -m 1000 -t 172800 -c $job_catalog archive_${frelout[$i]} |
---|
[1] | 4385 | elif [[ $localhost = nech ]] |
---|
| 4386 | then |
---|
[82] | 4387 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 7200 archive_${frelout[$i]} |
---|
[1] | 4388 | fi |
---|
| 4389 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
| 4390 | fi |
---|
| 4391 | else |
---|
[399] | 4392 | printf " +++ caution: option -A is switched off. No archiving on $archive_system!\n" |
---|
[1] | 4393 | fi |
---|
| 4394 | |
---|
| 4395 | |
---|
| 4396 | # LEERDATEI IM BENUTZERVERZEICHNIS ANLEGEN, DAMIT BEKANNT IST, |
---|
| 4397 | # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET |
---|
| 4398 | if [[ $files_for_pes = false ]] |
---|
| 4399 | then |
---|
| 4400 | cat /dev/null > ${pathout[$i]} |
---|
| 4401 | else |
---|
| 4402 | mkdir -p ${pathout[$i]} |
---|
| 4403 | fi |
---|
| 4404 | |
---|
| 4405 | fi |
---|
| 4406 | |
---|
| 4407 | |
---|
| 4408 | # KOPIEREN AUF LOKALER MASCHINE ZUM ARCHIV-SYSTEM |
---|
| 4409 | # AUSSERDEM MUSS LEERDATEI ANGELEGT WERDEN, DAMIT BEKANNT IST, |
---|
| 4410 | # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET |
---|
| 4411 | # FALLS IRGENDEINE (VON MEHREREN) ARCHIVIERUNGEN SCHIEF GEHT, |
---|
| 4412 | # WIRD FLAG GESETZT UND BLEIBT AUCH BEI WEITEREN ORDNUNGS- |
---|
| 4413 | # GEMAESSEN ARCHIVIERUNGEN GESETZT |
---|
| 4414 | if [[ "${actionout[$i]}" = ar ]] |
---|
| 4415 | then |
---|
| 4416 | if [[ $files_for_pes = false ]] |
---|
| 4417 | then |
---|
| 4418 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
| 4419 | printf "\n ${pathout[$i]}" |
---|
| 4420 | printf "\n File will be copied to archive-system ($archive_system) !\n" |
---|
| 4421 | else |
---|
| 4422 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to" |
---|
| 4423 | printf "\n ${pathout[$i]}" |
---|
| 4424 | printf "\n Directory will be copied to archive-system ($archive_system) !\n" |
---|
| 4425 | fi |
---|
| 4426 | mv ${localout[$i]} ${frelout[$i]} |
---|
| 4427 | |
---|
| 4428 | file_saved=false |
---|
| 4429 | |
---|
| 4430 | if [[ $archive_system = asterix ]] |
---|
| 4431 | then |
---|
| 4432 | do_stageout=true |
---|
| 4433 | (( stageout_anz = 0 )) |
---|
| 4434 | while [[ $do_stageout = true ]] |
---|
| 4435 | do |
---|
| 4436 | if [[ $files_for_pes = false ]] |
---|
| 4437 | then |
---|
| 4438 | stageout ${frelout[$i]} > STAGE_OUTPUT |
---|
| 4439 | else |
---|
| 4440 | stageout -t ${frelout[$i]} > STAGE_OUTPUT |
---|
| 4441 | fi |
---|
| 4442 | cat STAGE_OUTPUT |
---|
| 4443 | if [[ $(grep -c "st.msg:150" STAGE_OUTPUT) != 0 ]] |
---|
| 4444 | then |
---|
| 4445 | file_saved=true |
---|
| 4446 | do_stageout=false |
---|
| 4447 | else |
---|
| 4448 | if [[ $files_for_pes = false ]] |
---|
| 4449 | then |
---|
| 4450 | printf "\n +++ file ${frelout[$i]} could not be saved on archive-system" |
---|
| 4451 | else |
---|
| 4452 | printf "\n +++ directory ${frelout[$i]} could not be saved on archive-system" |
---|
| 4453 | fi |
---|
| 4454 | (( stageout_anz = stageout_anz + 1 )) |
---|
| 4455 | if (( stageout_anz == 10 )) |
---|
| 4456 | then |
---|
| 4457 | printf "\n +++ stoped after 10 unsuccessful tries!" |
---|
| 4458 | archive_save=false |
---|
| 4459 | do_stageout=false |
---|
| 4460 | else |
---|
| 4461 | printf "\n *** new try to store on archive after 15 min:" |
---|
| 4462 | sleep 900 |
---|
| 4463 | fi |
---|
| 4464 | fi |
---|
| 4465 | done |
---|
| 4466 | elif [[ $archive_system = DMF ]] |
---|
| 4467 | then |
---|
| 4468 | if [[ $files_for_pes = false ]] |
---|
| 4469 | then |
---|
| 4470 | printf "\n +++ archiving of single files impossible on $archive_system!\n" |
---|
| 4471 | locat=DMF |
---|
| 4472 | exit |
---|
| 4473 | else |
---|
| 4474 | rm -rf $ARCHIVE/${frelout[$i]} |
---|
| 4475 | cp -r ${frelout[$i]} $ARCHIVE |
---|
| 4476 | fi |
---|
| 4477 | file_saved=true |
---|
| 4478 | elif [[ $archive_system = tivoli ]] |
---|
| 4479 | then |
---|
| 4480 | # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH |
---|
| 4481 | # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS |
---|
| 4482 | # GELEGT WERDEN |
---|
| 4483 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
| 4484 | chmod g+rx $tmp_data_catalog |
---|
| 4485 | if [[ $files_for_pes = false ]] |
---|
| 4486 | then |
---|
| 4487 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
| 4488 | else |
---|
| 4489 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
| 4490 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
| 4491 | fi |
---|
| 4492 | |
---|
| 4493 | # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER |
---|
| 4494 | # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN |
---|
| 4495 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
| 4496 | if [[ $files_for_pes = false ]] |
---|
| 4497 | then |
---|
| 4498 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
| 4499 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4500 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4501 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4502 | else |
---|
| 4503 | echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
| 4504 | echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4505 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4506 | fi |
---|
| 4507 | |
---|
[164] | 4508 | subjob -v -d -q cdata -X 0 -m 1000 -t 43200 -c $job_catalog archive_${frelout[$i]} |
---|
[1] | 4509 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
| 4510 | file_saved=true |
---|
| 4511 | |
---|
| 4512 | elif [[ $archive_system = ut ]] |
---|
| 4513 | then |
---|
| 4514 | # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH |
---|
| 4515 | # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS |
---|
| 4516 | # GELEGT WERDEN |
---|
| 4517 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
| 4518 | chmod g+rx $tmp_data_catalog |
---|
| 4519 | if [[ $files_for_pes = false ]] |
---|
| 4520 | then |
---|
| 4521 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
| 4522 | else |
---|
| 4523 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
| 4524 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
| 4525 | fi |
---|
| 4526 | |
---|
| 4527 | # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER |
---|
| 4528 | # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN |
---|
| 4529 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
| 4530 | if [[ $files_for_pes = false ]] |
---|
| 4531 | then |
---|
| 4532 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
| 4533 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4534 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4535 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4536 | else |
---|
| 4537 | echo "rm -rf \$UT/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
| 4538 | echo "tar cvf \$UT/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4539 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
| 4540 | fi |
---|
| 4541 | |
---|
[82] | 4542 | subjob -v -c /pf/b/$usern/job_queue -d -q pp -X 0 -m 1000 -t 7200 archive_${frelout[$i]} |
---|
[1] | 4543 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
| 4544 | file_saved=true |
---|
| 4545 | |
---|
| 4546 | else |
---|
| 4547 | printf "\n +++ archive_system=\"$archive_system\" archiving impossible!" |
---|
| 4548 | archive_save=false |
---|
| 4549 | fi |
---|
| 4550 | if [[ $file_saved = true ]] |
---|
| 4551 | then |
---|
| 4552 | if [[ $files_for_pes = false ]] |
---|
| 4553 | then |
---|
| 4554 | cat /dev/null > ${pathout[$i]} |
---|
| 4555 | else |
---|
| 4556 | mkdir -p ${pathout[$i]} |
---|
| 4557 | fi |
---|
| 4558 | fi |
---|
| 4559 | fi |
---|
| 4560 | |
---|
| 4561 | # APPEND AUF LOKALER MASCHINE |
---|
| 4562 | if [[ "${actionout[$i]}" = "a" ]] |
---|
| 4563 | then |
---|
[741] | 4564 | if [[ "${extout[$i]}" != " " && "${extout[$i]}" != "" ]] |
---|
| 4565 | then |
---|
| 4566 | printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}.${extout[$i]}\n" |
---|
| 4567 | cat ${localout[$i]} >> ${pathout[$i]}.${extout[$i]} |
---|
| 4568 | else |
---|
| 4569 | printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}\n" |
---|
| 4570 | cat ${localout[$i]} >> ${pathout[$i]} |
---|
| 4571 | fi |
---|
[1] | 4572 | fi |
---|
| 4573 | |
---|
| 4574 | # KOPIEREN AUF LOKALER MASCHINE |
---|
| 4575 | # ES MUSS KOPIERT WERDEN, DA MOVE NICHT UEBER FILESYSTEM HINAUS MOEGLICH |
---|
| 4576 | if [[ "${actionout[$i]}" = "" && $files_for_pes = false ]] |
---|
| 4577 | then |
---|
| 4578 | |
---|
| 4579 | # KOPIEREN AUF EINPROZESSORMASCHINE |
---|
[5] | 4580 | if [[ "${extout[$i]}" != " " && "${extout[$i]}" != "" ]] |
---|
[1] | 4581 | then |
---|
| 4582 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}.${extout[$i]}\n" |
---|
[149] | 4583 | if [[ $link_local_output = true ]] |
---|
| 4584 | then |
---|
| 4585 | printf " using ln -f\n" |
---|
| 4586 | ln -f ${localout[$i]} ${pathout[$i]}.${extout[$i]} |
---|
| 4587 | fi |
---|
| 4588 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp" |
---|
| 4589 | if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]] |
---|
| 4590 | then |
---|
| 4591 | if [[ $link_local_output = true ]] |
---|
| 4592 | then |
---|
| 4593 | printf " ln failed, using cp...\n" |
---|
| 4594 | fi |
---|
| 4595 | cp ${localout[$i]} ${pathout[$i]}.${extout[$i]} |
---|
| 4596 | fi |
---|
[1] | 4597 | else |
---|
| 4598 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}\n" |
---|
[149] | 4599 | if [[ $link_local_output = true ]] |
---|
| 4600 | then |
---|
| 4601 | printf " using ln -f\n" |
---|
| 4602 | ln -f ${localout[$i]} ${pathout[$i]} |
---|
| 4603 | fi |
---|
| 4604 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp" |
---|
| 4605 | if [[ ! -f "${pathout[$i]}" ]] |
---|
| 4606 | then |
---|
| 4607 | if [[ $link_local_output = true ]] |
---|
| 4608 | then |
---|
| 4609 | printf " ln failed, using cp...\n" |
---|
| 4610 | fi |
---|
| 4611 | cp ${localout[$i]} ${pathout[$i]} |
---|
| 4612 | fi |
---|
[1] | 4613 | fi |
---|
| 4614 | |
---|
| 4615 | elif [[ "${actionout[$i]}" = "" && $files_for_pes = true ]] |
---|
| 4616 | then |
---|
| 4617 | |
---|
| 4618 | # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN |
---|
| 4619 | # DATEIEN WERDEN ERST IN EINEM KATALOG GESAMMELT UND DIESER |
---|
| 4620 | # WIRD DANN KOPIERT |
---|
| 4621 | # PER MOVE UMBENANNT WERDEN |
---|
| 4622 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to ${pathout[$i]}\n" |
---|
[149] | 4623 | if [[ $link_local_output = true ]] |
---|
| 4624 | then |
---|
| 4625 | printf " using ln -f\n" |
---|
| 4626 | mkdir ${pathout[$i]} |
---|
| 4627 | cd ${localout[$i]} |
---|
| 4628 | for file in $(ls *) |
---|
| 4629 | do |
---|
| 4630 | ln -f $file ${pathout[$i]} |
---|
| 4631 | done |
---|
| 4632 | cd $TEMPDIR |
---|
| 4633 | fi |
---|
| 4634 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp -r" |
---|
| 4635 | if [[ ! -f "${pathout[$i]}/_0000" ]] |
---|
| 4636 | then |
---|
| 4637 | if [[ $link_local_output = true ]] |
---|
| 4638 | then |
---|
| 4639 | printf " ln failed for .../_0000, using cp...\n" |
---|
| 4640 | fi |
---|
| 4641 | cp -r ${localout[$i]} ${pathout[$i]} |
---|
| 4642 | fi |
---|
[1] | 4643 | |
---|
| 4644 | fi |
---|
| 4645 | fi |
---|
| 4646 | done |
---|
| 4647 | if (( i != 0 )) |
---|
| 4648 | then |
---|
| 4649 | if [[ $transfer_problems = true ]] |
---|
| 4650 | then |
---|
| 4651 | printf "\n$striche\n *** OUTPUT-files saved" |
---|
| 4652 | printf "\n +++ WARNING: some data transfers failed! \n" |
---|
| 4653 | else |
---|
| 4654 | printf "\n$striche\n *** all OUTPUT-files saved \n" |
---|
| 4655 | fi |
---|
| 4656 | fi |
---|
| 4657 | |
---|
| 4658 | |
---|
| 4659 | # EVENTUELL FOLGEJOB STARTEN |
---|
| 4660 | # DATEI CONTINUE_RUN MUSS VOM BENUTZERPROGRAMM AUS ERZEUGT WERDEN |
---|
| 4661 | if [[ -f CONTINUE_RUN ]] |
---|
| 4662 | then |
---|
| 4663 | |
---|
| 4664 | if [[ $archive_save = true ]] |
---|
| 4665 | then |
---|
| 4666 | |
---|
| 4667 | # ZUERST IN MRUN-AUFRUF OPTIONEN FUER FORTSETZUNGSLAUF, FUER |
---|
| 4668 | # STILLES ABARBEITEN (OHNE INTERAKTIVE RUECKFAGEN) UND FUER |
---|
| 4669 | # BATCH-BETRIEB (NUR WICHTIG, FALLS BATCH AUF LOKALER MASCHINE |
---|
| 4670 | # DURCHGEFUEHRT WERDEN SOLL) EINFUEGEN, FALLS NICHT BEREITS VOR- |
---|
| 4671 | # HANDEN |
---|
| 4672 | [[ $(echo $mc | grep -c "\-C") = 0 ]] && mc="$mc -C" |
---|
| 4673 | [[ $(echo $mc | grep -c "\-v") = 0 ]] && mc="$mc -v" |
---|
| 4674 | [[ $(echo $mc | grep -c "\-b") = 0 ]] && mc="$mc -b" |
---|
| 4675 | if [[ $(echo $mc | grep -c "#") != 0 ]] |
---|
| 4676 | then |
---|
| 4677 | mc=`echo $mc | sed 's/#/f/g'` |
---|
| 4678 | fi |
---|
| 4679 | |
---|
| 4680 | |
---|
| 4681 | # JOB STARTEN |
---|
| 4682 | printf "\n\n *** initiating restart-run on \"$return_addres\" using command:\n" |
---|
| 4683 | echo " $mc" |
---|
| 4684 | printf "\n$striche\n" |
---|
| 4685 | if [[ $localhost != $fromhost ]] |
---|
| 4686 | then |
---|
| 4687 | |
---|
[693] | 4688 | if [[ $localhost = lcsgih || $localhost = lcsgib || $localhost = nech || $localhost = ibmh || $localhost = ibmkisti || $localhost = ibmku || $localhost = ibms ]] |
---|
[1] | 4689 | then |
---|
| 4690 | echo "*** ssh will be used to initiate restart-runs!" |
---|
| 4691 | echo " return_addres=\"$return_addres\" " |
---|
| 4692 | echo " return_username=\"$return_username\" " |
---|
[635] | 4693 | if [[ $(echo $return_addres | grep -c "130.75.105") = 1 ]] |
---|
[1] | 4694 | then |
---|
[970] | 4695 | ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;. /muksoft/packages/intel/bin/compilervars.sh intel64;PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
[1] | 4696 | else |
---|
[693] | 4697 | if [[ $localhost = ibmkisti ]] |
---|
| 4698 | then |
---|
| 4699 | ssh $usern@gaiad "ssh $return_addres -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" " |
---|
| 4700 | else |
---|
| 4701 | ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
| 4702 | fi |
---|
[1] | 4703 | fi |
---|
| 4704 | else |
---|
| 4705 | printf "\n +++ no restart mechanism available for host \"$localhost\" " |
---|
| 4706 | locat=restart; exit |
---|
| 4707 | fi |
---|
| 4708 | |
---|
| 4709 | # WARTEN, DAMIT SICH RESTART JOB IN QUEUE EINREIHEN KANN, BEVOR |
---|
| 4710 | # DER AKTUELLE JOB ENDET |
---|
[399] | 4711 | if [[ $queue = special1q ]] |
---|
| 4712 | then |
---|
| 4713 | sleep 120 |
---|
| 4714 | else |
---|
| 4715 | sleep 30 |
---|
| 4716 | fi |
---|
[1] | 4717 | |
---|
| 4718 | else |
---|
| 4719 | |
---|
| 4720 | # BEI RECHNUNGEN AUF LOKALER MASCHINE KANN MRUN DIREKT AUFGE- |
---|
[108] | 4721 | # RUFEN WERDEN, AUSSER AUF lcfimm |
---|
[1] | 4722 | cd $LOCAL_PWD |
---|
[108] | 4723 | if [[ $localhost = lcfimm ]] |
---|
| 4724 | then |
---|
| 4725 | ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
| 4726 | else |
---|
| 4727 | eval $mc # ' MUESSEN AUSGEWERTET WERDEN |
---|
| 4728 | fi |
---|
[1] | 4729 | cd - > /dev/null |
---|
| 4730 | fi |
---|
| 4731 | printf "\n$striche\n *** restart-run initiated \n" |
---|
| 4732 | |
---|
| 4733 | |
---|
| 4734 | # EVENTUELL INPUT-DATEIEN, DIE VON TEMPORAEREM DATENVERZEICHNIS |
---|
| 4735 | # GEHOLT WORDEN SIND, LOESCHEN |
---|
| 4736 | (( i = 0 )) |
---|
| 4737 | while (( i < iin )) |
---|
| 4738 | do |
---|
| 4739 | (( i = i + 1 )) |
---|
| 4740 | if [[ "${got_tmp[$i]}" = true && $keep_data_from_previous_run = false ]] |
---|
| 4741 | then |
---|
| 4742 | rm -r $tmp_data_catalog/${frelin[$i]} |
---|
| 4743 | fi |
---|
| 4744 | done |
---|
| 4745 | |
---|
| 4746 | else |
---|
| 4747 | |
---|
| 4748 | printf "\n +++ no restart-run possible, since errors occured" |
---|
| 4749 | printf "\n during the archive process" |
---|
| 4750 | fi |
---|
| 4751 | |
---|
| 4752 | fi |
---|
| 4753 | |
---|
| 4754 | |
---|
| 4755 | |
---|
| 4756 | # EVTL. EMAIL-BENACHRICHTIGUNG UEBER ABGESCHLOSSENEN LAUF |
---|
[352] | 4757 | if [[ "$email_notification" != "none" ]] |
---|
[1] | 4758 | then |
---|
| 4759 | |
---|
| 4760 | if [[ $localhost != $fromhost ]] |
---|
| 4761 | then |
---|
| 4762 | if [[ -f CONTINUE_RUN ]] |
---|
| 4763 | then |
---|
| 4764 | echo "PALM restart run necessary" > email_text |
---|
| 4765 | echo "description header of actual run:" >> email_text |
---|
| 4766 | cat CONTINUE_RUN >> email_text |
---|
| 4767 | echo "mrun-command to restart:" >> email_text |
---|
| 4768 | echo "$mc" >> email_text |
---|
| 4769 | else |
---|
| 4770 | echo "PALM run with base filename \"$fname\" on host \"$localhost\" finished" > email_text |
---|
| 4771 | fi |
---|
| 4772 | mail $email_notification < email_text |
---|
| 4773 | printf "\n *** email notification sent to \"$email_notification\" " |
---|
| 4774 | fi |
---|
| 4775 | fi |
---|
| 4776 | |
---|
| 4777 | |
---|
| 4778 | |
---|
| 4779 | # ALLE ARBEITEN BEENDET. TEMPORAERER KATALOG KANN GELOESCHT WERDEN |
---|
| 4780 | cd $HOME |
---|
| 4781 | [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR |
---|
| 4782 | |
---|
| 4783 | else |
---|
| 4784 | |
---|
| 4785 | |
---|
| 4786 | # FALLS AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- |
---|
| 4787 | # CHENDE AKTIONEN DURCHGEFUEHRT |
---|
| 4788 | |
---|
| 4789 | # MRUN-BEFEHL FUER REMOTE-MASCHINE ZUSAMMENSTELLEN |
---|
[821] | 4790 | mrun_com="$mrun_script_name -a $afname -c $config_file -d $fname -h $host -H $fromhost -m $memory -t $cpumax -q $queue -R $return_addres -U $return_username -u $remote_username" |
---|
[1] | 4791 | [[ "$cpp_opts" != "" ]] && mrun_com=${mrun_com}" -D \"$cpp_opts\"" |
---|
[79] | 4792 | [[ "$global_revision" != "" ]] && mrun_com=${mrun_com}" -G \"$global_revision\"" |
---|
[123] | 4793 | [[ $group_number != none ]] && mrun_com=${mrun_com}" -g $group_number" |
---|
[1] | 4794 | [[ $do_compile = true ]] && mrun_com=${mrun_com}" -s \"$source_list\"" |
---|
| 4795 | [[ "$input_list" != "" ]] && mrun_com=${mrun_com}" -i \"$input_list\"" |
---|
| 4796 | [[ $ignore_archive_error = true ]] && mrun_com=${mrun_com}" -I" |
---|
| 4797 | [[ $keep_data_from_previous_run = true ]] && mrun_com=${mrun_com}" -k" |
---|
| 4798 | [[ "$additional_conditions" != "" ]] && mrun_com=${mrun_com}" -K \"$additional_conditions\"" |
---|
| 4799 | # [[ "$makefile" != "$source_path/Makefile" ]] && mrun_com=${mrun_com}" -M \"$makefile\"" |
---|
| 4800 | [[ "$output_list" != "" ]] && mrun_com=${mrun_com}" -o \"$output_list\"" |
---|
| 4801 | [[ "$read_from_config" = false ]] && mrun_com=${mrun_com}" -S" |
---|
| 4802 | [[ $do_trace = true ]] && mrun_com=${mrun_com}" -x" |
---|
| 4803 | [[ "$numprocs" != "" ]] && mrun_com=${mrun_com}" -X $numprocs" |
---|
| 4804 | if [[ $use_openmp = true ]] |
---|
| 4805 | then |
---|
[622] | 4806 | mrun_com=${mrun_com}" -O $threads_per_task" |
---|
[1] | 4807 | fi |
---|
[759] | 4808 | [[ "$tasks_per_node" != "" ]] && mrun_com=${mrun_com}" -T $tasks_per_node" |
---|
[397] | 4809 | [[ $store_on_archive_system = true ]] && mrun_com=${mrun_com}" -A" |
---|
[1] | 4810 | [[ $package_list != "" ]] && mrun_com=${mrun_com}" -p \"$package_list\"" |
---|
| 4811 | [[ $return_password != "" ]] && mrun_com=${mrun_com}" -P $return_password" |
---|
| 4812 | [[ $delete_temporary_catalog = false ]] && mrun_com=${mrun_com}" -B" |
---|
[127] | 4813 | [[ $node_usage != default && "$(echo $node_usage | cut -c1-3)" != "sla" && $node_usage != novice ]] && mrun_com=${mrun_com}" -n $node_usage" |
---|
[291] | 4814 | [[ "$ocean_file_appendix" = true ]] && mrun_com=${mrun_com}" -y" |
---|
[206] | 4815 | [[ $run_coupled_model = true ]] && mrun_com=${mrun_com}" -Y \"$coupled_dist\"" |
---|
[920] | 4816 | [[ "$check_namelist_files" = false ]] && mrun_com=${mrun_com}" -z" |
---|
| 4817 | [[ "$combine_plot_fields" = false ]] && mrun_com=${mrun_com}" -Z" |
---|
[759] | 4818 | [[ "$max_par_io_str" != "" ]] && mrun_com=${mrun_com}" -w $max_par_io_str" |
---|
[1] | 4819 | if [[ $do_remote = true ]] |
---|
| 4820 | then |
---|
| 4821 | printf "\n>>>> MRUN-command on execution host:\n>>>> $mrun_com \n" |
---|
| 4822 | fi |
---|
| 4823 | |
---|
| 4824 | |
---|
| 4825 | # ZUSAMMENSTELLUNG DES JOBSCRIPTS AUF DATEI jobfile |
---|
| 4826 | jobfile=jobfile.$RANDOM |
---|
| 4827 | |
---|
| 4828 | |
---|
| 4829 | # TEMPORAERES VERZEICHNIS GENERIEREN UND NACH DORT WECHSELN |
---|
| 4830 | echo "mkdir $TEMPDIR" >> $jobfile |
---|
| 4831 | echo "cd $TEMPDIR" >> $jobfile |
---|
| 4832 | |
---|
| 4833 | |
---|
| 4834 | # EVENTUELL FEHLERVERFOLGUNG AKTIVIEREN |
---|
| 4835 | if [[ $do_trace = true ]] |
---|
| 4836 | then |
---|
| 4837 | echo "set -x" >> $jobfile |
---|
| 4838 | else |
---|
| 4839 | echo "set +vx" >> $jobfile |
---|
| 4840 | fi |
---|
| 4841 | |
---|
| 4842 | |
---|
[191] | 4843 | # BEREITSTELLUNG VON QUELLTEXTEN, MRUN-SCRIPTS UND KONFIGURATIONS- |
---|
| 4844 | # DATEI FUER DEN JOB |
---|
[693] | 4845 | if [[ $( echo $host | cut -c1-5 ) = lcsgi || $host = ibmkisti ]] |
---|
[1] | 4846 | then |
---|
| 4847 | |
---|
[191] | 4848 | # KONFIGURATIONSDATEI UND MRUN_SCRIPT IN DAS SOURCE-VERZEICHNIS |
---|
| 4849 | # KOPIEREN |
---|
| 4850 | if [[ $restart_run != true ]] |
---|
| 4851 | then |
---|
| 4852 | cp $config_file $working_directory/SOURCES_FOR_RUN_$fname |
---|
| 4853 | cp ${PALM_BIN}/$mrun_script_name $working_directory/SOURCES_FOR_RUN_$fname |
---|
| 4854 | fi |
---|
[1] | 4855 | |
---|
[191] | 4856 | # SOURCE-VERZEICHNIS VOM LOKALEN RECHNER PER SCP TRANSFERIEREN |
---|
[693] | 4857 | # (BEI JOBS AUF LOKALEM RECHNER REICHT CP) |
---|
[193] | 4858 | echo "set -x" >> $jobfile |
---|
[693] | 4859 | if [[ $host = $localhost ]] |
---|
| 4860 | then |
---|
| 4861 | echo "cp -r $working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile |
---|
| 4862 | else |
---|
| 4863 | if [[ $host != ibmkisti ]] |
---|
| 4864 | then |
---|
| 4865 | echo "scp -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile |
---|
| 4866 | else |
---|
| 4867 | # on KISTI's IBM firewall is only opened on interactive node |
---|
| 4868 | echo "localdir=\`pwd\`" >> $jobfile |
---|
| 4869 | echo "ssh $remote_username@gaiad \"cd \$localdir; scp -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname .\" " >> $jobfile |
---|
| 4870 | fi |
---|
| 4871 | fi |
---|
[193] | 4872 | echo "export SOURCES_COMPLETE=true" >> $jobfile |
---|
[1] | 4873 | |
---|
[193] | 4874 | # QUELLTEXTE, MRUN-SCRIPT UND KONFIGURATIONSDATEI IN DAS AKTUELLE |
---|
| 4875 | # ARBEITSVERZEICHNIS VERSCHIEBEN |
---|
| 4876 | echo "mv SOURCES_FOR_RUN_$fname/$config_file . " >> $jobfile |
---|
| 4877 | echo "mv SOURCES_FOR_RUN_$fname/$mrun_script_name . " >> $jobfile |
---|
| 4878 | echo "execute_mrun=true" >> $jobfile |
---|
| 4879 | echo " " >> $jobfile |
---|
| 4880 | |
---|
[191] | 4881 | else |
---|
| 4882 | |
---|
| 4883 | # ABSPEICHERN DER QUELLTEXTE (NUR FALLS UEBERSETZT WERDEN SOLL) |
---|
| 4884 | # SOWIE GEGEBENENFALLS DES MAKEFILES |
---|
| 4885 | if [[ $do_compile = true ]] |
---|
| 4886 | then |
---|
| 4887 | |
---|
| 4888 | source_catalog=SOURCES_FOR_RUN_$fname |
---|
| 4889 | |
---|
| 4890 | # UNTERVERZEICHNIS FUER QUELLTEXTE UND MAKEFILE ANLEGEN |
---|
| 4891 | # MRUN WIRD DIESES VRZEICHNIS UEBER ENVIRONMENT VARIABLE |
---|
| 4892 | # MITGETEILT (UEBERSTEUERT ANGABE IN KONFIGURATIONSDATEI) |
---|
| 4893 | echo "mkdir SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
| 4894 | echo "export SOURCES_COMPLETE=true" >> $jobfile |
---|
| 4895 | echo "cd SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
| 4896 | |
---|
| 4897 | for filename in $source_list |
---|
| 4898 | do |
---|
| 4899 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
| 4900 | echo "cat > $filename << \"%END%\"" >> $jobfile |
---|
| 4901 | cat $source_catalog/$filename >> $jobfile |
---|
| 4902 | echo " " >> $jobfile |
---|
| 4903 | echo "%END%" >> $jobfile |
---|
| 4904 | echo " " >> $jobfile |
---|
| 4905 | done |
---|
| 4906 | |
---|
[1] | 4907 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
[191] | 4908 | echo "cat > Makefile << \"%END%\"" >> $jobfile |
---|
| 4909 | cat $source_catalog/Makefile >> $jobfile |
---|
[1] | 4910 | echo " " >> $jobfile |
---|
| 4911 | echo "%END%" >> $jobfile |
---|
| 4912 | echo " " >> $jobfile |
---|
| 4913 | |
---|
[191] | 4914 | echo "cd - > /dev/null" >> $jobfile |
---|
[1] | 4915 | |
---|
[191] | 4916 | fi |
---|
[1] | 4917 | |
---|
| 4918 | |
---|
[191] | 4919 | # ABSPEICHERN DER KONFIGURATIONSDATEI |
---|
| 4920 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
| 4921 | echo "cat > $config_file << \"%END%\"" >> $jobfile |
---|
| 4922 | cat $config_file >> $jobfile |
---|
| 4923 | echo "%END%" >> $jobfile |
---|
| 4924 | echo " " >> $jobfile |
---|
[1] | 4925 | |
---|
| 4926 | |
---|
[191] | 4927 | # ABSPEICHERN DER AKTUELLEN MRUN-VERSION |
---|
| 4928 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
[693] | 4929 | echo "cat > $mrun_script_name <<\"%END%\"" >> $jobfile |
---|
| 4930 | cat ${PALM_BIN}/$mrun_script_name >> $jobfile |
---|
| 4931 | echo "%END%" >> $jobfile |
---|
[191] | 4932 | echo "chmod u+x $mrun_script_name" >> $jobfile |
---|
| 4933 | echo "execute_mrun=true" >> $jobfile |
---|
| 4934 | echo " " >> $jobfile |
---|
[1] | 4935 | |
---|
| 4936 | fi |
---|
| 4937 | |
---|
[191] | 4938 | |
---|
[1] | 4939 | # EVTL. BENOETIGTE INPUT-DATEIEN PER FTP HOLEN ODER DEM JOB DIREKT |
---|
| 4940 | # MITGEBEN UND AUF DEM REMOTE-RECHNER IM BENUTZERVERZEICHNIS ABLEGEN |
---|
| 4941 | # FALLS DIESES NICHT EXISTIERT, WIRD VERSUCHT, DAS JEWEILS LETZTE |
---|
| 4942 | # UNTERVERZEICHNIS DES PFADNAMENS ANZULEGEN |
---|
| 4943 | if [[ $do_remote = true ]] |
---|
| 4944 | then |
---|
| 4945 | (( i = 0 )) |
---|
| 4946 | while (( i < iin )) |
---|
| 4947 | do |
---|
| 4948 | (( i = i + 1 )) |
---|
| 4949 | echo "[[ ! -d ${pathin[$i]} ]] && mkdir -p ${pathin[$i]}" >> $jobfile |
---|
| 4950 | if [[ "${transin[$i]}" = job ]] |
---|
| 4951 | then |
---|
| 4952 | echo "cat > ${remotepathin[$i]} <<\"%END%\"" >> $jobfile |
---|
| 4953 | eval cat ${pathin[$i]}/${frelin[$i]} >> $jobfile |
---|
| 4954 | echo " " >> $jobfile |
---|
| 4955 | echo "%END%" >> $jobfile |
---|
| 4956 | else |
---|
[82] | 4957 | echo "batch_scp -b -o -g -s -u $return_username $return_addres ${remotepathin[$i]} \"${pathin[$i]}\" ${frelin[$i]}" >> $jobfile |
---|
[1] | 4958 | fi |
---|
| 4959 | |
---|
| 4960 | # UEBERPRUEFEN, OB DATEI ANGELEGT WERDEN KONNTE |
---|
| 4961 | echo "if [[ \$? = 1 ]]" >> $jobfile |
---|
| 4962 | echo "then" >> $jobfile |
---|
| 4963 | echo " echo \" \" " >> $jobfile |
---|
| 4964 | echo " echo \"+++ file ${remotepathin[$i]} could not be created\" " >> $jobfile |
---|
| 4965 | echo " echo \" please check, if directory exists on $host!\" " >> $jobfile |
---|
| 4966 | echo " echo \"+++ MRUN will not be continued\" " >> $jobfile |
---|
| 4967 | echo " execute_mrun=false" >> $jobfile |
---|
| 4968 | echo "fi" >> $jobfile |
---|
| 4969 | done |
---|
| 4970 | fi |
---|
| 4971 | |
---|
| 4972 | # ARBEITSKATALOG AUF DER LOKALEN MASCHINE FUER EVENTUELLE |
---|
| 4973 | # FORTSETZUNGSLAUEFE PER ENV-VARIABLE UEBERGEBEN |
---|
| 4974 | echo "LOCAL_PWD=$working_directory" >> $jobfile |
---|
| 4975 | echo "export LOCAL_PWD" >> $jobfile |
---|
| 4976 | |
---|
| 4977 | # EBENSO LOKALEN MRUN-KATALOG UEBERGEBEN |
---|
[22] | 4978 | echo "LOCAL_MRUN_PATH=$PALM_BIN" >> $jobfile |
---|
[1] | 4979 | echo "export LOCAL_MRUN_PATH" >> $jobfile |
---|
| 4980 | |
---|
[66] | 4981 | # WORKAROUND FUER RIAM-NEC-JOBS WEGEN PROFILE-SCHWIERIGKEITEN |
---|
[69] | 4982 | if [[ $localhost_realname = "gate" || $localhost = lctit ]] |
---|
[66] | 4983 | then |
---|
| 4984 | echo "export PALM_BIN=$PALM_BIN" >> $jobfile |
---|
| 4985 | fi |
---|
[1] | 4986 | |
---|
[693] | 4987 | # MRUN AUF ZIELRECHNER AUFRUFEN (queue is workaround for ibmkisti) |
---|
[1] | 4988 | echo "set -x" >> $jobfile |
---|
[693] | 4989 | echo "queue=$queue" >> $jobfile |
---|
[1] | 4990 | echo "[[ \$execute_mrun = true ]] && ./$mrun_com" >> $jobfile |
---|
| 4991 | |
---|
| 4992 | echo 'ls -al; echo `pwd`' >> $jobfile |
---|
| 4993 | echo "cd \$HOME" >> $jobfile |
---|
| 4994 | echo "rm -rf $TEMPDIR" >> $jobfile |
---|
| 4995 | |
---|
| 4996 | |
---|
| 4997 | |
---|
| 4998 | |
---|
| 4999 | # JOB PER SUBJOB STARTEN |
---|
| 5000 | if [[ $silent = false ]] |
---|
| 5001 | then |
---|
| 5002 | printf "\n " |
---|
| 5003 | else |
---|
| 5004 | printf "\n\n" |
---|
| 5005 | fi |
---|
| 5006 | |
---|
[352] | 5007 | subjob $job_on_file -h $host -u $remote_username -g $group_number -q $queue -m $memory -N $node_usage -t $cpumax $XOPT $TOPT $OOPT -n $fname -v -c $job_catalog -e $email_notification $jobfile |
---|
[1] | 5008 | rm -rf $jobfile |
---|
| 5009 | |
---|
| 5010 | |
---|
| 5011 | fi # ENDE REMOTE-TEIL |
---|
| 5012 | |
---|
| 5013 | |
---|
| 5014 | |
---|
| 5015 | # ENDE DER PROZEDUR |
---|