source: palm/trunk/SCRIPTS/subjob @ 424

Last change on this file since 424 was 416, checked in by weinreis, 14 years ago

mrun and subjob modified for archiving

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