source: palm/trunk/SCRIPTS/subjob @ 118

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

preliminary adjustments for mrun and mbuild to tsubame

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