source: palm/trunk/SCRIPTS/subjob @ 1096

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

last commit documented

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