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