source: palm/trunk/SCRIPTS/subjob @ 622

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

New:
---

Optional barriers included in order to speed up collective operations
MPI_ALLTOALL and MPI_ALLREDUCE. This feature is controlled with new initial
parameter collective_wait. Default is .FALSE, but .TRUE. on SGI-type
systems. (advec_particles, advec_s_bc, buoyancy, check_for_restart,
cpu_statistics, data_output_2d, data_output_ptseries, flow_statistics,
global_min_max, inflow_turbulence, init_3d_model, init_particles, init_pegrid,
init_slope, parin, pres, poismg, set_particle_attributes, timestep,
read_var_list, user_statistics, write_compressed, write_var_list)

Adjustments for Kyushu Univ. (lcrte, ibmku). Concerning hybrid
(MPI/openMP) runs, the number of openMP threads per MPI tasks can now
be given as an argument to mrun-option -O. (mbuild, mrun, subjob)

Changed:


Initialization of the module command changed for SGI-ICE/lcsgi (mbuild, subjob)

Errors:


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