source: palm/trunk/SCRIPTS/subjob @ 1225

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

last commit documented

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