source: palm/trunk/SCRIPTS/subjob @ 116

Last change on this file since 116 was 113, checked in by raasch, 16 years ago

job classes csoloh... added for hanni

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