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