source: palm/trunk/SCRIPTS/subjob @ 1199

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

further script adjustments for CSC Helsinki (lccrayf), executables for batch jobs can be created in advance, in order to avoid calling the compiler within the batch job

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