source: palm/trunk/SCRIPTS/subjob @ 814

Last change on this file since 814 was 814, checked in by suehring, 12 years ago

adjustment for ibmh

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