source: palm/trunk/SCRIPTS/subjob @ 1191

Last change on this file since 1191 was 1185, checked in by heinze, 11 years ago

last commit documented

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