source: palm/trunk/SCRIPTS/subjob @ 798

Last change on this file since 798 was 789, checked in by raasch, 12 years ago

adjustments for lcsgih/lcsgib queues

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