source: palm/trunk/SCRIPTS/subjob @ 711

Last change on this file since 711 was 696, checked in by raasch, 13 years ago

adjustments for openmp usage on ibmkisti (mrun, subjob); OpenMP-bugfixes: work_fftx removed from PRIVATE clauses in fftx_tr_xy and tr_yx_fftx (poisfft); Bugfix: Summation of Wicker-Skamarock scheme fluxes and variances for all threads (flow_statistics)

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