source: palm/trunk/SCRIPTS/subjob @ 1103

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

small bugfixes; mrun and subjob scripts are made bash compatible; further adjustments for lckyuh

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