source: palm/trunk/SCRIPTS/subjob @ 1094

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

scp/ssh port can be set explicitly

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