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