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