source: palm/trunk/SCRIPTS/subjob @ 122

Last change on this file since 122 was 122, checked in by letzel, 16 years ago

Adjustments to mrun and subjob for lctit

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