source: palm/trunk/SCRIPTS/subjob @ 1091

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

last commit documented

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