source: palm/trunk/SCRIPTS/subjob @ 1043

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

further script adjustments for lckiaps

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