source: palm/tags/release-3.9/SCRIPTS/subjob @ 4012

Last change on this file since 4012 was 1021, checked in by raasch, 11 years ago

script adjustments for lcsb (Seoul National University)

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