source: palm/trunk/SCRIPTS/subjob @ 125

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

small bugfix in subjob

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