source: palm/trunk/SCRIPTS/subjob @ 1172

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

last commit documented

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