source: palm/trunk/SCRIPTS/subjob @ 102

Last change on this file since 102 was 102, checked in by raasch, 17 years ago

preliminary version for coupled runs

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