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