[1] | 1 | #!/bin/ksh |
---|
[5] | 2 | # subjob - Plot-Shellskript Version: @(#)SUBJOB 1.0 13/02/07 |
---|
[1] | 3 | |
---|
| 4 | # Prozedur zum automatischen Generieren von Batch-Jobs, die unter NQS |
---|
| 5 | # laufen sollen und deren Ergebnis (Dayfile) zum Job-generierenden |
---|
| 6 | # Host zurueckgeschickt werden sollen |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | # letzte Aenderung: |
---|
| 10 | # 29/06/94 - Siggi - Beginn mit Erstellung der Originalversion |
---|
| 11 | # 08/07/94 - Siggi - Originalversion abgeschlossen (Version 1.0) |
---|
| 12 | # 06/02/98 - Siggi - berte validiert |
---|
| 13 | # 27/01/01 - Siggi - ground.yonsei.ac.kr validiert, Jobs zur T3E in Korea |
---|
| 14 | # moeglich |
---|
| 15 | # 08/02/01 - Siggi - alle subjob-Meldungen ins englische uebersetzt |
---|
| 16 | # 25/05/02 - Siggi - Unterstuetzung des LoadLeveler |
---|
| 17 | # 30/05/02 - Siggi - Validierung fuer ibm-Rechner in Seoul (nobel) sowie |
---|
| 18 | # allgemeine Anpassungen fuer ibm-Rechner |
---|
| 19 | # 15/10/02 - Siggi - Neue Default-Jobklasse (p_normal) fuer IBM in Seoul |
---|
| 20 | # Ruecktransfer des Jobprotokolls fuer diese |
---|
| 21 | # Maschine abgeschaltet |
---|
| 22 | # 31/10/02 - Siggi - berni validiert |
---|
| 23 | # 06/11/02 - Siggi - Neue Jobklassen auf ibmb und ibmh |
---|
| 24 | # 08/11/02 - Siggi - quanero validiert |
---|
| 25 | # 11/12/02 - Siggi - Notification fuer Transfer-Jobs abgeschaltet |
---|
| 26 | # 23/01/03 - Siggi - hostname nobel changed to nobela |
---|
| 27 | # 06/02/03 - Siggi - gregale validated |
---|
| 28 | # 12/02/03 - Siggi - orkan and maestro validated |
---|
| 29 | # 21/02/03 - Siggi - all nobel nodes in Seoul validated |
---|
| 30 | # 12/03/03 - Siggi - nec at DKRZ validated |
---|
| 31 | # 13/03/03 - Siggi - new nqs resource variable Memory |
---|
| 32 | # 07/04/03 - Siggi - processor request option -c on nech needs tasks per |
---|
| 33 | # node |
---|
| 34 | # 11/04/03 - Siggi - network on ibms has attribute "shared" |
---|
| 35 | # 31/07/03 - Siggi - nqs2 on nech implemented (provisional: -h nech2) |
---|
| 36 | # cxxl added to ibmh |
---|
| 37 | # 29/08/03 - Siggi - changes in job queues and communication system on |
---|
| 38 | # ibms |
---|
| 39 | # 24/10/03 - Siggi - using alternate hanni address 130.75.4.2 |
---|
| 40 | # 30/10/03 - Siggi - nech is not supported any more |
---|
| 41 | # 10/11/03 - Siggi - nech2 renamed to nech |
---|
| 42 | # 20/11/03 - Siggi - submit command on nech changed from qsub.test to qsub |
---|
| 43 | # 29/03/04 - Siggi - ground not supported any more, gfdl3 validated |
---|
| 44 | # 31/03/04 - Siggi - new option -N for node usage |
---|
| 45 | # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha |
---|
| 46 | # due to error in ssh installation (otherwise a prompt |
---|
| 47 | # for the password appears) |
---|
| 48 | # 23/07/04 - Siggi - changes due to the new berni configuration |
---|
| 49 | # (federation switch) |
---|
| 50 | # 01/09/04 - Gerald new job-classes on hanni |
---|
| 51 | # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10 |
---|
| 52 | # 23/11/04 - Siggi - new job class cdata on hanni and berni |
---|
| 53 | # 03/12/04 - Siggi - notification on ibm switched of in case of |
---|
| 54 | # delete_dayfile = true, node usage in cdev set to |
---|
| 55 | # shared |
---|
| 56 | # 16/02/05 - Gerald hababai validated |
---|
| 57 | # 29/03/05 - Micha - new job class channi on hanni |
---|
| 58 | # 11/05/05 - Siggi - ConsumableMemory is now required as resource keyword |
---|
| 59 | # on ibms |
---|
| 60 | # 24/05/05 - Siggi - Default queue on ibms changed from p_normal_1.3 to |
---|
| 61 | # p_normal |
---|
| 62 | # 30/06/05 - Siggi - network changed for queue cdev from "us" to "ip" |
---|
| 63 | # 12/07/05 - Siggi - in network.mpi on ibmh/ibmb "csss" changed to |
---|
| 64 | # "sn_all", new job class cexp |
---|
| 65 | # 08/09/05 - Siggi - IP-address of gfdl3 changed |
---|
| 66 | # 31/10/05 - Siggi - new job class pp on hurricane, serial jobs on |
---|
| 67 | # hurricane (with -X0) |
---|
| 68 | # 01/11/05 - Siggi - missing queue for jobs submitted on nech (for nech) |
---|
| 69 | # added |
---|
| 70 | # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105 |
---|
| 71 | # 09/02/06 - Siggi - ibmy admitted |
---|
| 72 | # 10/02/06 - Siggi - scp2 changed to /bin/scp on decalpha |
---|
| 73 | # 13/04/06 - Siggi - ostria admitted |
---|
| 74 | # 18/04/06 - Siggi - new option -O for OpenMP usage |
---|
| 75 | # 24/05/06 - Siggi - lctit admitted, ftpjob renamed scpjob |
---|
| 76 | # 25/07/06 - Siggi - gfdl5 (ibmy) admitted for submitting jobs |
---|
| 77 | # 27/09/06 - Siggi - breg/hreg extended with berni/hanni |
---|
| 78 | # 25/10/06 - Siggi - data_limit set to 1.76 GByte on hanni and berni |
---|
| 79 | # 28/11/06 - Siggi - levanto admitted |
---|
[5] | 80 | # 13/02/07 - Siggi - hpmuk releated code removed |
---|
[1] | 81 | |
---|
| 82 | |
---|
| 83 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
| 84 | delete_dayfile=false |
---|
| 85 | filetransfer_protocol=scp |
---|
| 86 | locat=normal |
---|
| 87 | no_default_queue=none |
---|
| 88 | no_submit=false |
---|
| 89 | job_catalog="~/job_queue" |
---|
| 90 | job_name=none |
---|
| 91 | local_user=$LOGNAME |
---|
| 92 | node_usage=shared |
---|
| 93 | numprocs=1 |
---|
| 94 | punkte="..........................................................." |
---|
| 95 | submcom=qsub |
---|
| 96 | queue=default |
---|
| 97 | remote_host=none |
---|
| 98 | remote_user="" |
---|
| 99 | verify=true |
---|
| 100 | |
---|
| 101 | typeset -i cputime=0 memory=0 Memory=0 minuten resttime sekunden stunden |
---|
| 102 | typeset -i inumprocs nodes=0 tasks_per_node=0 threads_per_task=1 |
---|
| 103 | typeset -L20 spalte1 |
---|
| 104 | typeset -R40 spalte2 |
---|
| 105 | typeset -L60 spalte3 |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | # FEHLERBEHANDLUNG |
---|
| 110 | # BEI EXIT: |
---|
| 111 | trap 'if [[ $locat != normal ]] |
---|
| 112 | then |
---|
| 113 | case $locat in |
---|
| 114 | (option) printf "\n --> available optios can be displayed" |
---|
| 115 | printf " by typing:" |
---|
| 116 | printf "\n \"subjob ?\" \n";; |
---|
| 117 | (ftpcopy|parameter|scp|verify) printf "\n";; |
---|
| 118 | (*) printf "\n +++ unknown error" |
---|
| 119 | printf "\n please inform S. Raasch!\n" |
---|
| 120 | esac |
---|
| 121 | [[ -f $job_to_send ]] && rm $job_to_send |
---|
| 122 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
| 123 | fi' exit |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | # BEI TERMINAL-BREAK: |
---|
| 127 | trap '[[ -f $job_to_send ]] && rm $job_to_send |
---|
| 128 | printf "\n\n+++ SUBJOB killed \n\n" |
---|
| 129 | exit |
---|
| 130 | ' 2 |
---|
| 131 | |
---|
| 132 | |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | # LOKALEN HOSTNAMEN FESTSTELLEN |
---|
| 136 | local_host=$(hostname) |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | # HOSTSPEZIFISCHE VARIABLEN VEREINBAREN BZW. PRUEFEN, OB LOKALER HOST |
---|
| 141 | # UEBERHAUPT ZULAESSIG IST |
---|
| 142 | case $local_host in |
---|
| 143 | (atmos) local_addres=172.20.25.35; local_host=lcide;; |
---|
[5] | 144 | (bora) local_addres=130.75.105.103; local_host=lcmuk;; |
---|
[1] | 145 | (breg*-en0|berni*-en0) local_addres=130.73.230.10; local_host=ibmb;; |
---|
[12] | 146 | (breva) local_addres=130.75.105.98; local_host=lcmuk;; |
---|
[1] | 147 | (cs*) local_addres=136.172.44.131; local_host=nech;; |
---|
[5] | 148 | (elephanta) local_addres=130.75.105.6; local_host=lcmuk;; |
---|
[1] | 149 | (gfdl5) local_addres=165.132.26.58; local_host=ibmy;; |
---|
| 150 | (gfdl3.yonsei.ac.kr) local_addres=165.132.26.56; local_host=decalpha;; |
---|
[5] | 151 | (gregale) local_addres=130.75.105.109; local_host=lcmuk;; |
---|
| 152 | (hababai) local_addres=130.75.105.108; local_host=lcmuk;; |
---|
[1] | 153 | (hreg*-en0|hanni*-en0) local_addres=130.75.4.10; local_host=ibmh;; |
---|
[5] | 154 | (irifi) local_addres=130.75.105.104; local_host=lcmuk;; |
---|
| 155 | (levanto) local_addres=130.75.105.45; local_host=lcmuk;; |
---|
| 156 | (maestro) local_addres=130.75.105.2; local_host=lcmuk;; |
---|
[1] | 157 | (nobel*) local_addres=150.183.5.101; local_host=ibms;; |
---|
[5] | 158 | (orkan) local_addres=130.75.105.3; local_host=lcmuk;; |
---|
| 159 | (ostria) local_addres=130.75.105.106; local_host=lcmuk;; |
---|
| 160 | (quanero) local_addres=130.75.105.107; local_host=lcmuk;; |
---|
[1] | 161 | (scirocco) local_addres=172.20.25.41; local_host=lcmuk;; |
---|
| 162 | (sun1|sun2) local_addres=130.75.6.1; local_host=unics;; |
---|
| 163 | (tgg*) local_addres=172.17.75.161; local_host=lctit;; |
---|
| 164 | (vorias) local_addres=172.20.25.43; local_host=lcmuk;; |
---|
| 165 | (*) printf "\n +++ \"$local_host\" unknown"; |
---|
| 166 | printf "\n please inform S. Raasch!"; |
---|
| 167 | locat=parameter; exit;; |
---|
| 168 | esac |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | # REMOTE HOST DEFAULTMAESSIG = LOCAL HOST SETZEN |
---|
| 173 | remote_host=$local_host |
---|
| 174 | |
---|
| 175 | |
---|
| 176 | |
---|
| 177 | |
---|
| 178 | # PROZEDUROPTIONEN EINLESEN |
---|
| 179 | while getopts :c:dDf:h:m:n:N:O:q:t:T:u:vX: option |
---|
| 180 | do |
---|
| 181 | case $option in |
---|
| 182 | (c) job_catalog=$OPTARG;; |
---|
| 183 | (d) delete_dayfile=true;; |
---|
| 184 | (D) no_submit=true;; |
---|
| 185 | (f) filetransfer_protocol=$OPTARG;; |
---|
| 186 | (h) remote_host=$OPTARG;; |
---|
| 187 | (m) memory=$OPTARG;; |
---|
| 188 | (n) job_name=$OPTARG;; |
---|
| 189 | (N) node_usage=$OPTARG;; |
---|
| 190 | (O) threads_per_task=$OPTARG;; |
---|
| 191 | (q) no_default_queue=$OPTARG;; |
---|
| 192 | (t) cputime=$OPTARG;; |
---|
| 193 | (T) tasks_per_node=$OPTARG;; |
---|
| 194 | (u) remote_user=$OPTARG;; |
---|
| 195 | (v) verify=false;; |
---|
| 196 | (X) numprocs=$OPTARG;; |
---|
| 197 | (\?) printf "\n +++ Option $OPTARG unknown \n"; |
---|
| 198 | locat=option; exit;; |
---|
| 199 | esac |
---|
| 200 | done |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | # JOBDATEINAMEN ALS NAECHSTES ARGUMENT HOLEN |
---|
| 204 | shift OPTIND-1; file_to_send=$1 |
---|
| 205 | |
---|
| 206 | |
---|
| 207 | # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN |
---|
| 208 | if [ "$1" = "?" ] |
---|
| 209 | then |
---|
| 210 | (printf "\n *** subjob can be called as follows:\n" |
---|
| 211 | printf "\n subjob -c.. -d -D -h.. -m.. -q.. -t.. -u.. -v <jobfile>\n" |
---|
| 212 | printf "\n Description of available options:\n" |
---|
| 213 | printf "\n Option Description Default-Value" |
---|
| 214 | printf "\n -c job-input- and output-catalog ~/job_queue" |
---|
| 215 | printf "\n -d no job-protocol will be created ---" |
---|
| 216 | printf "\n -D only the job-file will be created ---" |
---|
| 217 | printf "\n -f filetransfer protocol scp" |
---|
| 218 | printf "\n -h execution host, available hosts: $remote_host" |
---|
[5] | 219 | printf "\n ibm, ibmb, ibmh, ibms, ibmy, lcmuk," |
---|
[1] | 220 | printf "\n unics" |
---|
| 221 | printf "\n -m memory demand per process in MByte ---" |
---|
| 222 | printf "\n -n jobname <jobdatei>" |
---|
| 223 | printf "\n -O threads per task (for OpenMP usage) 1" |
---|
| 224 | printf "\n -q job-queue to be used default" |
---|
| 225 | printf "\n -t allowed cpu-time in seconds ---" |
---|
| 226 | printf "\n -T tasks per node (on parallel hosts) ---" |
---|
| 227 | printf "\n -u username on execution host from .netrc" |
---|
| 228 | printf "\n -v no prompt for confirmation ---" |
---|
| 229 | printf "\n -X # of processors (on parallel hosts) 1" |
---|
| 230 | printf "\n " |
---|
| 231 | printf "\n The only possible positional parameter is <jobfile>:" |
---|
| 232 | printf "\n The complete NQS-job must be provided here." |
---|
| 233 | printf "\n <jobfile>=? creates this outline\n\n") | more |
---|
| 234 | exit |
---|
| 235 | fi |
---|
| 236 | |
---|
| 237 | |
---|
| 238 | |
---|
| 239 | # PRUEFEN, OB JOBDATEI ANGEGEBEN WURDE UND OB SIE AUCH EXISTIERT |
---|
| 240 | if [[ "$file_to_send" = "" ]] |
---|
| 241 | then |
---|
| 242 | printf "\n +++ job-file missing" |
---|
| 243 | locat=parameter; exit |
---|
| 244 | else |
---|
| 245 | if [[ -f $file_to_send ]] |
---|
| 246 | then |
---|
| 247 | true |
---|
| 248 | else |
---|
| 249 | printf "\n +++ job-file: " |
---|
| 250 | printf "\n $file_to_send" |
---|
| 251 | printf "\n does not exist" |
---|
| 252 | locat=parameter; exit |
---|
| 253 | fi |
---|
| 254 | fi |
---|
| 255 | |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | # FALLS KEIN JOBNAME ANGEGEBEN WURDE, WIRD JOBNAME = JOBDATEINAME |
---|
| 259 | # GESETZT. VORAUSSETZUNG: JOBDATEINAME BEINHALTET KEINE PFADE |
---|
| 260 | if [[ $job_name = none ]] |
---|
| 261 | then |
---|
| 262 | job_name=$file_to_send |
---|
| 263 | fi |
---|
| 264 | if [[ $(echo $job_name | grep -c "/") != 0 ]] |
---|
| 265 | then |
---|
| 266 | printf "\n +++ job-file name: " |
---|
| 267 | printf "\n $job_name" |
---|
| 268 | printf "\n must not contain \"/\"-characters" |
---|
| 269 | locat=parameter; exit |
---|
| 270 | fi |
---|
| 271 | |
---|
| 272 | |
---|
| 273 | |
---|
| 274 | |
---|
| 275 | # HOSTSPEZIFISCHE GROESSEN VEREINBAREN BZW. ABBRUCH BEI UNZULAESSIGEM HOST |
---|
| 276 | # ODER WENN HOST NICHT ANGEGEBEN WURDE |
---|
| 277 | if [[ $remote_host = none ]] |
---|
| 278 | then |
---|
| 279 | printf "\n +++ host missing" |
---|
| 280 | locat=option; exit |
---|
| 281 | else |
---|
| 282 | case $remote_host in |
---|
| 283 | (ibm) queue=p690_standard; remote_addres=134.76.99.81; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 284 | (ibmb) queue=cpar; remote_addres=130.73.230.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 285 | (ibmh) queue=cpar; remote_addres=130.75.4.10; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 286 | (ibms) queue=p_normal; remote_addres=150.183.5.101; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 287 | (ibmy) queue=parallel; remote_addres=165.132.26.58; submcom=/usr/lpp/LoadL/full/bin/llsubmit;; |
---|
| 288 | (lctit) queue=test; remote_addres=172.17.75.161; submcom=/n1ge/TITECH_GRID/tools/bin/n1ge;; |
---|
| 289 | (nech) qsubmem=memsz_job; qsubtime=cputim_job; remote_addres=136.172.44.147; submcom="/usr/local/bin/qsub";; |
---|
| 290 | (vpp) qsubmem=m; qsubtime=t; queue=vpp; remote_addres=130.75.4.130;; |
---|
| 291 | (unics) qsubmem=d; qsubtime=t; queue=unics; remote_addres=130.75.6.1;; |
---|
| 292 | (*) printf "\n +++ hostname \"$remote_host\" not allowed"; |
---|
| 293 | locat=parameter; exit;; |
---|
| 294 | esac |
---|
| 295 | fi |
---|
| 296 | |
---|
| 297 | |
---|
| 298 | # EVTL. PRUEFEN, OB ANGEGEBENE QUEUE ZULAESSIG IST |
---|
| 299 | if [[ $no_default_queue != none ]] |
---|
| 300 | then |
---|
| 301 | error=false |
---|
| 302 | ndq=$no_default_queue |
---|
| 303 | case $remote_host in |
---|
| 304 | (ibm) case $ndq in |
---|
| 305 | (p690_express|p690_standard|p690_long) error=false;; |
---|
| 306 | (*) error=true;; |
---|
| 307 | esac;; |
---|
| 308 | (ibmb) case $ndq in |
---|
| 309 | (cdata|cdev|cexp|c1|cshare|csolo|cspec) error=false;; |
---|
| 310 | (*) error=true;; |
---|
| 311 | esac;; |
---|
| 312 | (ibmh) case $ndq in |
---|
| 313 | (cdata|cdev|cexp|channi|cxxl|c1|cshare|csolo|cspec) error=false;; |
---|
| 314 | (*) error=true;; |
---|
| 315 | esac;; |
---|
| 316 | (ibms) case $ndq in |
---|
| 317 | (express|normal|p_express|p_normal|p_normal_1.3|p_normal_1.7|grand) error=false;; |
---|
| 318 | (*) error=true;; |
---|
| 319 | esac;; |
---|
| 320 | (ibmy) case $ndq in |
---|
| 321 | (parallel) error=false;; |
---|
| 322 | (*) error=true;; |
---|
| 323 | esac;; |
---|
| 324 | (lctit) case $ndq in |
---|
| 325 | (cs|default|high|test) error=false;; |
---|
| 326 | (*) error=true;; |
---|
| 327 | esac;; |
---|
| 328 | (t3eb) case $ndq in |
---|
| 329 | (berte|p50|p100|p392|forfree|p25himem) error=false;; |
---|
| 330 | (*) error=true;; |
---|
| 331 | esac;; |
---|
| 332 | (t3eh) case $ndq in |
---|
| 333 | (para_t3e|em|k|l|lm|comp_t3e|c|p|ht) error=false;; |
---|
| 334 | (*) error=true;; |
---|
| 335 | esac;; |
---|
| 336 | (t3ej2|t3ej5) case $ndq in |
---|
| 337 | (low|normal|high) error=false;; |
---|
| 338 | (*) error=true;; |
---|
| 339 | esac;; |
---|
| 340 | (t3es) case $ndq in |
---|
| 341 | (batch|serial-4|pe4|p48|pe16|pe32|pe64|pe128) error=false;; |
---|
| 342 | (*) error=true;; |
---|
| 343 | esac;; |
---|
| 344 | (unics) case $ndq in |
---|
| 345 | (unics|ht) error=false;; |
---|
| 346 | (*) error=true;; |
---|
| 347 | esac;; |
---|
| 348 | esac |
---|
| 349 | if [[ $error = true ]] |
---|
| 350 | then |
---|
| 351 | printf "\n +++ queue \"$no_default_queue\" on host \"$remote_host\" not allowed" |
---|
| 352 | locat=parameter; exit |
---|
| 353 | else |
---|
| 354 | queue=$no_default_queue |
---|
| 355 | fi |
---|
| 356 | fi |
---|
| 357 | |
---|
| 358 | |
---|
| 359 | |
---|
| 360 | # KNOTENNUTZUNG IN ENTWICKLERQUEUE MUSS SHARED SEIN |
---|
| 361 | if [[ $node_usage != shared && $queue = cdev ]] |
---|
| 362 | then |
---|
| 363 | node_usage=shared |
---|
| 364 | fi |
---|
| 365 | |
---|
| 366 | |
---|
| 367 | |
---|
| 368 | # PRUEFEN DER CPU-ZEIT, ZEIT NACH STUNDEN, MINUTEN UND SEKUNDEN |
---|
| 369 | # AUFTEILEN |
---|
| 370 | done=false |
---|
| 371 | while [[ $done = false ]] |
---|
| 372 | do |
---|
| 373 | if (( $cputime <= 0 )) |
---|
| 374 | then |
---|
| 375 | printf "\n +++ wrong cpu-time or cpu-time missing" |
---|
| 376 | printf "\n >>> Please type cpu-time in seconds as INTEGER:" |
---|
| 377 | printf "\n >>> " |
---|
| 378 | read cputime 1>/dev/null 2>&1 |
---|
| 379 | else |
---|
| 380 | done=true |
---|
| 381 | fi |
---|
| 382 | done |
---|
| 383 | if [[ $remote_host = nech ]] |
---|
| 384 | then |
---|
| 385 | if (( tasks_per_node != 0 )) |
---|
| 386 | then |
---|
| 387 | (( cputime = cputime * tasks_per_node )) |
---|
| 388 | elif [[ $numprocs != 0 ]] |
---|
| 389 | then |
---|
| 390 | (( cputime = cputime * numprocs )) |
---|
| 391 | fi |
---|
| 392 | fi |
---|
| 393 | (( stunden = cputime / 3600 )) |
---|
| 394 | (( resttime = cputime - stunden * 3600 )) |
---|
| 395 | (( minuten = resttime / 60 )) |
---|
| 396 | (( sekunden = resttime - minuten * 60 )) |
---|
| 397 | timestring=${stunden}:${minuten}:${sekunden} |
---|
| 398 | |
---|
| 399 | |
---|
| 400 | |
---|
| 401 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
| 402 | done=false |
---|
| 403 | while [[ $done = false ]] |
---|
| 404 | do |
---|
| 405 | if (( memory <= 0 )) |
---|
| 406 | then |
---|
| 407 | printf "\n +++ wrong memory demand or memory demand missing" |
---|
| 408 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
| 409 | printf "\n >>> " |
---|
| 410 | read memory 1>/dev/null 2>&1 |
---|
| 411 | else |
---|
| 412 | done=true |
---|
| 413 | fi |
---|
| 414 | done |
---|
| 415 | |
---|
| 416 | if [[ $remote_host = nech ]] |
---|
| 417 | then |
---|
| 418 | if (( tasks_per_node != 0 )) |
---|
| 419 | then |
---|
| 420 | (( Memory = memory * tasks_per_node / 1000 )) |
---|
| 421 | elif [[ $numprocs != 0 ]] |
---|
| 422 | then |
---|
| 423 | (( Memory = memory * numprocs / 1000 )) |
---|
| 424 | else |
---|
| 425 | (( Memory = memory / 1000 )) |
---|
| 426 | fi |
---|
| 427 | fi |
---|
| 428 | |
---|
| 429 | |
---|
| 430 | # SPEICHERBERECHNUNG BEI OPENMP-NUTZUNG |
---|
| 431 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 432 | then |
---|
| 433 | (( memory = memory * threads_per_task )) |
---|
| 434 | fi |
---|
| 435 | |
---|
| 436 | |
---|
| 437 | # BERECHNUNG DER ANZAHL DER ZU VERWENDENDEN KNOTEN |
---|
| 438 | if (( tasks_per_node != 0 )) |
---|
| 439 | then |
---|
| 440 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
| 441 | fi |
---|
| 442 | |
---|
| 443 | |
---|
| 444 | |
---|
| 445 | # HEADER-AUSGABE |
---|
| 446 | if [[ $verify = true ]] |
---|
| 447 | then |
---|
| 448 | printf "\n\n" |
---|
| 449 | printf "#--------------------------------------------------------------# \n" |
---|
| 450 | spalte1=SUBJOB;spalte2=$(date) |
---|
| 451 | printf "| $spalte1$spalte2 | \n" |
---|
| 452 | printf "| | \n" |
---|
| 453 | printf "| values of parameters/options: | \n" |
---|
| 454 | spalte1=local_host$punkte; spalte2=$punkte$local_host |
---|
| 455 | printf "| $spalte1$spalte2 | \n" |
---|
| 456 | spalte1=remote_host$punkte; spalte2=$punkte$remote_host |
---|
| 457 | printf "| $spalte1$spalte2 | \n" |
---|
| 458 | spalte1=queue$punkte; spalte2=$punkte$queue |
---|
| 459 | printf "| $spalte1$spalte2 | \n" |
---|
| 460 | spalte1=memory$punkte; spalte2="$punkte$memory mb" |
---|
| 461 | printf "| $spalte1$spalte2 | \n" |
---|
| 462 | spalte1=cputime$punkte; spalte2="$punkte$cputime sec" |
---|
| 463 | printf "| $spalte1$spalte2 | \n" |
---|
| 464 | spalte1=job_name$punkte; spalte2="$punkte$job_name" |
---|
| 465 | printf "| $spalte1$spalte2 | \n" |
---|
| 466 | printf "#--------------------------------------------------------------# \n\n" |
---|
| 467 | |
---|
| 468 | |
---|
| 469 | # KONTROLLABFRAGE, OB ALLES O.K. |
---|
| 470 | antwort="dummy" |
---|
| 471 | while [[ $antwort != y && $antwort != Y && $antwort != n && $antwort != N ]] |
---|
| 472 | do |
---|
| 473 | read antwort?" >>> continue (y/n) ? " |
---|
| 474 | done |
---|
| 475 | if [[ $antwort = n || $antwort = N ]] |
---|
| 476 | then |
---|
| 477 | locat=verify; exit |
---|
| 478 | fi |
---|
| 479 | printf "\n" |
---|
| 480 | fi |
---|
| 481 | |
---|
| 482 | |
---|
| 483 | |
---|
| 484 | # ZUFALLSKENNUNG GENERIEREN UND JOBNAMEN AUF ZIELRECHNER BESTIMMEN |
---|
| 485 | kennung=$RANDOM |
---|
| 486 | job_on_remhost=${job_name}_${kennung}_$local_host |
---|
| 487 | job_to_send=job_to_send_$kennung |
---|
| 488 | if [[ $delete_dayfile = false ]] |
---|
| 489 | then |
---|
| 490 | remote_dayfile=${local_host}_${job_name}_result_$kennung |
---|
| 491 | local_dayfile=${remote_host}_${job_name} |
---|
| 492 | else |
---|
| 493 | remote_dayfile=/dev/null |
---|
| 494 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 495 | then |
---|
| 496 | notification='# @ notification = never' |
---|
| 497 | fi |
---|
| 498 | fi |
---|
| 499 | |
---|
| 500 | |
---|
| 501 | |
---|
| 502 | # QSUB- ODER LL-KOMMANDOS BZW. SKRIPTE GENERIEREN |
---|
| 503 | if [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs != 0 ]] |
---|
| 504 | then |
---|
| 505 | |
---|
| 506 | if [[ $remote_host = ibmy ]] |
---|
| 507 | then |
---|
| 508 | consumable_memory="" |
---|
| 509 | else |
---|
| 510 | consumable_memory="ConsumableMemory($memory mb)" |
---|
| 511 | fi |
---|
| 512 | if [[ $queue = cdev ]] |
---|
| 513 | then |
---|
| 514 | data_limit="# @ data_limit = 1.76gb" |
---|
| 515 | network_to_use="# @ network.mpi = sn_all,shared,ip" |
---|
| 516 | else |
---|
| 517 | if [[ $remote_host = ibms ]] |
---|
| 518 | then |
---|
| 519 | network_to_use="# @ network.mpi = csss,shared,us" |
---|
| 520 | elif [[ $remote_host = ibmy ]] |
---|
| 521 | then |
---|
| 522 | network_to_use="" |
---|
| 523 | else |
---|
| 524 | network_to_use="# @ network.mpi = sn_all,shared,us" |
---|
| 525 | data_limit="# @ data_limit = 1.76gb" |
---|
| 526 | fi |
---|
| 527 | fi |
---|
| 528 | |
---|
| 529 | cat > $job_to_send << %%END%% |
---|
| 530 | #!/bin/ksh |
---|
| 531 | |
---|
| 532 | # @ job_type = parallel |
---|
| 533 | # @ job_name = palm |
---|
| 534 | # @ wall_clock_limit = ${timestring},$timestring |
---|
| 535 | # @ resources = ConsumableCpus($threads_per_task) $consumable_memory |
---|
| 536 | # @ output = $remote_dayfile |
---|
| 537 | # @ error = $remote_dayfile |
---|
| 538 | # @ image_size = 50 |
---|
| 539 | # @ class = $queue |
---|
| 540 | # @ environment = OMP_NUM_THREADS=$threads_per_task; MP_SHARED_MEMORY=yes |
---|
| 541 | $network_to_use |
---|
| 542 | $data_limit |
---|
| 543 | $notification |
---|
| 544 | |
---|
| 545 | %%END%% |
---|
| 546 | |
---|
| 547 | if (( nodes > 0 )) |
---|
| 548 | then |
---|
| 549 | |
---|
| 550 | cat >> $job_to_send << %%END%% |
---|
| 551 | # @ node = $nodes |
---|
| 552 | # @ tasks_per_node = $tasks_per_node |
---|
| 553 | # @ node_usage = $node_usage |
---|
| 554 | # @ queue |
---|
| 555 | |
---|
| 556 | %%END%% |
---|
| 557 | |
---|
| 558 | else |
---|
| 559 | |
---|
| 560 | if [[ $remote_host != ibmy ]] |
---|
| 561 | then |
---|
| 562 | |
---|
| 563 | cat >> $job_to_send << %%END%% |
---|
| 564 | # @ blocking = unlimited |
---|
| 565 | # @ total_tasks = $numprocs |
---|
| 566 | # @ node_usage = $node_usage |
---|
| 567 | # @ queue |
---|
| 568 | |
---|
| 569 | %%END%% |
---|
| 570 | |
---|
| 571 | else |
---|
| 572 | |
---|
| 573 | cat >> $job_to_send << %%END%% |
---|
| 574 | # @ node = 1 |
---|
| 575 | # @ total_tasks = $numprocs |
---|
| 576 | # @ queue |
---|
| 577 | |
---|
| 578 | %%END%% |
---|
| 579 | |
---|
| 580 | fi |
---|
| 581 | |
---|
| 582 | fi |
---|
| 583 | |
---|
| 584 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $numprocs = 0 ]] |
---|
| 585 | then |
---|
| 586 | |
---|
| 587 | cat > $job_to_send << %%END%% |
---|
| 588 | #!/bin/ksh |
---|
| 589 | |
---|
| 590 | # @ job_type = serial |
---|
| 591 | # @ node_usage = $node_usage |
---|
| 592 | # @ job_name = palm |
---|
| 593 | # @ wall_clock_limit = ${timestring},$timestring |
---|
| 594 | # @ resources = ConsumableCpus(1) ConsumableMemory(1 gb) |
---|
| 595 | # @ output = $remote_dayfile |
---|
| 596 | # @ error = $remote_dayfile |
---|
| 597 | # @ class = $queue |
---|
| 598 | $notification |
---|
| 599 | |
---|
| 600 | # @ queue |
---|
| 601 | |
---|
| 602 | %%END%% |
---|
| 603 | |
---|
| 604 | elif [[ $remote_host = nech ]] |
---|
| 605 | then |
---|
| 606 | |
---|
| 607 | if (( nodes > 1 )) |
---|
| 608 | then |
---|
| 609 | cat > $job_to_send << %%END%% |
---|
| 610 | #!/bin/ksh |
---|
| 611 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
| 612 | #PBS -l ${qsubmem}=${Memory}gb |
---|
| 613 | #PBS -b $nodes |
---|
| 614 | #PBS -o $remote_dayfile |
---|
| 615 | #PBS -N palm |
---|
| 616 | #PBS -j o |
---|
| 617 | #PBS -T mpisx |
---|
| 618 | |
---|
| 619 | %%END%% |
---|
| 620 | |
---|
| 621 | elif [[ $numprocs != 0 ]] |
---|
| 622 | then |
---|
| 623 | cat > $job_to_send << %%END%% |
---|
| 624 | #!/bin/ksh |
---|
| 625 | #PBS -l cpunum_prc=$tasks_per_node,cputim_job=$cputime |
---|
| 626 | #PBS -l ${qsubmem}=${Memory}gb |
---|
| 627 | #PBS -o $remote_dayfile |
---|
| 628 | #PBS -N palm |
---|
| 629 | #PBS -j o |
---|
| 630 | |
---|
| 631 | %%END%% |
---|
| 632 | |
---|
| 633 | else |
---|
| 634 | cat > $job_to_send << %%END%% |
---|
| 635 | #!/bin/ksh |
---|
| 636 | #PBS -l ${qsubmem}=${Memory}gb,${qsubtime}=$cputime |
---|
| 637 | #PBS -o $remote_dayfile |
---|
| 638 | #PBS -j o |
---|
| 639 | |
---|
| 640 | %%END%% |
---|
| 641 | |
---|
| 642 | fi |
---|
| 643 | |
---|
| 644 | elif [[ $remote_host = lctit ]] |
---|
| 645 | then |
---|
| 646 | cat > $job_to_send << %%END%% |
---|
| 647 | #!/bin/bash |
---|
| 648 | #$ -S /bin/bash |
---|
| 649 | cd $job_catalog |
---|
| 650 | PATH=$job_catalog:${job_catalog}/../pub:\$PATH |
---|
| 651 | export PATH |
---|
| 652 | |
---|
| 653 | %%END%% |
---|
| 654 | |
---|
| 655 | # OPTIONEN FUER SUBMIT-KOMMANDO ZUSAMMENSTELLEN |
---|
| 656 | submcom="$submcom -N $job_name -sgeout $remote_dayfile -q default" |
---|
| 657 | |
---|
| 658 | else |
---|
| 659 | |
---|
| 660 | cat > $job_to_send << %%END%% |
---|
| 661 | # @\$-q ${queue} |
---|
| 662 | # @\$-l${qsubtime} $timestring |
---|
| 663 | # @\$-l${qsubmem} ${memory}mb |
---|
| 664 | # @\$-o $remote_dayfile |
---|
| 665 | # @\$-eo |
---|
| 666 | |
---|
| 667 | %%END%% |
---|
| 668 | |
---|
| 669 | fi |
---|
| 670 | |
---|
| 671 | |
---|
| 672 | # BEI RECHNUNG AUF REMOTE-MASCHINEN RUECKTRANSFER DES DAYFILES PER TRAP |
---|
| 673 | # BEI EXIT VERANLASSEN |
---|
| 674 | # VEKTORRECHNER MUSS EIGENEN JOB STARTEN, DA DORT NOHUP NICHT FUNKTIONIERT |
---|
| 675 | # AUF IBM IN SEOUL IST RUECKTRANSFER ZUR ZEIT GENERELL NICHT MOEGLICH |
---|
| 676 | if [[ $delete_dayfile = false && $remote_host != $local_host ]] |
---|
| 677 | then |
---|
| 678 | echo "set +vx" >> $job_to_send |
---|
| 679 | echo "trap '" >> $job_to_send |
---|
| 680 | echo "set +vx" >> $job_to_send |
---|
| 681 | if [[ $(echo $remote_host | cut -c1-3) = ibm || $remote_host = nech || $remote_host = lctit ]] |
---|
| 682 | then |
---|
| 683 | if [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 684 | then |
---|
| 685 | return_queue=c1 |
---|
| 686 | elif [[ $remote_host = ibms ]] |
---|
| 687 | then |
---|
| 688 | return_queue=p_normal |
---|
| 689 | elif [[ $remote_host = ibmy ]] |
---|
| 690 | then |
---|
| 691 | return_queue=serial |
---|
| 692 | elif [[ $remote_host = lctit ]] |
---|
| 693 | then |
---|
| 694 | return_queue=default |
---|
| 695 | elif [[ $remote_host = t3eb ]] |
---|
| 696 | then |
---|
| 697 | return_queue=berte |
---|
| 698 | elif [[ $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
| 699 | then |
---|
| 700 | return_queue=normal |
---|
| 701 | elif [[ $remote_host = t3es ]] |
---|
| 702 | then |
---|
| 703 | return_queue=batch |
---|
| 704 | else |
---|
| 705 | return_queue=unknown |
---|
| 706 | fi |
---|
| 707 | |
---|
| 708 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 709 | then |
---|
| 710 | |
---|
| 711 | echo "echo \"#!/bin/ksh\" >> scpjob.$kennung" >> $job_to_send |
---|
| 712 | echo "echo \"# @ job_type = serial\" >> scpjob.$kennung" >> $job_to_send |
---|
| 713 | echo "echo \"# @ job_name = transfer\" >> scpjob.$kennung" >> $job_to_send |
---|
| 714 | echo "echo \"# @ resources = ConsumableCpus(1) ConsumableMemory(1 gb)\" >> scpjob.$kennung" >> $job_to_send |
---|
| 715 | echo "echo \"# @ wall_clock_limit = 00:10:00,00:10:00\" >> scpjob.$kennung " >> $job_to_send |
---|
| 716 | echo "echo \"# @ output = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
| 717 | echo "echo \"# @ error = job_queue/last_job_transfer_protocol\" >> scpjob.$kennung" >> $job_to_send |
---|
| 718 | echo "echo \"# @ class = $return_queue\" >> scpjob.$kennung" >> $job_to_send |
---|
| 719 | echo "echo \"# @ image_size = 10\" >> scpjob.$kennung" >> $job_to_send |
---|
| 720 | echo "echo \"# @ notification = never\" >> scpjob.$kennung" >> $job_to_send |
---|
| 721 | |
---|
| 722 | echo "echo \"# @ queue\" >> scpjob.$kennung" >> $job_to_send |
---|
| 723 | echo "echo \" \" >> scpjob.$kennung" >> $job_to_send |
---|
| 724 | |
---|
| 725 | echo "echo \"set -x\" >> scpjob.$kennung" >> $job_to_send |
---|
| 726 | echo "echo \"batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \\\"$job_catalog\\\" $local_dayfile\" >> scpjob.$kennung" >> $job_to_send |
---|
| 727 | echo "echo \"exit\" >> scpjob.$kennung" >> $job_to_send |
---|
| 728 | |
---|
| 729 | elif [[ $remote_host = nech ]] |
---|
| 730 | then |
---|
| 731 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
| 732 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
| 733 | echo "#PBS -l ${qsubmem}=1GB,${qsubtime}=100" >> $job_to_send |
---|
| 734 | echo "#PBS -o last_job_transfer_protocol" >> $job_to_send |
---|
| 735 | echo "#PBS -j o" >> $job_to_send |
---|
| 736 | echo " " >> $job_to_send |
---|
| 737 | echo "set -x" >> $job_to_send |
---|
| 738 | echo "cd /pf/b/${remote_user}/job_queue" >> $job_to_send |
---|
| 739 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
| 740 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
| 741 | echo "%%END%%" >> $job_to_send |
---|
| 742 | |
---|
| 743 | elif [[ $remote_host = lctit ]] |
---|
| 744 | then |
---|
| 745 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
| 746 | echo "set -x" >> $job_to_send |
---|
| 747 | echo "PATH=\$PATH:$job_catalog/../pub" >> $job_to_send |
---|
| 748 | echo "cd $job_catalog" >> $job_to_send |
---|
| 749 | echo "batch_scp -d -w 10 -u $local_user $local_addres $remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
| 750 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
| 751 | echo "%%END%%" >> $job_to_send |
---|
| 752 | |
---|
| 753 | else |
---|
| 754 | |
---|
| 755 | echo "cat > scpjob.$kennung << %%END%%" >> $job_to_send |
---|
| 756 | echo "# @\\\$-q $return_queue" >> $job_to_send |
---|
| 757 | echo "# @\\\$-l${qsubtime} 10" >> $job_to_send |
---|
| 758 | echo "# @\\\$-l${qsubmem} 10mb" >> $job_to_send |
---|
| 759 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es ]] |
---|
| 760 | then |
---|
| 761 | echo "# @\$-l mpp_p=0" >> $job_to_send |
---|
| 762 | fi |
---|
| 763 | echo '# @\$-lF 10mb' >> $job_to_send |
---|
| 764 | # echo '# @\$-o /dev/null' >> $job_to_send |
---|
| 765 | echo '# @\$-o job_queue/last_job_transfer_protocol' >> $job_to_send |
---|
| 766 | echo '# @\\\$-eo' >> $job_to_send |
---|
| 767 | echo " " >> $job_to_send |
---|
| 768 | if [[ $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
| 769 | then |
---|
| 770 | echo "set +vx" >> $job_to_send |
---|
| 771 | echo ". .profile" >> $job_to_send |
---|
| 772 | fi |
---|
| 773 | echo "set -x" >> $job_to_send |
---|
| 774 | echo "batch_scp -d -w 10 -u $local_user $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null" >> $job_to_send |
---|
| 775 | echo "[[ \"\$for_subjob_to_do\" != \"\" ]] && eval \$for_subjob_to_do" >> $job_to_send |
---|
| 776 | echo "%%END%%" >> $job_to_send |
---|
| 777 | fi |
---|
| 778 | |
---|
| 779 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 780 | then |
---|
| 781 | echo "llsubmit scpjob.$kennung" >> $job_to_send |
---|
| 782 | elif [[ $remote_host = lctit ]] |
---|
| 783 | then |
---|
| 784 | echo "chmod u+x scpjob.$kennung" >> $job_to_send |
---|
| 785 | echo "rm -rf ${job_catalog}/last_job_transfer_protocol" >> $job_to_send |
---|
| 786 | echo "n1ge -N jobtransfer -q $return_queue -sgeout ${job_catalog}/last_job_transfer_protocol scpjob.$kennung" >> $job_to_send |
---|
| 787 | echo "sleep 10" >> $job_to_send |
---|
| 788 | elif [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 ]] |
---|
| 789 | then |
---|
| 790 | echo "qsub -J n scpjob.$kennung" >> $job_to_send |
---|
| 791 | elif [[ $remote_host = t3es ]] |
---|
| 792 | then |
---|
| 793 | echo "qsub -J n -s /bin/ksh scpjob.$kennung" >> $job_to_send |
---|
| 794 | else |
---|
| 795 | echo "qsub scpjob.$kennung" >> $job_to_send |
---|
| 796 | fi |
---|
| 797 | echo "rm scpjob.$kennung" >> $job_to_send |
---|
| 798 | if [[ $remote_host = nech ]] |
---|
| 799 | then |
---|
| 800 | echo "cd -" >> $job_to_send |
---|
| 801 | fi |
---|
| 802 | else |
---|
| 803 | # echo "ftpcopy -d $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile" >> $job_to_send |
---|
| 804 | echo "nohup ftpcopy -d -w 15 $local_addres ${job_catalog}/$remote_dayfile \"$job_catalog\" $local_dayfile > /dev/null &" >> $job_to_send |
---|
| 805 | fi |
---|
| 806 | echo "set -x" >> $job_to_send |
---|
| 807 | echo " ' exit" >> $job_to_send |
---|
| 808 | echo "set -x" >> $job_to_send |
---|
| 809 | fi |
---|
| 810 | |
---|
| 811 | |
---|
| 812 | |
---|
| 813 | # EIGENTLICHE JOB-DATEI AN QSUB-KOMMANDOS ANHAENGEN |
---|
| 814 | cat $file_to_send >> $job_to_send |
---|
| 815 | if [[ $remote_host = ibm ]] |
---|
| 816 | then |
---|
| 817 | echo " " >> $job_to_send |
---|
| 818 | echo "exit" >> $job_to_send |
---|
| 819 | fi |
---|
| 820 | |
---|
| 821 | |
---|
| 822 | |
---|
| 823 | # USER-NAME AUF ZIELRECHNER AUS .NETRC-DATEI ERMITTELN |
---|
| 824 | if [[ -z $remote_user ]] |
---|
| 825 | then |
---|
| 826 | if [[ $remote_host = t3eb || $remote_host = t3eh || $remote_host = t3ej2 || $remote_host = t3ej5 || $remote_host = t3es || $remote_host = vpp ]] |
---|
| 827 | then |
---|
| 828 | grep $remote_addres ~/.netrc | read dum dum dum remote_user dum dum |
---|
| 829 | fi |
---|
| 830 | fi |
---|
| 831 | |
---|
| 832 | |
---|
| 833 | |
---|
| 834 | # JOB AUF ZIELRECHNER TRANSFERIEREN BZW. INS JOBVERZEICHNIS KOPIEREN |
---|
| 835 | if [[ $no_submit = false ]] |
---|
| 836 | then |
---|
| 837 | if [[ $remote_host != $local_host ]] |
---|
| 838 | then |
---|
| 839 | [[ $verify = true ]] && printf "\n >>> transfering job to \"$remote_host\"..." |
---|
| 840 | if [[ $filetransfer_protocol = scp ]] |
---|
| 841 | then |
---|
| 842 | if [[ $remote_host = ibms || $remote_host = ibmy ]] # ssh on ibms cannot handle "~/" |
---|
| 843 | then |
---|
| 844 | job_catalog_save=$job_catalog |
---|
| 845 | job_catalog=job_queue |
---|
| 846 | elif [[ $remote_host = nech ]] |
---|
| 847 | then |
---|
| 848 | job_catalog_save=$job_catalog |
---|
| 849 | job_catalog=/hpf/b/${remote_user}/job_queue |
---|
| 850 | fi |
---|
| 851 | if [[ $local_host = decalpha ]] |
---|
| 852 | then |
---|
| 853 | # VERWENDUNG VON SCP AUF DECALPHA FRAGT FEHLERHAFTERWEISE |
---|
| 854 | # PASSWORT AB |
---|
| 855 | /bin/scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
| 856 | elif [[ $remote_host = nech ]] |
---|
| 857 | then |
---|
| 858 | # DATEIEN KOENNEN NUR UEBER DEN ARCHIVE-SERVER DES DKRZ |
---|
| 859 | # TRANSFERIERT WERDEN |
---|
| 860 | scp $job_to_send ${remote_user}@136.172.44.205:${job_catalog}/$job_on_remhost |
---|
| 861 | else |
---|
| 862 | scp $job_to_send ${remote_user}@${remote_addres}:${job_catalog}/$job_on_remhost |
---|
| 863 | fi |
---|
| 864 | if [[ $? = 1 ]] |
---|
| 865 | then |
---|
| 866 | locat=scp; exit |
---|
| 867 | fi |
---|
| 868 | if [[ $remote_host = ibms ]] |
---|
| 869 | then |
---|
| 870 | job_catalog=$job_catalog_save |
---|
| 871 | fi |
---|
| 872 | else |
---|
| 873 | ftpcopy -s -o $remote_addres $job_to_send "$job_catalog" $job_on_remhost |
---|
| 874 | if [[ $? = 1 ]] |
---|
| 875 | then |
---|
| 876 | locat=ftpcopy; exit |
---|
| 877 | fi |
---|
| 878 | fi |
---|
| 879 | [[ $verify = true ]] && printf "\n >>> finished\n" |
---|
| 880 | else |
---|
| 881 | eval job_catalog=$job_catalog |
---|
| 882 | cp $job_to_send ${job_catalog}/$job_on_remhost |
---|
| 883 | fi |
---|
| 884 | |
---|
| 885 | |
---|
| 886 | |
---|
| 887 | # NQS- BZW. LOADLEVELER-JOB STARTEN |
---|
| 888 | if [[ $remote_host != $local_host ]] |
---|
| 889 | then |
---|
| 890 | [[ $verify = true ]] && printf "\n >>> submitting job using \"qsub\"...\n" |
---|
| 891 | if [[ $filetransfer_protocol = scp ]] |
---|
| 892 | then |
---|
| 893 | if [[ $remote_host != lctit ]] |
---|
| 894 | then |
---|
| 895 | ssh $remote_addres -l $remote_user "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost" |
---|
| 896 | else |
---|
| 897 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
| 898 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 899 | # UEBERGANGSWEISE CHECK, OB N1GE ENVIRONMENT WIRKLICH VERFUEGBAR |
---|
| 900 | print "cd $job_catalog; chmod u+x $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
| 901 | echo "first try" > send_protocol |
---|
| 902 | while [[ $(cat send_protocol | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 903 | do |
---|
| 904 | if [[ $(cat send_protocol | grep -c "first try") = 1 ]] |
---|
| 905 | then |
---|
| 906 | printf "\n trying to submit job to TIT cluster..." |
---|
| 907 | else |
---|
| 908 | printf "\n +++ failed ... trying to submit again ..." |
---|
| 909 | fi |
---|
| 910 | print "cd $job_catalog; $submcom $job_on_remhost" | ssh $remote_addres -l $remote_user > send_protocol 2>&1 |
---|
| 911 | cat send_protocol |
---|
| 912 | done |
---|
| 913 | sleep 10 |
---|
| 914 | print "cd $job_catalog; rm $job_on_remhost" | ssh $remote_addres -l $remote_user > /dev/null 2>&1 |
---|
| 915 | echo "$submcom $job_on_remhost" |
---|
| 916 | rm send_protocol |
---|
| 917 | fi |
---|
| 918 | else |
---|
| 919 | if [[ $remote_host = ibms ]] |
---|
| 920 | then |
---|
| 921 | password=`cat ~/.netrc | grep $remote_addres | awk '{print $6}'` |
---|
| 922 | echo "echo \"$remote_user\" " > telnet_script |
---|
| 923 | echo "sleep 5" >> telnet_script |
---|
| 924 | echo "echo \"$password\" " >> telnet_script |
---|
| 925 | echo "sleep 10" >> telnet_script |
---|
| 926 | echo "echo \"\" " >> telnet_script |
---|
| 927 | echo "sleep 2" >> telnet_script |
---|
| 928 | echo "echo \"cd $job_catalog; $submcom $job_on_remhost; rm -rf $job_on_remhost\" " >> telnet_script |
---|
| 929 | echo "sleep 10" >> telnet_script |
---|
| 930 | echo "echo \"exit\" " >> telnet_script |
---|
| 931 | |
---|
| 932 | chmod u+x telnet_script |
---|
| 933 | telnet_script | telnet $remote_addres 2>&1 | grep "llsubmit:" |
---|
| 934 | rm telnet_script |
---|
| 935 | elif [[ $remote_host = t3es ]] |
---|
| 936 | then |
---|
| 937 | password=`cat ~/.netrc | grep $remote_addres | awk '{print $6}'` |
---|
| 938 | echo "printf \"$remote_user\\\n\" " > telnet_script |
---|
| 939 | echo "sleep 10" >> telnet_script |
---|
| 940 | echo "printf \"$password\\\n\" " >> telnet_script |
---|
| 941 | echo "sleep 10" >> telnet_script |
---|
| 942 | echo "printf \"\\\n\" " >> telnet_script |
---|
| 943 | echo "sleep 5" >> telnet_script |
---|
| 944 | echo "printf \"\\\n\" " >> telnet_script |
---|
| 945 | echo "sleep 5" >> telnet_script |
---|
| 946 | echo "printf \"cd $job_catalog; $submcom $job_on_remhost; rm -f $job_on_remhost\\\n\" " >> telnet_script |
---|
| 947 | echo "sleep 10" >> telnet_script |
---|
| 948 | echo "printf \"exit\\\n\" " >> telnet_script |
---|
| 949 | |
---|
| 950 | chmod u+x telnet_script |
---|
| 951 | cat telnet_script |
---|
| 952 | telnet_script | telnet $remote_addres | grep $remote_user |
---|
| 953 | rm telnet_script |
---|
| 954 | else |
---|
| 955 | remcom.x $remote_addres "cd $job_catalog; $submcom $job_on_remhost; rm $job_on_remhost" |
---|
| 956 | fi |
---|
| 957 | fi |
---|
| 958 | [[ $verify = true ]] && printf " >>> o.k.\n" |
---|
| 959 | else |
---|
| 960 | cd $job_catalog |
---|
| 961 | if [[ $(echo $local_host | cut -c1-3) = ibm ]] |
---|
| 962 | then |
---|
| 963 | eval $submcom $job_on_remhost |
---|
| 964 | elif [[ $local_host = lctit ]] |
---|
| 965 | then |
---|
| 966 | eval $submcom $job_on_remhost |
---|
| 967 | echo "$submcom $job_on_remhost" |
---|
| 968 | chmod u+x $job_on_remhost |
---|
| 969 | sleep 5 # WEIL N1GE IM HINTERGRUND ARBEITET UND DATEI SONST EVTL. |
---|
| 970 | # SCHON WIEDER GELOESCT IST |
---|
| 971 | elif [[ $local_host = nech ]] |
---|
| 972 | then |
---|
| 973 | if [[ $queue = default ]] |
---|
| 974 | then |
---|
| 975 | eval $submcom $job_on_remhost |
---|
| 976 | else |
---|
| 977 | eval $submcom -q $queue $job_on_remhost |
---|
| 978 | fi |
---|
| 979 | else |
---|
| 980 | qsub $job_on_remhost |
---|
| 981 | fi |
---|
| 982 | rm $job_on_remhost |
---|
| 983 | cd - > /dev/null |
---|
| 984 | fi |
---|
| 985 | fi |
---|
| 986 | |
---|
| 987 | |
---|
| 988 | |
---|
| 989 | # ABSCHLUSSARBEITEN |
---|
| 990 | |
---|
| 991 | if [[ $no_submit = false ]] |
---|
| 992 | then |
---|
| 993 | rm $job_to_send |
---|
| 994 | fi |
---|
| 995 | [[ $verify = true ]] && printf "\n\n *** SUBJOB finished \n\n" |
---|