source: palm/trunk/SCRIPTS/subjob @ 492

Last change on this file since 492 was 492, checked in by maronga, 14 years ago

bugfix in the UTIL Makefile

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