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