source: palm/trunk/SCRIPTS/subjob @ 437

Last change on this file since 437 was 437, checked in by raasch, 14 years ago

script adjustements for lcxt5m

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