source: palm/trunk/SCRIPTS/subjob @ 172

Last change on this file since 172 was 169, checked in by raasch, 16 years ago

property settings for scripts changed

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