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