source: palm/trunk/SCRIPTS/subjob @ 449

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

lckyoto admitted for mrun and subjob

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