source: palm/tags/release-3.7/SCRIPTS/subjob @ 2716

Last change on this file since 2716 was 377, checked in by raasch, 15 years ago

adjustments for openmp usage on sgi-ice

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