source: palm/trunk/SCRIPTS/subjob @ 892

Last change on this file since 892 was 892, checked in by maronga, 12 years ago

bugfixes in parameter file check, adapted for lcxe6 (was lcxt4), new mrun.config parameter %login_init_cmd introduced

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