source: palm/trunk/SCRIPTS/subjob @ 675

Last change on this file since 675 was 635, checked in by raasch, 13 years ago

mrun/mbuild/subjob adjustments for new Tsubama system at Tokyo Institute of Techology (lctit)

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