source: palm/trunk/SCRIPTS/subjob @ 1090

Last change on this file since 1090 was 1090, checked in by raasch, 11 years ago

script adjustments for Kyushu-University computing center (lckyut)

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