source: palm/trunk/SCRIPTS/subjob @ 755

Last change on this file since 755 was 749, checked in by raasch, 13 years ago

host inferno admitted

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