source: palm/trunk/SCRIPTS/subjob @ 723

Last change on this file since 723 was 717, checked in by gryschka, 13 years ago

added lckordi

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