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