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