source: palm/trunk/SCRIPTS/subjob @ 475

Last change on this file since 475 was 475, checked in by raasch, 14 years ago

make options can be set in configuration file; bugfix for generating serial jobs; bugfix for masked output

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