source: palm/trunk/SCRIPTS/subjob @ 413

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

humidity for non-flat topography implemented, re-adjustments for lcxt4

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