source: palm/trunk/SCRIPTS/subjob @ 400

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