source: palm/trunk/SCRIPTS/subjob @ 544

Last change on this file since 544 was 544, checked in by maronga, 14 years ago

adjustments for lcxt4

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