source: palm/trunk/SCRIPTS/subjob @ 1102

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

last commit documented

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