source: palm/trunk/SCRIPTS/subjob @ 1099

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

adjustments for Forwind cluster (lcflow) and Kuyshu University computing center (hayaka -lckyuh); further small adjustments for lckyut

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