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